| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace hd\controllers;
- use biz\sj\classes\SjClass;
- use bizHd\admin\services\ShopAdminService;
- use biz\sj\classes\MerchantClass;
- use bizHd\saas\services\ApplyService;
- use bizHd\wx\services\WxBaseService;
- use bizHd\wx\services\WxOpenService;
- use common\components\stringUtil;
- use Yii;
- use common\components\util;
- use bizHd\admin\services\AdminService;
- use bizHd\saas\classes\ApplyClass;
- use bizHd\saas\services\RegionService;
- use yii\web\Controller;
- class ApplyController extends BaseController
- {
- public $guestAccessAction = ['register'];
- //我的代理 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()
- {
- $get = Yii::$app->request->get();
- $admin = $this->admin;
- $get['adminId'] = $this->adminId;
- $get['adminName'] = $admin['adminName'] ?? '';
- $get['long'] = isset($get['longitude']) ? $get['longitude'] : '';
- $get['lat'] = isset($get['latitude']) ? $get['latitude'] : '';
- $get['from'] = ApplyClass::FROM_RETAIL;
- $get['style'] = SjClass::STYLE_RETAIL;
- $name = $get['name'] ?? '';
- if (empty($name)) {
- util::fail('名称不能为空');
- }
- $has = SjClass::getByCondition(['name' => $name]);
- if (!empty($has)) {
- util::fail('名称已经存在');
- }
- $connection = Yii::$app->db;
- $transaction = $connection->beginTransaction();
- try {
- //增加或更新申请
- ApplyService::replaceRetail($get);
- $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)]);
- }
- }
|