lszyh
haoyuntao 5 months ago
parent 42467e693c
commit b3bd053478
  1. 3
      app/admin/controller/Course.php
  2. 3
      app/common/model/Course.php
  3. 12
      app/store/controller/Goods.php

@ -50,7 +50,8 @@ class Course extends Controller{
{ {
$params = $this->postForm(); $params = $this->postForm();
// $params['create_time'] = time(); // $params['create_time'] = time();
$result = CourseModel::insert($params); $model = new CourseModel();
$result = $model->save($params);
return $this->renderSuccess('新增成功'); return $this->renderSuccess('新增成功');
return $this->renderSuccess('添加成功'); return $this->renderSuccess('添加成功');
} }

@ -23,8 +23,7 @@ class Course extends BaseModel
protected $pk = 'course_id'; protected $pk = 'course_id';
// 定义时间戳字段名 // 定义时间戳字段名
protected $createTime = 'create_time'; protected $dateFormat = 'Y-m-d H:i:s';
protected $updateTime = 'update_time';
// 自动写入时间戳 // 自动写入时间戳
protected $autoWriteTimestamp = true; protected $autoWriteTimestamp = true;

@ -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('操作成功');
}
} }

Loading…
Cancel
Save