1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /**
- * CommentsController.php UTF-8
- *
- *
- * @date : 2018/6/11 18:42
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : luowei <lw@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\wapapp\controller\v8;
- use api\common\controller\V2ApiBaseController;
- use huo\controller\comment\Comment;
- use think\Lang;
- class CommentsController extends V2ApiBaseController {
- public function _initialize() {
- parent::_initialize();
- $langSet = $this->request->langset();
- Lang::load([APP_PATH.'wapapp'.DS.'lang'.DS.$langSet.DS.'comments'.EXT,]);
- }
- /**
- * 评论列表
- * http://doc.1tsdk.com/95?page_id=2389
- *【域名】/v8/comments/list
- */
- public function index() {
- $_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();
- // $_rs = $_comment_class->getList($_param, $_page.','.$_offset);
- $this->returnData($_rs);
- }
- /**
- * 添加评论
- * http://doc.1tsdk.com/95?page_id=2390
- *【域名】/v8/comments/add
- */
- public function save() {
- $this->checkLogin();
- $_mem_id = $this->getMemId();
- $_param = $this->request->param();
- $result = $this->validate($_param, 'Comment.list');
- if ($result !== true) {
- $this->error($result);
- }
- $_comment_class = new Comment();
- $_rs = $_comment_class->addComment($_param, $_mem_id);
- $this->returnData($_rs);
- }
- }
|