Selaa lähdekoodia

修改门店地址

shish 10 kuukautta sitten
vanhempi
commit
f0b1076fbd
2 muutettua tiedostoa jossa 71 lisäystä ja 3 poistoa
  1. 34 0
      app-ghs/controllers/ShopController.php
  2. 37 3
      app-hd/controllers/ShopController.php

+ 34 - 0
app-ghs/controllers/ShopController.php

@@ -9,6 +9,7 @@ use biz\sj\services\MerchantExtendService;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\ghs\classes\GhsClass;
+use bizGhs\merchant\classes\MerchantClass;
 use bizGhs\merchant\classes\ShopClass;
 use bizGhs\merchant\services\ShopService;
 use bizGhs\pictext\classes\PicTextClass;
@@ -30,6 +31,39 @@ class ShopController extends BaseController
 
     public $guestAccess = ['all'];
 
+    public function actionModifySjName()
+    {
+        $get = Yii::$app->request->get();
+        $adminId = $this->adminId;
+        if (getenv('YII_ENV') == 'production') {
+            if ($adminId != 4) {
+                util::fail('请联系管理员修改');
+            }
+        } else {
+            if ($adminId != 919) {
+                util::fail('请联系管理员修改');
+            }
+        }
+        $name = $get['name'] ?? '';
+        if (empty($name)) {
+            util::fail('请填写名称');
+        }
+        $shop = $this->shop;
+        $shop->sjName = $name;
+        $shop->save();
+        $sjId = $shop->sjId;
+        $sj = MerchantClass::getById($sjId, true);
+        if (empty($sj)) {
+            util::fail('门店信息缺失呢');
+        }
+        $sj->name = $name;
+        $sj->save();
+        $fullName = $shop->shopName == '首店' ? $name : $name . ' ' . $shop->shopName;
+        $shopId = $shop->id;
+        $py = stringUtil::py($fullName);
+        GhsClass::updateByCondition(['shopId' => $shopId], ['name' => $fullName, 'py' => $py]);
+    }
+
     //小程序端使用,下载收款码 ssh 20250821
     public function actionMiniGatheringCode()
     {

+ 37 - 3
app-hd/controllers/ShopController.php

@@ -8,6 +8,8 @@ use bizGhs\admin\classes\AdminClass;
 use bizGhs\custom\classes\CustomClass;
 use bizHd\admin\classes\ShopAdminClass;
 use bizHd\custom\classes\CustomClass as HdCustomClass;
+use bizHd\custom\classes\HdClass;
+use bizHd\merchant\classes\SjClass;
 use bizHd\merchant\services\ShopService;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\saas\services\RegionService;
@@ -26,6 +28,38 @@ class ShopController extends BaseController
 
     public $guestAccess = ['all', 'gathering-img-url', 'check-shop'];
 
+    public function actionModifySjName()
+    {
+        $get = Yii::$app->request->get();
+        $adminId = $this->adminId;
+        if (getenv('YII_ENV') == 'production') {
+            if ($adminId != 4) {
+                util::fail('请联系管理员修改');
+            }
+        } else {
+            if ($adminId != 919) {
+                util::fail('请联系管理员修改');
+            }
+        }
+        $name = $get['name'] ?? '';
+        if (empty($name)) {
+            util::fail('请填写名称');
+        }
+        $shop = $this->shop;
+        $shop->sjName = $name;
+        $shop->save();
+        $sjId = $shop->sjId;
+        $sj = SjClass::getById($sjId, true);
+        if (empty($sj)) {
+            util::fail('门店信息缺失呢');
+        }
+        $sj->name = $name;
+        $sj->save();
+        $fullName = $shop->shopName == '首店' ? $name : $name . ' ' . $shop->shopName;
+        $shopId = $shop->id;
+        HdClass::updateByCondition(['shopId' => $shopId], ['name' => $fullName]);
+    }
+
     //我的可以进入的门店 ssh 20230424
     public function actionMyShop()
     {
@@ -487,13 +521,13 @@ class ShopController extends BaseController
         $id = isset($data['id']) ? $data['id'] : 0;
         $shop = ShopClass::getById($id, true, 'id, sjId, avatar');
         ShopService::valid($shop, $this->sjId);
-        if(isset($data['avatar']) && $data['avatar']!='') {
+        if (isset($data['avatar']) && $data['avatar'] != '') {
             $shop->avatar = $data['avatar'];
             $re = $shop->save();
 
             if ($re) {
-                \bizGhs\custom\classes\CustomClass::updateByCondition(['shopId'=>$id], [
-                    'avatar'=>$data['avatar']
+                \bizGhs\custom\classes\CustomClass::updateByCondition(['shopId' => $id], [
+                    'avatar' => $data['avatar']
                 ]);
                 util::complete('头像修改完成');
             }