shish 1 день назад
Родитель
Сommit
3e7ea39391
1 измененных файлов с 39 добавлено и 0 удалено
  1. 39 0
      app-pt/controllers/ShopController.php

+ 39 - 0
app-pt/controllers/ShopController.php

@@ -97,6 +97,45 @@ class ShopController extends BaseController
         util::complete();
     }
 
+    //修改门店终端号、到期时间、续费状态等信息
+    public function actionUpdate()
+    {
+        $post = Yii::$app->request->post();
+        $id = $post['id'] ?? 0;
+        if (empty($id)) {
+            util::fail('缺少门店ID');
+        }
+        $shop = ShopClass::getById($id, true);
+        if (empty($shop)) {
+            util::fail('没有找到对应门店');
+        }
+
+        if (isset($post['lklSjNo'])) {
+            $shop->lklSjNo = trim((string)$post['lklSjNo']);
+        }
+        if (isset($post['lklB2BTermNo'])) {
+            $shop->lklB2BTermNo = trim((string)$post['lklB2BTermNo']);
+        }
+        if (isset($post['lklScanTermNo'])) {
+            $shop->lklScanTermNo = trim((string)$post['lklScanTermNo']);
+        }
+        if (isset($post['deadline'])) {
+            $shop->deadline = !empty($post['deadline']) ? trim((string)$post['deadline']) : null;
+        }
+        if (isset($post['beforeDeadline'])) {
+            $shop->beforeDeadline = !empty($post['beforeDeadline']) ? trim((string)$post['beforeDeadline']) : null;
+        }
+        if (isset($post['hasRenew'])) {
+            $shop->hasRenew = (int)$post['hasRenew'];
+        }
+
+        if ($shop->save()) {
+            util::complete('修改成功');
+        } else {
+            util::fail('修改失败');
+        }
+    }
+
     //门店列表 ssh 20210730
     public function actionList()
     {