Browse Source

修改涨价规则

shish 7 tháng trước cách đây
mục cha
commit
888705570c
1 tập tin đã thay đổi với 27 bổ sung0 xóa
  1. 27 0
      app-ghs/controllers/CustomController.php

+ 27 - 0
app-ghs/controllers/CustomController.php

@@ -952,6 +952,33 @@ class CustomController extends BaseController
         util::complete('修改成功');
     }
 
+    public function actionChangeRiseRule()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $risePercent = isset($get['risePercent']) && is_numeric($get['risePercent']) ? $get['risePercent'] : 0;
+        $riseRange = isset($get['riseRange']) && is_numeric($get['riseRange']) ? $get['riseRange'] : 0;
+        $custom = CustomClass::getById($id, true);
+        if (empty($custom)) {
+            util::fail('没有找到客户呢');
+        }
+        if ($custom->ownMainId != $this->mainId) {
+            util::fail('不是你的客户呢');
+        }
+        $ghsId = $custom->ghsId ?? 0;
+        $ghs = GhsClass::getById($ghsId, true);
+        if (empty($ghs)) {
+            util::fail('没有找到供货商呢');
+        }
+        $custom->risePercent = $risePercent;
+        $custom->riseRange = $riseRange;
+        $custom->save();
+        $ghs->risePercent = $risePercent;
+        $ghs->riseRange = $riseRange;
+        $ghs->save();
+        util::complete('修改成功');
+    }
+
     /**
      * 上门最低消费设置 -- 针对批发商客户进行批量修改
      */