12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\App;
- use think\Db;
- class Post extends Base
- {
- public function __construct(App $app = null) {
- parent::__construct($app);
- $this->model = new \app\common\model\Post();
- }
- public function add(){
- $ret=$this->model->addSave($this->userId,$this->orgId);
- if($ret){
- HelpHander::success([],'发布成功');
- }else{
- HelpHander::error($this->model->getError());
- }
- }
- public function lists(){
- $page=input('page',1);
- $size=input('size',10);
- $ret=$this->model->lists($page,$size,$this->orgId,$this->userId);
- if($ret){
- HelpHander::success($ret);
- }else{
- HelpHander::error('暂无信息');
- }
- }
- public function del(){
- $id=input('id');
- $ret=$this->model->del($id);
- if($ret){
- HelpHander::success([],'删除成功');
- }else{
- HelpHander::error('删除失败');
- }
- }
- }
|