From 541bfe2f43eeb271290af505a0ce3bd9bdc591b3 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 22 Aug 2023 15:05:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/RemoteController.php | 5 +- app/api/controller/TaskController.php | 120 ++++++++++++++---------- 2 files changed, 72 insertions(+), 53 deletions(-) diff --git a/app/api/controller/RemoteController.php b/app/api/controller/RemoteController.php index 21be815bf..85ce1558e 100644 --- a/app/api/controller/RemoteController.php +++ b/app/api/controller/RemoteController.php @@ -91,7 +91,7 @@ class RemoteController extends BaseApiController } } - public function shang_date_list($company,$is_day=1){ + public function shang_date_list($company,$is_day,$querys){ if($is_day==1){ $yesterday = date('Y-m-d'); }else{ @@ -131,6 +131,9 @@ class RemoteController extends BaseApiController return false; } + if(isset($querys['page'])){ + $parmas['page']=$querys['page']; + } try{ $list = HttpClient::create()->request('GET', 'https://crmeb-test.shop.lihaink.cn/api/region/order', [ 'query' => $parmas, diff --git a/app/api/controller/TaskController.php b/app/api/controller/TaskController.php index fbfbcb967..841f5a949 100644 --- a/app/api/controller/TaskController.php +++ b/app/api/controller/TaskController.php @@ -7,74 +7,90 @@ use app\common\model\informationg\UserInformationg; use app\common\model\task\Task; use app\common\model\user\User; -class TaskController extends BaseApiController{ +class TaskController extends BaseApiController +{ - public function lists(){ + public function lists() + { $param = Request()->param(); [$page, $limit] = $this->getPage(); - if($this->userInfo['admin_id']!=0){ - $where[]=['company_id','=',$this->userInfo['company_id']]; - }else{ - $is_captain=User::where('id',$this->userId)->value('is_captain'); - if($is_captain==1){ - $where[]=['type','=',31]; - }else{ - $where[]=['director_uid','=',$this->userId]; + if ($this->userInfo['admin_id'] != 0) { + $where[] = ['company_id', '=', $this->userInfo['company_id']]; + } else { + $is_captain = User::where('id', $this->userId)->value('is_captain'); + if ($is_captain == 1) { + $where[] = ['type', '=', 31]; + } else { + $where[] = ['director_uid', '=', $this->userId]; } - $where[]=['company_id','=',$this->userInfo['company_id']]; + $where[] = ['company_id', '=', $this->userInfo['company_id']]; // $where[]=['status','in',[1,2,3,5]]; } - if(isset($param['date_time']) && $param['date_time']!=''){ - $time=strtotime($param['date_time']); - $end=$time+86399; - $where[]=['start_time','between',[$time,$end]]; - }else{ - $time=strtotime(date('Y-m-d')); - $end=$time+86399; - $where[]=['start_time','between',[$time,$end]]; + if (isset($param['date_time']) && $param['date_time'] != '') { + $time = strtotime($param['date_time']); + $end = $time + 86399; + $where[] = ['start_time', 'between', [$time, $end]]; + } else { + $time = strtotime(date('Y-m-d')); + $end = $time + 86399; + $where[] = ['start_time', 'between', [$time, $end]]; } - if(isset($param['status']) && $param['status']>0){ - $where[]=['status','=',$param['status']]; + if (isset($param['status']) && $param['status'] > 0) { + $where[] = ['status', '=', $param['status']]; } - $res=Task::where($where) - ->field(['id', 'title','money','template_id','director_uid', 'company_id', 'start_time', 'end_time', 'director_uid', 'type', 'status', 'content','extend']) - ->page($page,25) - ->order(['id' => 'desc','status'=>'asc']) - ->select()->toArray(); - foreach($res as $k=>$item){ - if($item['type']==33){ + $res = Task::where($where) + ->field(['id', 'title', 'money', 'template_id', 'director_uid', 'company_id', 'start_time', 'end_time', 'director_uid', 'type', 'status', 'content', 'extend']) + ->page($page, 25) + ->order(['id' => 'desc', 'status' => 'asc']) + ->select()->toArray(); + foreach ($res as $k => $item) { + if ($item['type'] == 33) { $company = Company::where('id', $item['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足 - $find=App(RemoteController::class)->shang_date_total_price($company); - $list=App(RemoteController::class)->shang_date_list($company); - if($find!=false){ - $res[$k]['extend']['transaction']=$find; - $res[$k]['extend']['transaction']['list']=$list; - }else{ - $res[$k]['extend']['transaction']=''; + $find = App(RemoteController::class)->shang_date_total_price($company); + if ($find != false) { + $res[$k]['extend']['transaction'] = $find; + } else { + $res[$k]['extend']['transaction'] = ''; } } } return $this->success('ok', $res); } - public function informationg_list(){ - $parmas=Request()->param(); - $find=Task::where('id',$parmas['id'])->find(); - if($find['type']==31){ - if(isset($find['extend']['informationg']['ids'])){ - $ids=$find['extend']['informationg']['ids']; - $list= UserInformationg::where('id','in',$ids) - ->field('id,name,phone,sex,age,update_time, - area_id,area_id area_name,street_id,street_id street_name,village_id,village_id village_name,brigade_id,brigade_id brigade_name,address' - )->select()->toArray(); - }else{ - $list=[]; - } + //交易详情 + public function order_detail() + { + $parmas = $this->request->param(); + $company = Company::where('id', $parmas['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足 + $find = App(RemoteController::class)->shang_date_total_price($company); - }else{ - $list=[]; + $list = App(RemoteController::class)->shang_date_list($company,1,$parmas); + if ($find != false) { + $find['list']=$list; + return $this->success('ok', $find); } - return $this->success('ok',$list); + return $this->success('ok'); } -} \ No newline at end of file + + public function informationg_list() + { + $parmas = Request()->param(); + $find = Task::where('id', $parmas['id'])->find(); + if ($find['type'] == 31) { + if (isset($find['extend']['informationg']['ids'])) { + $ids = $find['extend']['informationg']['ids']; + $list = UserInformationg::where('id', 'in', $ids) + ->field( + 'id,name,phone,sex,age,update_time, + area_id,area_id area_name,street_id,street_id street_name,village_id,village_id village_name,brigade_id,brigade_id brigade_name,address' + )->select()->toArray(); + } else { + $list = []; + } + } else { + $list = []; + } + return $this->success('ok', $list); + } +}