| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace www\controllers;
- use biz\saas\classes\ApplyClass;
- use biz\saas\services\ApplyService;
- use biz\saas\services\RegionService;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- class ApplyController extends BaseController
- {
-
- //申请列表
- public function actionList()
- {
- $where = [];
- $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'] != 0) {
- util::fail('已经审过了');
- }
- if ($status == 1) {
- ApplyService::pass($id);
- }
- ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]);
- util::success('操作成功');
- }
-
- //申请试用登记 shish 2020.1.11
- public function actionRegister()
- {
- $get = Yii::$app->request->get();
- $rand = rand(0, 1);
- $data = ['focus' => 1, 'qrCode' => ''];
- if (isset($get['oldId']) && !empty($get['oldId'])) {
- $get['introMerchantId'] = $get['oldId'];
- }
- $get['userId'] = $this->userId;
- $get['long'] = isset($get['longitude']) ? $get['longitude'] : '';
- $get['lat'] = isset($get['latitude']) ? $get['latitude'] : '';
- $apply = ApplyClass::getByCondition(['userId' => $this->userId]);
- if (!empty($apply)) {
- util::fail('您已经申请过了');
- }
- ApplyClass::addApply($get);
- 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()
- {
- //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
- $status = -1;
- util::success(['status' => $status]);
- }
-
- //地图相关信息 shish 2020.1.14
- public function actionRegionRelate()
- {
- $regionTree = RegionService::tree();
- $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
- $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
- util::success($out);
- }
-
- //获取申请的验证码 shish 2020.2.23
- public function actionGetValidateCode()
- {
- $mobile = Yii::$app->request->get('mobile');
- util::success(['code' => rand(1111, 9999)]);
- }
-
- }
|