Bläddra i källkod

Merge remote-tracking branch 'origin/redesign‌-260706' into redesign‌-260706

ouyang 6 dagar sedan
förälder
incheckning
93456e505c

+ 29 - 0
app-hd/controllers/ShopController.php

@@ -166,11 +166,30 @@ class ShopController extends BaseController
         //手机号具有唯一性,暂时不允许修改 --- 同批发端 app-ghs/controllers/ShopController.php 保持一致
         unset($data['mobile']);
 
+        // 客服电话/微信二维码存 xhShopExt,不能混入主表更新
+        $serviceMobile = isset($data['serviceMobile']) ? trim((string)$data['serviceMobile']) : '';
+        $serviceWx = isset($data['serviceWx']) ? trim((string)$data['serviceWx']) : '';
+        unset($data['serviceMobile'], $data['serviceWx']);
+
         // 添加事务处理
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
             ShopClass::updateShop($shop, $data);
+            // 老门店可能没有 ext 记录:有则更新,无则补建
+            $ext = ShopExtClass::getByCondition(['shopId' => $id], true);
+            if (!empty($ext)) {
+                ShopExtClass::updateByCondition(['shopId' => $id], [
+                    'serviceMobile' => $serviceMobile,
+                    'serviceWx' => $serviceWx,
+                ]);
+            } else {
+                ShopExtClass::add([
+                    'shopId' => $id,
+                    'serviceMobile' => $serviceMobile,
+                    'serviceWx' => $serviceWx,
+                ]);
+            }
             $transaction->commit();
             util::complete();
         } catch (\Exception $exception) {
@@ -427,6 +446,16 @@ class ShopController extends BaseController
         }
         $shop = ShopClass::getShopInfo($shopId);
         $shop['hasMap'] = dict::getDict('hasMap'); //添加 hasMap 属性(字典中的 hasMap)
+
+        // 合并 xhShopExt 客服电话/微信二维码,供门店编辑页回填
+        $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+        $shortServiceWx = !empty($ext) ? ($ext->serviceWx ?? '') : '';
+        $shop['serviceMobile'] = !empty($ext) ? ($ext->serviceMobile ?? '') : '';
+        $shop['shortServiceWx'] = $shortServiceWx;
+        $shop['serviceWx'] = empty($shortServiceWx)
+            ? ''
+            : imgUtil::groupImg($shortServiceWx) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+
         util::success(['info' => $shop]);
     }
 

+ 10 - 0
app-mall/controllers/ShopController.php

@@ -2,6 +2,7 @@
 
 namespace mall\controllers;
 
+use biz\shop\classes\ShopExtClass;
 use bizHd\stat\classes\StatVisitClass;
 use bizHd\custom\classes\CustomClass;
 use bizHd\custom\classes\HdClass;
@@ -34,6 +35,15 @@ class ShopController extends BaseController
         $info['avatar'] = $avatar;
         $info['shortAvatar'] = $shortAvatar;
 
+        // 合并 xhShopExt 客服电话/微信二维码,供商城客服页展示与拨号
+        $ext = !empty($shop) ? ShopExtClass::getByCondition(['shopId' => $shop->id], true) : null;
+        $shortServiceWx = !empty($ext) ? ($ext->serviceWx ?? '') : '';
+        $info['serviceMobile'] = !empty($ext) ? ($ext->serviceMobile ?? '') : '';
+        $info['shortServiceWx'] = $shortServiceWx;
+        $info['serviceWx'] = empty($shortServiceWx)
+            ? ''
+            : imgUtil::groupImg($shortServiceWx) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+
         $user = $this->user;
         $hd = [];
         $custom = [];

+ 10 - 1
biz-hd/shop/classes/ShopClass.php

@@ -191,9 +191,18 @@ class ShopClass extends BaseClass
         if (isset($data['ptStyle']) == false) {
             util::fail('请先择平台类型');
         }
+        // 客服电话/微信二维码落在 xhShopExt,写入主表前先取出,避免未知字段干扰
+        $serviceMobile = isset($data['serviceMobile']) ? trim((string)$data['serviceMobile']) : '';
+        $serviceWx = isset($data['serviceWx']) ? trim((string)$data['serviceWx']) : '';
+        unset($data['serviceMobile'], $data['serviceWx']);
+
         $shop = self::add($data, true);
         $newShopId = $shop->id;
-        $extData = ['shopId' => $newShopId];
+        $extData = [
+            'shopId' => $newShopId,
+            'serviceMobile' => $serviceMobile,
+            'serviceWx' => $serviceWx,
+        ];
         ShopExtClass::add($extData);
 
         //商品和分类初始化

+ 6 - 1
sql/20260706_redesign.sql

@@ -409,4 +409,9 @@ ALTER TABLE `xhApply`
   ADD COLUMN `hdDiscountAmount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '邀请优惠金额' AFTER `inviteCode`,
   ADD COLUMN `inviteCommissionAmount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '邀请人佣金快照' AFTER `hdDiscountAmount`;
 ALTER TABLE `xhRenew`
-    ADD COLUMN `ptStyle` tinyint(4) NOT NULL DEFAULT '2' COMMENT '所属平台 1花店 2供货商 请查看dict.php',
+    ADD COLUMN `ptStyle` tinyint(4) NOT NULL DEFAULT '2' COMMENT '所属平台 1花店 2供货商 请查看dict.php';
+
+-- xhShopExt 表添加客服电话与微信二维码
+ALTER TABLE xhShopExt
+  ADD COLUMN serviceMobile varchar(20) NOT NULL DEFAULT '' COMMENT '客服电话' AFTER rechargeRemark,
+  ADD COLUMN serviceWx varchar(300) NOT NULL DEFAULT '' COMMENT '客服微信二维码' AFTER serviceMobile;