Question.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\controller\admin;
  3. use laytp\controller\Backend;
  4. use think\facade\Config;
  5. use laytp\library\CommonFun;
  6. /**
  7. * 会员卡
  8. */
  9. class Question extends Backend
  10. {
  11. /**
  12. * member模型对象
  13. * @var \app\model\Question
  14. */
  15. protected $model;
  16. protected $hasSoftDel=1;//是否拥有软删除功能
  17. protected $noNeedLogin = []; // 无需登录即可请求的方法
  18. protected $noNeedAuth = ['index']; // 无需鉴权即可请求的方法
  19. public function _initialize()
  20. {
  21. $this->model = new \app\model\Question();
  22. }
  23. //查看和搜索列表
  24. public function index(){
  25. global $_W;
  26. $where = $this->buildSearchParams();
  27. $where[] = ['uniacid','=',$_W['uniacid']];
  28. $order = $this->buildOrder();
  29. $data = $this->model->where($where)->order($order)->with('userInfo');
  30. $paging = $this->request->param('paging', false);
  31. if ($paging) {
  32. $limit = $this->request->param('limit', Config::get('paginate.limit'));
  33. $data = $data->paginate($limit)->toArray();
  34. $data['data'] = $this->getSelectedData($data['data']);
  35. } else {
  36. $data = $data->select()->toArray();
  37. }
  38. return $this->success('数据获取成功', $data);
  39. }
  40. }