shish 3 лет назад
Родитель
Сommit
8c836a0e38

+ 7 - 5
app-ghs/controllers/ProductController.php

@@ -82,7 +82,7 @@ class ProductController extends BaseController
     {
         $py = Yii::$app->request->get('py', '');
         $version = Yii::$app->request->get('version', 0);
-        if($version == 0){
+        if ($version == 0) {
             util::fail('请先升级版本到1.0.70以上');
         }
         $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
@@ -280,7 +280,7 @@ class ProductController extends BaseController
         $join = $shop->join ?? 0;
         $default = $shop->default ?? 0;
         if ($join == 0 && $default == 0) {
-            util::fail('请在首店操作');
+            util::fail('请在默认门店修改');
         }
 
         $shopAdmin = $this->shopAdmin;
@@ -290,9 +290,11 @@ class ProductController extends BaseController
 
         $shop = $this->shop;
         $default = $shop->default ?? 0;
-
         $adminId = $this->adminId ?? 0;
-        $changeParams = ['staffId' => $shopAdmin->id, 'staffName' => $shopAdmin->name];
+        //normal常规改价,cg采购改价
+        $changeType = Yii::$app->request->post('changeType', 'normal');
+        $targetId = Yii::$app->request->post('targetId', 0);
+        $changeParams = ['staffId' => $shopAdmin->id, 'staffName' => $shopAdmin->name, 'changeType' => $changeType, 'targetId' => $targetId];
 
         $data = Yii::$app->request->post('data', '');
         if (empty($data)) {
@@ -356,7 +358,7 @@ class ProductController extends BaseController
                         }
                         $chainMainId = $chain->mainId ?? 0;
                         $staff = ShopAdminClass::getByCondition(['mainId' => $chainMainId, 'adminId' => $adminId], true);
-                        $changeParams2 = ['staffId' => $staff->id, 'staffName' => $staff->name];
+                        $changeParams2 = ['staffId' => $staff->id, 'staffName' => $staff->name, 'changeType' => $changeType, 'targetId' => $targetId];
                         ProductClass::changeSinglePrice($chain, $ptItemId, $price, $skPrice, $changeParams2);
                     }
                 }

+ 11 - 2
biz-ghs/product/classes/ProductClass.php

@@ -620,6 +620,14 @@ class ProductClass extends BaseClass
         $cover = $productInfo->cover ?? '';
         $staffId = $params['staffId'] ?? 0;
         $staffName = $params['staffName'] ?? '';
+        $changeType = $params['changeType'] ?? 'normal';
+        $targetId = $params['targetId'] ?? 0;
+        $event = '修改';
+        $type = 0;
+        if ($changeType == 'cg') {
+            $event = '采购修改';
+            $type = 1;
+        }
         $changeData = [
             'ptStyle' => 2,
             'sjId' => $sjId,
@@ -632,8 +640,9 @@ class ProductClass extends BaseClass
             'staffName' => $staffName,
             'name' => $name,
             'cover' => $cover,
-            'event' => '修改',
-            'type' => 0,
+            'event' => $event,
+            'type' => $type,
+            'targetId' => $targetId,
         ];
         PriceChangeClass::addData($changeData);
     }