| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <?php
- namespace hd\controllers;
- use biz\sj\classes\SjClass;
- use bizHd\saas\services\ApplyService;
- use bizHd\wx\classes\WxOpenClass;
- use common\components\dict;
- use common\components\imgUtil;
- use common\components\miniUtil;
- use common\components\stringUtil;
- use Yii;
- use common\components\util;
- use bizHd\saas\classes\ApplyClass;
- use bizHd\saas\services\RegionService;
- class ApplyController extends BaseController
- {
- public $guestAccess = ['register'];
- //邀请花店海报 shish 20210610
- public function actionInviteHdPoster()
- {
- $merchant = WxOpenClass::getWxInfo();
- $page = 'pagesClient/official/index';
- $ptStyle = dict::getDict('ptStyle', 'hd');
- $scene = 'hdShopAdminId=' . $this->shopAdminId;
- $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle);
- $url = imgUtil::groupImg($imgUrl);
- $respond = [
- 'imgUrl' => $url,
- ];
- util::success($respond);
- }
- //邀请花店海报 shish 20210610
- public function actionInviteGhsPoster()
- {
- $merchant = WxOpenClass::getGhsWxInfo();
- $page = 'pagesClient/official/index';
- $ptStyle = dict::getDict('ptStyle', 'ghs');
- $scene = 'hdShopAdminId=' . $this->shopAdminId;
- $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle);
- $url = imgUtil::groupImg($imgUrl);
- $respond = [
- 'imgUrl' => $url,
- ];
- util::success($respond);
- }
- //我的代理 ssh 2019.12.26
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $where = [];
- $where['introSjId'] = $this->sjId;
- $status = $get['status'] ?? 0;
- $style = $get['style'] ?? SjClass::STYLE_RETAIL;
- if (!empty($status)) {
- $where['status'] = $status;
- }
- $where['style'] = $style;
- $data = ApplyService::getApplyList($where);
- util::success($data);
- }
- //申请试用 ssh 2020.1.11
- public function actionRegister()
- {
- $post = Yii::$app->request->post();
- $post['adminId'] = $this->adminId;
- $admin = $this->admin->attributes;
- if (isset($admin['currentShopId']) && !empty($admin['currentShopId'])) {
- util::fail('您已经是门店员工');
- }
- if (isset($admin['openShop']) && $admin['openShop'] != 1) {
- util::fail('您已经申请过开店,或已经门店员工');
- }
- $post['adminName'] = $admin['name'] ?? '';
- $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
- $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
- $post['from'] = ApplyClass::FROM_RETAIL;
- $post['style'] = SjClass::STYLE_RETAIL;
- $name = $post['name'] ?? '';
- if (empty($name)) {
- util::fail('名称不能为空');
- }
- if (stringUtil::getWordNum($name) > 8) {
- util::fail('名称不能超过8个汉字');
- }
- $has = SjClass::getByCondition(['name' => $name, 'style' => ApplyClass::FROM_RETAIL]);
- if (!empty($has)) {
- util::fail('名称已经存在');
- }
- $connection = Yii::$app->db;
- $transaction = $connection->beginTransaction();
- try {
- //增加或更新申请
- ApplyService::replaceRetail($post);
- $transaction->commit();
- } catch (\Exception $exception) {
- $transaction->rollBack();
- Yii::info("申请报错:" . $exception->getMessage());
- util::fail('提交失败');
- }
- util::complete();
- }
- //申请状态
- public function actionApplyStatus()
- {
- //-1申请试用 0审核中 1审核通过、试用中 2审核未通过 3已付费,立即订购 4试用到期失效,待付款,立即订购,价格不显示
- $status = -1;
- util::success(['status' => $status]);
- }
- //地图相关信息 ssh 2020.1.14
- public function actionRegionRelate()
- {
- $regionTree = RegionService::tree();
- $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH';
- $out = ['region' => $regionTree, 'txMapKey' => $mapKey];
- util::success($out);
- }
- //获取申请的验证码 ssh 2020.2.23
- public function actionGetValidateCode()
- {
- $mobile = Yii::$app->request->get('mobile');
- util::success(['code' => rand(1111, 9999)]);
- }
- }
|