@ -65,7 +65,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('添加成功');
}
@ -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;
@ -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{
GoodsModel::update(['status'=>20]);