Browse Source

商家名称不能超过10个汉字

shish 5 năm trước cách đây
mục cha
commit
316cdad75f

+ 5 - 0
biz-hd/saas/classes/ApplyClass.php

@@ -122,6 +122,11 @@ class ApplyClass extends BaseClass
             $agent->inviteNum += 1;
             $agent->save();
         }
+        $name = $data['name'] ?? 0;
+        $num = stringUtil::getWordNum($name);
+        if ($num > 10) {
+            util::fail('标题不能超过10个字');
+        }
         $apply = self::add($data);
         $id = $apply['id'];
         $data['applyId'] = $id;

+ 2 - 7
biz/ghs/classes/GhsClass.php

@@ -33,10 +33,8 @@ class GhsClass extends BaseClass
         }
         $ghsShop = ShopClass::getShopInfo($ghsShopId);
         $ghsSjId = $ghsShop['merchantId'] ?? 0;
-        $ghsSj = SjClass::getById($ghsSjId);
-        $name = $ghsSj['name'] . ' ' . $ghsShop['shopName'];
+        $name = $ghsShop['merchantName'] . ' ' . $ghsShop['shopName'];
         $py = stringUtil::py($name);
-
         $ghShop = ShopClass::getShopInfo($hdShopId);
         $hdSjId = $ghShop['merchantId'] ?? 0;
 
@@ -58,11 +56,8 @@ class GhsClass extends BaseClass
             'long' => $ghsShop['long'] ?? '',
         ];
         $ghs = self::addGhs($data);
-
         $shop = ShopClass::getShopInfo($hdShopId);
-        $sjId = $shop['merchantId'] ?? 0;
-        $sj = SjClass::getById($sjId);
-        $name = $sj['name'] . ' ' . $shop['shopName'];
+        $name = $shop['merchantName'] . ' ' . $shop['shopName'];
         $py = stringUtil::py($name);
         $mobile = $shop['mobile'] ?? '';
         $ghsId = $ghs['id'] ?? 0;

+ 3 - 0
biz/sj/services/MerchantService.php

@@ -88,6 +88,7 @@ class MerchantService extends BaseService
         $applyData['parentShopId'] = $applyData['introShopId'] ?? 0;
         $sj = self::add($applyData);
         $sjId = $sj['id'];
+        $sjName = $sj['name'] ?? 0;
         $mobile = $applyData['mobile'] ?? '';
 
         if (!empty($applyId)) {
@@ -145,9 +146,11 @@ class MerchantService extends BaseService
         GoodsSettingClass::add($setData);
 
         //创建门店
+
         $shopData = [
             'shopName' => '总店',
             'merchantId' => $sjId,
+            'merchantName' => $sjName,
             'openTime' => '8:00 - 23:00',
             'telephone' => $mobile,
             'introduction' => '欢迎光临',

+ 1 - 1
common/components/stringUtil.php

@@ -91,7 +91,7 @@ class stringUtil
         return substr($string, 0, $slen) . $ext;
     }
 
-    //计算文字字数,二个字母当一个汉字
+    //返回中文字数(二个字母会当一个汉字)
     static function getWordNum($string, $code = 'utf-8')
     {
         $i = 0; //开始字节数

+ 2 - 0
sql.sql

@@ -2413,3 +2413,5 @@ ALTER TABLE xhPurchaseClear ADD customShopAdminName VARCHAR(50) NOT NULL DEFAULT
 ALTER TABLE xhPurchaseClear ADD ghsShopAdminId INT NOT NULL DEFAULT 0 COMMENT '供货商员工id' AFTER `sjId`;
 ALTER TABLE xhPurchaseClear ADD ghsShopAdminName VARCHAR(50) NOT NULL DEFAULT '' COMMENT '供货商员工名称' AFTER `ghsShopAdminId`;
 ALTER TABLE xhPurchaseClear ADD `type` TINYINT NOT NULL DEFAULT 1 COMMENT '1客户清算 2供货商清算' AFTER `id`;
+ALTER TABLE `xhGhs` MODIFY `name` VARCHAR(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '供货商名称';
+ALTER TABLE xhGhsCustom MODIFY `name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '客户名称';