Commit fbdc96f5 by 孙龙

up

parent f8700ef2
Showing with 49 additions and 43 deletions
...@@ -80,52 +80,58 @@ class JingDiaoOrderAddress extends Command ...@@ -80,52 +80,58 @@ class JingDiaoOrderAddress extends Command
// } // }
//return; //return;
DB::Connection("order")->table("lie_order")->where(["is_type"=>1])->chunk(100,function($orders){ DB::Connection("order")->table("lie_order")->where(["is_type"=>1])->orderBy("order_id","desc")->chunk(100,function($orders){
foreach($orders as $order){ foreach($orders as $order){
$address = ""; try{
$order_id = $order->order_id;
$orderRemark = $order->order_remark;
if($orderRemark == "" || !$orderRemark){ $address = "";
$address = $this->getRandomAddress(); $order_id = $order->order_id;
$address = $address->address; $orderRemark = $order->order_remark;
// $address = $this->getssq($address).$_address; if($orderRemark == "" || !$orderRemark){
$address = $this->getRandomAddress();
}elseif(preg_match("/^1[34578]\d{9}$/", trim($orderRemark))){ $address = $address->address;
$address = $this->getRandomAddress(); // $address = $this->getssq($address).$_address;
$address = $address->address;
// $address = $this->getssq($address).$_address; }elseif(preg_match("/^1[34578]\d{9}$/", trim($orderRemark))){
}else{ $address = $this->getRandomAddress();
$address = $orderRemark = trim($orderRemark); $address = $address->address;
// $address = $this->getssq($address).$_address;
}else{
$str = mb_substr($orderRemark,0,2); $address = $orderRemark = trim($orderRemark);
$region = DB::Connection("order")->table("lie_region")->whereRaw("region_name like '{$str}%'")->first();
$str = mb_substr($orderRemark,0,2);
if(!$region){
$region = DB::Connection("order")->table("lie_region")->whereRaw("region_name like '{$str}%'")->first();
continue;
} if(!$region){
if($region->parent_id != 1){ continue;
$address = $this->getregion($region->parent_id).$address; }
}else{
$address = $region->region_name.$address; if($region->parent_id != 1){
} $address = $this->getregion($region->parent_id).$address;
}else{
$address = $region->region_name.$address;
}
}
dump($address);
OrderOtherAddressModel::updateOrCreate([
"order_id"=>$order->order_id,
],[
"order_sn"=>$order->order_sn,
"address_type"=>1,
"address"=>$address,
"consignee"=>$this->getNames(2),
"mobile"=>$this->randMobile(),
]);
}catch(\Exception $e){
} }
dump($address);
OrderOtherAddressModel::updateOrCreate([
"order_id"=>$order->order_id,
],[
"order_sn"=>$order->order_sn,
"address_type"=>1,
"address"=>$address,
"consignee"=>$this->getNames(2),
"mobile"=>$this->randMobile(),
]);
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment