model = new \app\admin\model\Merchant; $this->view->assign("settleTypeList", $this->model->getSettleTypeList()); $this->view->assign("verifyStatusList", $this->model->getVerifyStatusList()); } protected $relationSearch = true; public function index() { $this->request->filter(['strip_tags', 'trim']); if (false === $this->request->isAjax()) { return $this->view->fetch(); } if ($this->request->request('keyField')) { return $this->selectpage(); } [$where, $sort, $order, $offset, $limit] = $this->buildparams(); $list = $this->model ->with(['user']) ->where($where) ->order($sort, $order) ->paginate($limit); $result = ['total' => $list->total(), 'rows' => $list->items()]; return json($result); } /** * 商户企业全景资质 */ public function detail($ids = null) { $row = $this->model->with(['user'])->find($ids); if (!$row) { $this->error(__('No Results were found')); } // 查询商户派发的工单记录 $recentOrders = \think\Db::name('order') ->where('user_id', $row['user_id']) ->order('id desc') ->limit(6) ->select(); $this->view->assign('row', $row); $this->view->assign('recentOrders', $recentOrders); return $this->view->fetch(); } }