',1)->get(); foreach ($url_list as $k=>$v){ $token=$v->token; if (!$token){ $token=$this->getToekn($v->url,$v->id); // if ($token==0){ // break; // } } $json = '{"QueryType":"0","Code":"","BrandIDS":[],"StartDate":"","EndDate":"","StartMoney":"","EndMoney":"","WarehouseIDS":[],"AccountMethod":"","CurrencyIDS":[],"AddrName":"","AddrPhone":"","Addr":"","IsChina":"","AddrID":"","Remark":"","SourceName":"","SourcePhone":"","ProductName":"","ProductCode":"","SourceAuthorizationCode":"","SalesRemark":"","SelectOrderIDs":[],"TeamID":"","PageNo":1,"PageSize":10,"DeliveryType":"","IsCreateOrderSales":null,"Sort":"","IsAsc":false,"PackagesType":[],"BrandLevels":[],"SelfDeliveryStoreName":"","BusinessContactName":"","StateIDs":[],"TeamIDs":[],"ExpressAccountMethod":"","CustomerOrderCategoryID":0,"EMSCompany":"","DateType":"","EMSCode":"","AccuracyQueryKey":[],"NotLikeQueryKey":[],"GratisOrReachedToPay":""}'; $client=new Client(); $url = $v->url.'/api/Admin/CompanyCustomerOrderList/GetMyCustomerOrderList'; $data=json_decode($json,true); $data['PageSize']=30; $data['BrandIDS']=[1]; $data['StateIDs']=[7]; $data['EndDate']='2024-08-27 21:00:00'; $data['StartDate']='2024-08-27 08:50:00'; $re=$client->post($url,[ 'headers' => [ 'Content-Type' => 'application/json', // 设置请求头 'Auth-AdminToken' => $token, // 如果需要身份验证令牌 ], 'json'=>$data ]); // dump($re); $res=$re->getBody()->getContents(); Log::error($v->url.$res); $info=json_decode($res,true); // if ($info['errcode']=='ExpiredAuthorization' || empty($info['errcode'])){ // $this->getToekn($v->url,$v->id); // break; // } $arr=$info['data']['Models']; $this->DelOrder($arr,$v->url); } Log::error('结束'); } protected function getToekn($url,$id){ $client=new Client(); $re=$client->post($url.'/api/Admin/System/MainSubLogin',[ 'headers' => [ 'Content-Type' => 'application/json', // 设置请求头 // 'Auth-AdminToken' => 'SjI5Ym5US0xZVzZjSVd4V1FheHg4VG5hL1dpWDJwVi82RDdMY09WU3NTeENIdmJUdmxxTEFVOHZSZkRiaXM1c3RuYUlZTGVIcmI2NGlUdXJ4MXZ6dkREWmRoY283UG5TclQ2RnI5amV3UGYzYjBjNkZ0RTFzUElzRzRhV2F1d0M=', // 如果需要身份验证令牌 ], 'json'=>['UserName'=>'dwadmin','Password'=>'zS76UMV9'] ]); $res=$re->getBody()->getContents(); $info=json_decode($res,true); $urlinfo=UrlList::find($id); Log::error($res); Log::error($info); if (!$info['errcode']){ $token=$info['data']['accessToken']; $urlinfo->token=$token; $urlinfo->save(); return $token; }else{ Log::error($urlinfo->name.'生成token出错===='.$info['errcode']); return 0; } } protected function DelOrder($arr,$url){ if (!$arr){ return; } $activity_id=Activity::where('is_ing',1)->value('id'); foreach ($arr as $k=>$v){ //批发商 $order_num=$v['Code']; $order=Order::where('order_num',$order_num)->first(); if ($order){ if (!$order->is_deleted){ $order->is_deleted=1; $order->wait_back_money+=$order->pay_money; $order->save(); break; } } } } /*获取体验店*/ public function get_storename(){ return $this->success_list(Store::where('type',2)->get()); } }