1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace box\api\controller;
- use box\common\controller\V2ApiBaseController;
- use huo\controller\comment\Comment;
- class CommentController extends V2ApiBaseController {
-
- public function getList() {
- $_param = $this->request->param();
- $result = $this->validate($_param, 'Comment.list');
- if ($result !== true) {
- $this->error($result);
- }
- $_page = $this->request->param('page/d', 1);
- $_offset = $this->request->param('offset/d', 10);
- $_comment_class = new Comment();
- $_data['type_name'] = 'game';
- $_data['object_id'] = $_param['game_id'];
- $_rdata = $_comment_class->getList($_data, $_page.','.$_offset);
- $this->returnData($_rdata);
- }
-
- public function myList() {
- $this->checkLogin();
- $_page = $this->request->param('page/d', 1);
- $_offset = $this->request->param('offset/d', 10);
- $_mem_id = $this->getMemId();
- $_comment_class = new Comment();
- $_rdata = $_comment_class->getMyGameCommentList($_mem_id, $_page.','.$_offset);
- $this->returnData($_rdata);
- }
-
- public function add() {
- $this->checkLogin();
- $_param = $this->request->param();
- $result = $this->validate($_param, 'Comment.add');
- if ($result !== true) {
- $this->error($result);
- }
- $_data['object_id'] = $_param['game_id'];
- $_data['content'] = $_param['content'];
- $_data['table_name'] = 'game';
- $_mem_id = $this->getMemId();
- $_comment_class = new Comment();
- $_rdata = $_comment_class->addComment($_data, $_mem_id);
- $this->returnData($_rdata);
- }
- }
|