pages = [ 'name' => '操作日志' ]; } public function shareData($show='') { return $this->indexData(); } public function checkRule( $id='') { } public function setErrorMsg(){ $messages = [ ]; return $messages; } public function setModel() { return new MerchantLog(); } public function apiJson(Request $request) { $offset = $request->input('page', 1); $pagesize = $request->input('limit', 1); $offset = ($offset - 1) * $pagesize; $type = $request->input('type', '1'); $order_id = $request->input('sort', 'id'); $order_type = $request->input('order', 'desc'); $debug = $request->input('debug', 0); $model = $this->setModel(); $search_arr=[ 'merchant_id'=>[ 'type'=>'=', 'value'=>merchant('id') ] ]; $model=$this->searchKey($model,$search_arr,2); $total = $model->count(); $result = $model->skip($offset)->with('merchants')->orderBy($order_id, $order_type)->orderBy('id', 'desc')->take($pagesize)->get();; $narr = array(); foreach ($result as $k => $v) { $v['admin_name']=$v->merchants['name']; $narr[] = $v; } $json = [ "status"=>1, 'code'=>$total>0?0:1, 'msg'=>$total>0?'请求数据成功':'暂无数据', 'count' => $total, 'data' => $narr ]; if ($debug) { return $this->jsonDebug($json); } return response()->json($json); } }