AdminFeedbackController.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author:kane < chengjin005@163.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\portal\controller;
  12. use app\portal\model\FeedbackModel;
  13. use app\portal\model\PortalTagModel;
  14. use cmf\controller\AdminBaseController;
  15. use think\Db;
  16. /**
  17. * Class AdminTagController 标签管理控制器
  18. * @package app\portal\controller
  19. */
  20. class AdminFeedbackController extends AdminBaseController
  21. {
  22. public function index()
  23. {
  24. $param = $this->request->param();
  25. //搜索条件
  26. $where = [];
  27. if (!empty($param['type'])) {
  28. $where[] = ['type', '=', $param['type']];
  29. }
  30. if (!empty($param['status'])) {
  31. $where[] = ['status', '=', $param['status']];
  32. }
  33. $model = new FeedbackModel();
  34. $list = $model->where($where)->order('status asc,create_time desc')->paginate();
  35. $this->assign("arrStatus", $model::$STATUS);
  36. $this->assign("arrType", $model::$TYPE);
  37. $this->assign('type', isset($param['type']) ? $param['type'] : '');
  38. $this->assign('status', isset($param['status']) ? $param['status'] : '');
  39. $this->assign('list', $list);
  40. $this->assign('page', $list->render());
  41. return $this->fetch();
  42. }
  43. public function read()
  44. {
  45. $id = $this->request->param("id");
  46. if (empty($id)) {
  47. $this->error(lang("NO_ID"));
  48. }
  49. $model = new FeedbackModel();
  50. $model->isUpdate(true)->save(["status" => 1], ["id" => $id]);
  51. $this->success(lang("SAVE_SUCCESS"));
  52. }
  53. }