|
|
@@ -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]);
|
|
|
}
|
|
|
|