| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace saas\controllers;
- use bizTy\sj\classes\MerchantClass;
- use biz\saas\services\ApplyService;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- class ApplyController extends BaseController
- {
- //申请列表
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $style = $get['style'] ?? MerchantClass::STYLE_RETAIL;
- $status = $get['status'] ?? 0;
- $where = [];
- if (!empty($status)) {
- $where['status'] = $status;
- }
- $where['style'] = $style;
- $list = ApplyService::getApplyList($where);
- util::success($list);
- }
- //审核
- public function actionCheck()
- {
- $id = Yii::$app->request->post('id');
- $status = Yii::$app->request->post('status', 0);
- $remark = Yii::$app->request->post('remark', '');
- $apply = ApplyService::getById($id);
- if (empty($apply)) {
- util::fail('找不到申请记录');
- }
- if ($apply['status'] != 1) {
- util::fail('已经审过了');
- }
- $connection = Yii::$app->db;
- $transaction = $connection->beginTransaction();
- try {
- ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
- if ($status == 1) {
- ApplyService::pass($id);
- }
- $transaction->commit();
- } catch (\Exception $exception) {
- $transaction->rollBack();
- Yii::info("审核操作报错:" . $exception->getMessage());
- util::fail('操作失败');
- }
- util::complete();
- }
- //申请试用登记 shish 2020.1.11
- public function actionRegister()
- {
- $post = Yii::$app->request->post();
- $rand = rand(0, 1);
- $data = ['focus' => 1, 'qrCode' => ''];
- if ($rand == 0) {
- $data = ['focus' => 0, 'qrCode' => 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3602624501,870193918&fm=26&gp=0.jpg'];
- }
- util::success($data);
- }
- //申请状态
- public function actionApplyStatus()
- {
- $status = rand(0, 4);
- util::success(['status' => $status]);
- }
- }
|