|
|
@@ -13,11 +13,9 @@ use bizHd\merchant\classes\SjClass;
|
|
|
use bizHd\merchant\services\ShopService;
|
|
|
use bizHd\purchase\classes\PurchaseClass;
|
|
|
use bizHd\saas\services\RegionService;
|
|
|
-use bizHd\shop\classes\MainClass;
|
|
|
use common\components\dict;
|
|
|
use common\components\dirUtil;
|
|
|
use common\components\imgUtil;
|
|
|
-use common\components\IntraCityExpress;
|
|
|
use common\components\stringUtil;
|
|
|
use common\components\util;
|
|
|
use common\components\wxUtil;
|
|
|
@@ -33,33 +31,44 @@ class ShopController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$adminId = $this->adminId;
|
|
|
if (getenv('YII_ENV') == 'production') {
|
|
|
- if ($adminId != 4) {
|
|
|
- util::fail('请联系管理员修改');
|
|
|
- }
|
|
|
+ // if ($adminId != 4) {
|
|
|
+ // util::fail('请联系管理员修改');
|
|
|
+ // }
|
|
|
} else {
|
|
|
- if ($adminId != 919) {
|
|
|
- util::fail('请联系管理员修改');
|
|
|
- }
|
|
|
+ // if ($adminId != 919) {
|
|
|
+ // util::fail('请联系管理员修改');
|
|
|
+ // }
|
|
|
}
|
|
|
$name = $get['name'] ?? '';
|
|
|
if (empty($name)) {
|
|
|
util::fail('请填写名称');
|
|
|
}
|
|
|
- $shop = $this->shop;
|
|
|
- $shop->merchantName = $name;
|
|
|
- $shop->save();
|
|
|
- $sjId = $shop->sjId;
|
|
|
- $sj = SjClass::getById($sjId, true);
|
|
|
- if (empty($sj)) {
|
|
|
- util::fail('门店信息缺失呢');
|
|
|
+
|
|
|
+ //开启事务
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ $shop = $this->shop;
|
|
|
+ $shop->merchantName = $name;
|
|
|
+ $shop->save();
|
|
|
+ $sj = SjClass::getById($$shop->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]);
|
|
|
+ CustomClass::updateByCondition(['shopId' => $shopId], ['originName' => $fullName]);
|
|
|
+
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete('修改成功');
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ Yii::error("修改门店名称失败:" . $exception->getMessage());
|
|
|
+ util::fail('修改门店名称失败');
|
|
|
}
|
|
|
- $sj->name = $name;
|
|
|
- $sj->save();
|
|
|
- $fullName = $shop->shopName == '首店' ? $name : $name . ' ' . $shop->shopName;
|
|
|
- $shopId = $shop->id;
|
|
|
- HdClass::updateByCondition(['shopId' => $shopId], ['name' => $fullName]);
|
|
|
- CustomClass::updateByCondition(['shopId' => $shopId], ['originName' => $fullName]);
|
|
|
- util::complete('修改成功');
|
|
|
}
|
|
|
|
|
|
//我的可以进入的门店 ssh 20230424
|