Packageorder.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\admin\controller\service\card;
  3. use app\common\controller\Backend;
  4. use think\Db;
  5. /**
  6. * 套餐卡订单
  7. *
  8. * @icon fa fa-circle-o
  9. */
  10. class Packageorder extends Backend
  11. {
  12. /**
  13. * Packageorder模型对象
  14. * @var \app\admin\model\service\card\Packageorder
  15. */
  16. protected $model = null;
  17. public function _initialize()
  18. {
  19. parent::_initialize();
  20. $this->model = new \app\admin\model\service\card\Packageorder;
  21. $this->view->assign("paytypeList", $this->model->getPaytypeList());
  22. $this->view->assign("isServiceList", $this->model->getIsServiceList());
  23. $this->view->assign("statusList", $this->model->getStatusList());
  24. }
  25. public function index()
  26. {
  27. //设置过滤方法
  28. $this->request->filter(['strip_tags', 'trim']);
  29. if (false === $this->request->isAjax()) {
  30. return $this->view->fetch();
  31. }
  32. //如果发送的来源是 Selectpage,则转发到 Selectpage
  33. if ($this->request->request('keyField')) {
  34. return $this->selectpage();
  35. }
  36. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  37. $list = $this->model
  38. ->where($where)
  39. ->where('is_service','in','0,-1')
  40. ->order($sort, $order)
  41. ->paginate($limit);
  42. if($list)
  43. {
  44. foreach ($list as &$value)
  45. {
  46. $value->nickname = \app\admin\model\User::where(['id'=>$value->user_id])->value('nickname');
  47. }
  48. }
  49. $result = ['total' => $list->total(), 'rows' => $list->items()];
  50. return json($result);
  51. }
  52. }