|
|
@@ -5,6 +5,7 @@ namespace biz\shop\classes;
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
use biz\pt\classes\PtAssetClass;
|
|
|
use biz\sj\classes\SjClass;
|
|
|
+use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
use common\components\dict;
|
|
|
use common\components\httpUtil;
|
|
|
@@ -97,15 +98,49 @@ class ShopClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//更新门店 ssh 2020.2.29
|
|
|
- public static function updateShop($id, $data)
|
|
|
+ public static function updateShop($shop, $data)
|
|
|
{
|
|
|
+ $id = $shop['id'] ?? 0;
|
|
|
$shopName = isset($data['shopName']) ? $data['shopName'] : '';
|
|
|
+ if (stringUtil::getWordNum($shopName) > 8) {
|
|
|
+ util::fail('门店名称不能超过8个汉字,2个字母顶一个汉字');
|
|
|
+ }
|
|
|
$sjId = $data['sjId'];
|
|
|
$findShop = self::getByCondition(['sjId' => $sjId, 'shopName' => $shopName]);
|
|
|
if (!empty($findShop) && $findShop['id'] != $id) {
|
|
|
util::fail('门店名称已经存在');
|
|
|
}
|
|
|
- return self::updateById($id, $data);
|
|
|
+ $prefix = $data['province'] == $data['city'] ? $data['province'] : $data['province'] . $data['city'];
|
|
|
+ $dist = $data['dist'] ?? '';
|
|
|
+ $floor = $data['floor'] ?? '';
|
|
|
+ $address = $data['address'] ?? '';
|
|
|
+ $data['fullAddress'] = $prefix . $dist . $address . $floor;
|
|
|
+ $respond = self::updateById($id, $data);
|
|
|
+ $ptStyle = $shop['ptStyle'] ?? dict::getDict('ptStyle', 'hd');
|
|
|
+ $default = $shop['default'] ?? 0;
|
|
|
+ $sjName = $shop['merchantName'] ?? '';
|
|
|
+ //默认门店只显示商家名称即可
|
|
|
+ $name = $default == 1 ? $sjName : $sjName . ' ' . $shopName;
|
|
|
+ $shopUpdate = [
|
|
|
+ 'name' => $name,
|
|
|
+ 'mobile' => $data['mobile'] ?? '',
|
|
|
+ 'province' => $data['province'] ?? '',
|
|
|
+ 'city' => $data['city'] ?? '',
|
|
|
+ 'dist' => $data['dist'] ?? '',
|
|
|
+ 'address' => $data['address'] ?? '',
|
|
|
+ 'floor' => $data['floor'] ?? '',
|
|
|
+ 'fullAddress' => $data['fullAddress'] ?? '',
|
|
|
+ 'showAddress' => $data['showAddress'] ?? '',
|
|
|
+ 'lat' => $data['lat'] ?? '',
|
|
|
+ 'long' => $data['long'] ?? '',
|
|
|
+ ];
|
|
|
+ $where = ['sjId' => $sjId, 'shopId' => $id];
|
|
|
+ if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
|
|
|
+ CustomClass::updateByCondition($where, $shopUpdate);
|
|
|
+ } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
|
|
|
+ GhsClass::updateByCondition($where, $shopUpdate);
|
|
|
+ }
|
|
|
+ return $respond;
|
|
|
}
|
|
|
|
|
|
//取商家所有门店 ssh 2020.2.29
|