pages = [ 'name' => '商户推广订单' ]; } public function index() { $this->setTitle(); return $this->display($this->indexData()); } protected function postDataDb($request,$id='') { $data = $request->all(); return $data; } public function indexData() { $type = [ 'order_status'=>[1=>'交易完成',0=>'未支付'], 'pay_status' => config('adconfig.pay_status'), 'merchant'=>Merchant::get() ]; return $type; } public function show($id) { $show = $this->setModel()->find($id); //($pictrue); return $this->display(['show' => $show ]); } public function shareData($show = '') { return []; } public function setModel() { return new MerchantOrder(); } public function apiSetModelRel($model) { return $model->with('merchants','merchants2','gateways'); } public function apiJson(Request $request) { $offset = $request->input('page', 1); $pagesize = $request->input('limit', 1); $offset = ($offset - 1) * $pagesize; $order_id = $request->input('sort', 'id'); $order_type = $request->input('order', 'desc'); $debug = $request->input('debug', 0); $param=$request->all(); $search =(new SearchServices($this->setModel(),$param)); // $search->setTimeType('order'); // dump($search->echoWhere()); $model=$search->getList(); $total = $model->count(); $result = $model->skip($offset)->orderBy($order_id, $order_type)->orderBy('id', 'desc')->take($pagesize)->get();; $narr = array(); foreach ($result as $k => $v) { $v['pay_type_name']=config('adconfig.pay_type')[$v['gateway_type']]; $v['server_name']=$v->merchants['name']; $v['merchants2_name']=$v->merchants2['name']; $v['order_status_name']=config('adconfig.order_status')[$v['status']]; $v['show_url'] = $v->order_show_url; $v['gateway_name']=$v->gateways['name']; $v['gateway_mch_id']=$v->gateways['mch_id']; $v['gateway_method_name']=array_key_exists($v['gateway_method'],config('adconfig.pay_client'))?config('adconfig.pay_client')[$v['gateway_method']]:'未知'; $v['order_status_name2']=$v->OrderStatusName2; $v['ewm_info']='

备注:'.$v->ewm_mark.'

'.'

账号:'.(($v->ewm_account)?($v->ewm_account):'无').'

'; $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); } public function checkStatus(Request $request) { $id = $request->input('id'); return $this->getShow($id); } }