diff --git a/plugs/think-plugs-cms/src/controller/Thumb.php b/plugs/think-plugs-cms/src/controller/Thumb.php new file mode 100644 index 0000000..5239bca --- /dev/null +++ b/plugs/think-plugs-cms/src/controller/Thumb.php @@ -0,0 +1,63 @@ +title = '点赞城市管理'; + CmsThumb::mQuery()->layTable(function () { + }, static function (QueryHelper $query) { + $query->equal('status')->like('name'); + }); + } + + public function add() + { + $this->title = '添加点赞城市'; + CmsThumb::mForm('form'); + } + + public function edit() + { + $this->title = '编辑点赞城市'; + $this->id = $this->request->param('id', 0, 'intval'); //当前栏目ID + CmsThumb::mForm('form'); + } + + public function remove() + { + CmsThumb::mDelete('id'); + } + + public function status() + { + CmsThumb::mSave($this->_vali([ + 'id.require' => '点赞城市ID不能为空', + 'status.in:0,1' => '状态值范围异常!', + 'status.require' => '状态值不能为空!', + ]), 'id'); + } + + + public function _status_save_result($state, $data) + { + if ($state) { + $status = $this->request->param('status'); + $id = $this->request->param('id'); + if ($status == 1) { + CmsThumb::mk()->where('id', $id)->save([ + 'publish_at' => date('Y-m-d H:i:s') + ]); + } + } + } +} \ No newline at end of file diff --git a/plugs/think-plugs-cms/src/model/CmsThumb.php b/plugs/think-plugs-cms/src/model/CmsThumb.php new file mode 100644 index 0000000..e6cb113 --- /dev/null +++ b/plugs/think-plugs-cms/src/model/CmsThumb.php @@ -0,0 +1,10 @@ + +
+ {notempty name='id'}{/notempty} + +