From b3bd053478ef8396ee92a88957a557f06a9dc55e Mon Sep 17 00:00:00 2001 From: haoyuntao Date: Wed, 3 Jul 2024 16:59:10 +0800 Subject: [PATCH] 20240702 --- app/admin/controller/Course.php | 3 ++- app/common/model/Course.php | 3 +-- app/store/controller/Goods.php | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/admin/controller/Course.php b/app/admin/controller/Course.php index cd0d25a3..f82838d2 100644 --- a/app/admin/controller/Course.php +++ b/app/admin/controller/Course.php @@ -50,7 +50,8 @@ class Course extends Controller{ { $params = $this->postForm(); // $params['create_time'] = time(); - $result = CourseModel::insert($params); + $model = new CourseModel(); + $result = $model->save($params); return $this->renderSuccess('新增成功'); return $this->renderSuccess('添加成功'); } diff --git a/app/common/model/Course.php b/app/common/model/Course.php index e932500f..b1e45e71 100644 --- a/app/common/model/Course.php +++ b/app/common/model/Course.php @@ -23,8 +23,7 @@ class Course extends BaseModel protected $pk = 'course_id'; // 定义时间戳字段名 - protected $createTime = 'create_time'; - protected $updateTime = 'update_time'; + protected $dateFormat = 'Y-m-d H:i:s'; // 自动写入时间戳 protected $autoWriteTimestamp = true; diff --git a/app/store/controller/Goods.php b/app/store/controller/Goods.php index 5ae56788..2280e527 100644 --- a/app/store/controller/Goods.php +++ b/app/store/controller/Goods.php @@ -378,6 +378,18 @@ class Goods extends Controller } + //商品一键上架 + public function oneClickShelf(): Json{ + + $model = new GoodsModel; + GoodsModel::update(['status'=>10]); + return $this->renderSuccess('操作成功'); + } + public function oneClickOffTheShelf(): Json{ + $model = new GoodsModel; + GoodsModel::update(['status'=>20]); + return $this->renderSuccess('操作成功'); + } }