1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- 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,]);
- }
-
- 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();
- $this->returnData($_rs);
- }
-
- 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);
- }
- }
|