|
|
@@ -6,11 +6,13 @@ use biz\sj\services\MerchantExtendService;
|
|
|
use bizGhs\admin\classes\AdminClass;
|
|
|
use bizGhs\merchant\classes\ShopClass;
|
|
|
use bizGhs\merchant\services\ShopService;
|
|
|
+use bizGhs\product\classes\ProductClass;
|
|
|
use common\components\dirUtil;
|
|
|
use common\components\httpUtil;
|
|
|
use common\components\imgUtil;
|
|
|
use common\components\util;
|
|
|
use common\components\wxUtil;
|
|
|
+use jzweb\open\weixin\lib\user;
|
|
|
use Yii;
|
|
|
use yii\web\UrlManager;
|
|
|
|
|
|
@@ -56,8 +58,29 @@ class ShopController extends BaseController
|
|
|
{
|
|
|
$data = Yii::$app->request->post();
|
|
|
$data['merchantId'] = $this->sjId;
|
|
|
- ShopClass::addShop($data);
|
|
|
- util::complete();
|
|
|
+
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try{
|
|
|
+ $shop = ShopClass::addShop($data);
|
|
|
+ $shopId = $shop['id'];
|
|
|
+ //门店product 同步数据 linqh 2021.4.18
|
|
|
+ $product = ProductClass::getAllProduct($this->sjId,$this->shopId,"name,cover,classId,itemId,rank,price,priceLabel,cost,addPrice,stockWarning,weight,alias,py,ratio,bigUnit,smallUnit,bigUnitId,smallUnitId,inTurn");
|
|
|
+ $productData = [];
|
|
|
+ foreach ($product as $v){
|
|
|
+ $tmp = $v;
|
|
|
+ $tmp['merchantId'] = $this->sjId;
|
|
|
+ $tmp['shopId'] = $shopId;
|
|
|
+ $tmp['adminId'] = $this->adminId;
|
|
|
+ $productData[] = $tmp;
|
|
|
+ }
|
|
|
+ ProductClass::batchAdd($productData);
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete();
|
|
|
+ }catch (\Exception $exception){
|
|
|
+ $transaction->rollBack();
|
|
|
+ util::fail();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//PC下载微信和支付宝收款码 ssh 2020.2.29
|