1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- /**
- * CommentController.php UTF-8
- * 评论
- *
- * @date : 2018/8/23 16:43
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HuoMp 1.0
- */
- namespace box\api\controller;
- use box\common\controller\V2ApiBaseController;
- use huo\controller\comment\Comment;
- class CommentController extends V2ApiBaseController {
- /**
- * 游戏评论列表
- * http://doc.huosdk.com/159?page_id=4497
- * 【域名】/game/comment/list
- */
- 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);
- }
- /**
- * 我的游戏评论列表
- * http://doc.huosdk.com/159?page_id=4499
- * 【域名】/game/comment/mylist
- */
- 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);
- }
- /**
- * 添加评论
- * http://doc.huosdk.com/159?page_id=4503
- * 【域名】/game/comment/add
- */
- 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);
- }
- }
|