1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class Article extends Base
- {
- // 新增
- public function save(){
- model('Article')->add($this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 编辑
- public function update(){
- model('Article')->add($this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- // 详情
- public function detail(){
- $id = input('id/d',0);
- $ret = model('Article')->info($id);
- HelpHander::success($ret);
- }
- // 列表
- public function list(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $enable = input('enable/d',-1);
- $title = input('title','','trim');
- $type = input('type/d',0);
- $ret = model('Article')->lists($page,$size,$this->orgId,$title,$enable,$type);
- HelpHander::success($ret);
- }
- // 用户公告列表
- public function noticeList(){
- $page = input('page/d',1);
- $size = input('size/d',10);
- $status = input('status/d',-1);
- $type = input('type/d',0);
- $title = input('title','','trim');
- $ret = model('Article')->userLists($page,$size,$this->userId,$status,$title,$type);
- HelpHander::success($ret);
- }
- public function recentNoticeList(){
- $ret = model('Article')->recentNoticeList($this->userId);
- HelpHander::success($ret);
- }
- // 未读状态改为已读
- public function changeStatus(){
- $id = input('id/d',0);
- model('Article')->changeStatus($id,$this->userId);
- HelpHander::success([],'操作成功');
- }
- // 删除
- public function del(){
- $id = input('id/d',0);
- model('Article')->del($id);
- HelpHander::success([],'操作成功');
- }
- // 全部已读
- public function setAllNoticeRead(){
- model('Article')->setAllNoticeRead($this->userId,$this->orgId);
- HelpHander::success([],'操作成功');
- }
- //查询公告详情
- public function queryAppDetail(){
- $id = input('id/d',0);
- $ret = model('Article')->queryAppDetail($id);
- HelpHander::success($ret);
- }
- // 消息列表
- public function queryNewsList(){
- $ret = model('Article')->queryNewsList($this->userId,$this->orgId);
- HelpHander::success($ret);
- }
- }
|