shish 5 年 前
コミット
e1d0087f8f

+ 4 - 0
app-ghs/controllers/AuthController.php

@@ -179,6 +179,10 @@ class AuthController extends PublicController
         Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'ghs');
         $code = Yii::$app->request->get('code', '');
         if (empty($code)) {
+            $password = Yii::$app->request->get('password', '');
+            if ($password != '01231964') {
+                util::fail('验证码错误');
+            }
             $demoId = dict::getDict('ghsDemoAdminId');
             $admin = AdminClass::getById($demoId);
             if (empty($admin)) {

+ 104 - 2
app-ghs/controllers/CustomController.php

@@ -2,11 +2,12 @@
 
 namespace ghs\controllers;
 
+use biz\shop\classes\ShopClass;
 use biz\sj\classes\SjClass;
-use bizHd\saas\classes\ApplyClass;
-use bizHd\saas\services\ApplyService;
+use biz\sj\services\MerchantService;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\custom\services\CustomService;
+use bizHd\saas\classes\ApplyClass;
 use common\components\stringUtil;
 use common\components\util;
 use Yii;
@@ -14,6 +15,107 @@ use Yii;
 class CustomController extends BaseController
 {
 
+    //添加新花店 shish 2021.1.8
+    public function actionAdd()
+    {
+        $post = Yii::$app->request->post();
+        $post['style'] = SjClass::STYLE_RETAIL;
+        $post['introSjId'] = $this->sjId;
+        $post['introStyle'] = SjClass::STYLE_SUPPLIER;
+        $mobile = $post['mobile'] ?? '';
+        $confirmMobile = $post['confirmMobile'];
+        if (stringUtil::isMobile($mobile) == false) {
+            util::fail(' 请填写正确的手机号');
+        }
+        if ($mobile != $confirmMobile) {
+            util::fail('二次号码填写不一致');
+        }
+        $name = $post['name'] ?? '';
+        if (empty($name)) {
+            util::fail('名称不能为空');
+        }
+        if (stringUtil::getWordNum($name) > 8) {
+            util::fail('名称不能超过8个汉字');
+        }
+        $has = SjClass::getByCondition(['name' => $name, 'style' => ApplyClass::FROM_GHS]);
+        if (!empty($has)) {
+            util::fail('名称已经存在');
+        }
+        $has = ApplyClass::getByCondition(['mobile' => $mobile, 'style' => ApplyClass::FROM_GHS]);
+        if (!empty($has)) {
+            util::fail('手机号已经添加过');
+        }
+
+        $data = [
+            'id' => 2,
+            'name' => '小石头',
+            'avatar' => 'https://img.huaml.com/ghs/home/deserve.png',
+        ];
+        util::success($data);
+
+        $connection = Yii::$app->db;
+        $transaction = $connection->beginTransaction();
+        try {
+            $date = date("Y-m-d H:i:s");
+            $shop = $this->shop;
+            $city = $shop->city ?? '';
+            $dist = $shop->dist ?? '';
+            $address = $post['address'] ?? '';
+            $fullAddress = $city . $dist . $address;
+            $apply = [
+                'logo' => '',
+                'name' => '',
+                'hasLicense' => '',
+                'licenseNo' => '',
+                'certType' => '',
+                'adminId' => '',
+                'adminName' => '未命名',
+                'mobile' => $mobile,
+                'introSjId' => 0,
+                'introSjName' => '',
+                'introShopId' => 0,
+                'customId' => '',
+                'shopAdminId' => '',
+                'from' => '',
+                'fee' => '',
+                'income' => '',
+                'sjId' => '',
+                'style' => SjClass::STYLE_RETAIL,
+                'main' => '',
+                'long' => '',
+                'lat' => '',
+                'province' => $shop->province ?? '',
+                'city' => $city,
+                'dist' => $dist,
+                'address' => $address,
+                'floor' => '',
+                'fullAddress' => $fullAddress,
+                'showAddress' => '',
+                'remark' => '',
+                'status' => 2,
+                'addTime' => $date,
+                'updateTime' => $date,
+            ];
+            $sj = MerchantService::initSjInfo($apply);
+            $sjId = $sj['id'] ?? 0;
+            if (empty($sjId)) {
+                util::fail('添加客户没有成功');
+            }
+            $hdShop = ShopClass::getByCondition(['sjId' => $sjId], true);
+            $hdShopId = $hdShop->id ?? 0;
+            if (empty($hdShopId)) {
+                util::fail('添加客户没有成功!');
+            }
+            $custom = CustomClass::build($this->shopId, $hdShopId);
+            $transaction->commit();
+            util::success($custom);
+        } catch (\Exception $exception) {
+            $transaction->rollBack();
+            Yii::info("添加客户没有成功:" . $exception->getMessage());
+            util::fail('添加客户没有成功');
+        }
+    }
+
     //客户列表 ssh 2021.7.8
     public function actionList()
     {

+ 10 - 0
app-ghs/controllers/GhsController.php

@@ -10,6 +10,16 @@ use common\components\util;
 class GhsController extends BaseController
 {
 
+    public function actionAdd()
+    {
+        $data = [
+            'id' => 2,
+            'name' => '小石头',
+            'avatar' => 'https://img.hzghd.com/ghs/home/deserve.png',
+        ];
+        util::success($data);
+    }
+
     //供货商列表 ssh 2021.1.18
     public function actionList()
     {

+ 4 - 0
app-hd/controllers/AuthController.php

@@ -178,6 +178,10 @@ class AuthController extends PublicController
 
         $code = Yii::$app->request->get('code', '');
         if (empty($code)) {
+            $password = Yii::$app->request->get('password', '');
+            if ($password != '01231964') {
+                util::fail('验证码错误');
+            }
             $demoId = dict::getDict('hdDemoAdminId');
             $admin = AdminClass::getById($demoId);
             if (empty($admin)) {

+ 1 - 1
common/components/wxUtil.php

@@ -1465,7 +1465,7 @@ class wxUtil
             ],
             "feedback_info" => "",
             "feedback_stuff" => "",
-            "version_desc" => "右上角若有【体验】二字,点击可登陆后台体验",
+            "version_desc" => "体验码请填写:01231964,线上环境,小心操作哦,谢谢 ^_^",
         ];
 
         $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);