Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

98 rader
1.6 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: 002-PC
  5. * Date: 2017/7/4
  6. * Time: 14:49
  7. */
  8. namespace admin\controllers\prod;
  9. use admin\service\prod\CommentService;
  10. use common\Controller\AdminController;
  11. use common\util\Util;
  12. //use common\util\Util;
  13. //use Yii;
  14. class CommentController extends AdminController
  15. {
  16. public function service(){
  17. if ($this->service == '') {
  18. $this->service = new CommentService();
  19. }
  20. return $this->service;
  21. }
  22. //页面处理
  23. /**
  24. * Des:添加评论
  25. * Name: actionAddTravel
  26. * @return string
  27. * @author 孙彤
  28. */
  29. public function actionAddTravel()
  30. {
  31. $param = [
  32. 'travel_id' => $this->_post('travel_id', ''),
  33. 'prod_id' => $this->_post('prod_id', ''),
  34. 'star' => $this->_post('star', ''),
  35. 'content' => $this->_post('content', ''),
  36. 'u_id' => $this->_post('u_id'),
  37. 'create_time'=>date('Y-m-d H:i:s')
  38. ];
  39. // var_dump($param);
  40. $addFlag = $this->service()->AddTravel($param);
  41. if ($addFlag['flag'] == false) {
  42. return Util::returnJsEr($addFlag['msg']);
  43. }
  44. return Util::returnJsSu($addFlag['msg']);
  45. }
  46. /**
  47. * Des:评论列表
  48. * Name: actionCommentList
  49. * @return string
  50. * @author
  51. */
  52. public function actionCommentList(){
  53. $param=[
  54. "current_page"=>$this->_post('current_page','1'),
  55. "page_size"=>$this->_post('page_size','10')
  56. ];
  57. $result = $this->service()->CommentList($param);
  58. return json_encode($result);
  59. }
  60. }