浏览代码

修改创建时间

shish 1 年之前
父节点
当前提交
b01c900a32
共有 1 个文件被更改,包括 25 次插入0 次删除
  1. 25 0
      app-ghs/controllers/LiveOrderController.php

+ 25 - 0
app-ghs/controllers/LiveOrderController.php

@@ -249,4 +249,29 @@ class LiveOrderController extends BaseController
         util::success($info);
     }
 
+    //修改创建时间 ssh 20241006
+    public function actionChangeDate()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $live = LiveOrderClass::getById($id, true);
+        if (empty($live)) {
+            util::fail('没有找到');
+        }
+        if ($live->mainId != $this->mainId) {
+            util::fail('不是你的');
+        }
+        $flag = $get['flag'] ?? 0;
+        $addTime = $live->addTime;
+        if ($flag == 0) {
+            $time = strtotime($addTime) - 86400;
+        } else {
+            $time = strtotime($addTime) + 86400;
+        }
+        $newDate = date("Y-m-d H:i:s", $time);
+        $live->addTime = $newDate;
+        $live->save();
+        util::complete('修改成功');
+    }
+
 }