|
|
@@ -44,11 +44,19 @@ class GhsController extends BaseController
|
|
|
if (empty($list)) {
|
|
|
util::fail('没有找到门店');
|
|
|
}
|
|
|
- foreach ($list as $current) {
|
|
|
- $ownShopId = $current['id'];
|
|
|
- GhsClass::build($currentShopId, $ownShopId, $ownSjId);
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ foreach ($list as $current) {
|
|
|
+ $ownShopId = $current['id'];
|
|
|
+ GhsClass::build($currentShopId, $ownShopId, $ownSjId);
|
|
|
+ }
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete();
|
|
|
+ } catch (Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ util::fail("绑定失败");
|
|
|
}
|
|
|
- util::complete();
|
|
|
}
|
|
|
|
|
|
}
|