| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace shop\controllers;
- use biz\admin\services\ShopAdminService;
- use biz\saas\services\ApplyService;
- use biz\wx\services\WxBaseService;
- use biz\wx\services\WxOpenService;
- use common\components\stringUtil;
- use Yii;
- use common\components\util;
- use biz\admin\services\AdminService;
- use biz\saas\classes\ApplyClass;
- use biz\saas\services\RegionService;
- use yii\web\Controller;
- class ApplyController extends BaseController
- {
- //我的代理 shish 2019.12.26
- public function actionList()
- {
- $status = Yii::$app->request->get('status', 0);
- $where = [];
- $where['introMerchantId'] = $this->merchantId;
- if ($status != -1) {
- $where['status'] = $status;
- }
- $data = ApplyService::getApplyList($where);
- util::success($data);
- }
-
- //审核
- 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();
- $get['adminId'] = $this->adminId;
- $get['long'] = isset($get['longitude']) ? $get['longitude'] : '';
- $get['lat'] = isset($get['latitude']) ? $get['latitude'] : '';
- $introMerchantId = isset($get['introMerchantId']) && !empty($get['introMerchantId']) ? $get['introMerchantId'] : 0;
- if (empty($introMerchantId)) {
- util::fail('只有邀请了才能注册哦~');
- }
- $mobile = isset($get['mobile']) && !empty($get['mobile']) && stringUtil::isMobile($get['mobile']) ? $get['mobile'] : 0;
- if (empty($mobile)) {
- util::fail('请填写正确手机号');
- }
- $admin = AdminService::getById($this->adminId);
- ApplyService::addApply($get);
- $wxBase = WxBaseService::getWxBase();
- $wxAliasName = isset($wxBase['wxAliasName']) && !empty($wxBase['wxAliasName']) ? $wxBase['wxAliasName'] : 'ihuahuibao';
- $focus = isset($admin['subscribe']) ? $admin['subscribe'] : 0;
- $data = ['focus' => $focus, 'wxAliasName' => $wxAliasName];
- 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)]);
- }
- }
|