|
@@ -59,23 +59,13 @@ class ShopController extends BaseController
|
|
|
{
|
|
{
|
|
|
$data = Yii::$app->request->post();
|
|
$data = Yii::$app->request->post();
|
|
|
$data['merchantId'] = $this->sjId;
|
|
$data['merchantId'] = $this->sjId;
|
|
|
|
|
+ $data['shopId'] = $this->shopId;
|
|
|
|
|
+ $data['adminId'] = $this->adminId;
|
|
|
$data['img'] = is_array($data['img']) ? json_encode($data['img']) : $data['img'];
|
|
$data['img'] = is_array($data['img']) ? json_encode($data['img']) : $data['img'];
|
|
|
$connection = Yii::$app->db;
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
try {
|
|
|
$shop = ShopClass::addShop($data);
|
|
$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();
|
|
$transaction->commit();
|
|
|
util::complete();
|
|
util::complete();
|
|
|
} catch (\Exception $exception) {
|
|
} catch (\Exception $exception) {
|