1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\App;
- class Comment extends Base
- {
- public function __construct(App $app = null) {
- parent::__construct($app);
- $this->model = new \app\common\model\Comment();
- }
- public function add(){
- $jsonArray=[
- 'score'=>input('score'),
- 'content'=>input('content'),
- 'userId'=>$this->userId,
- 'type'=>input('type'),
- 'fromId'=>input('fromId'),
- 'orgId'=>$this->orgId
- ];
- $ret=$this->model->addSave($jsonArray);
- if($ret){
- HelpHander::success([],'添加成功');
- }else{
- HelpHander::error($this->model->getError());
- }
- }
- public function detail(){
- $id = input('id');
- $ret = $this->model->details($id);
- if($ret){
- HelpHander::success($ret);
- }else{
- HelpHander::error('暂无信息');
- }
- }
- public function list(){
- $page = input('page/d',1);
- $size = input('size/d',20);
- $ret = $this->model->lists($this->userId,$this->orgId,$page,$size);
- HelpHander::success($ret);
- }
- }
|