* @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); } }