Commit fbdc96f5 by 孙龙

up

parent f8700ef2
Showing with 49 additions and 43 deletions
......@@ -80,52 +80,58 @@ class JingDiaoOrderAddress extends Command
// }
//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){
$address = "";
$order_id = $order->order_id;
$orderRemark = $order->order_remark;
if($orderRemark == "" || !$orderRemark){
$address = $this->getRandomAddress();
$address = $address->address;
// $address = $this->getssq($address).$_address;
}elseif(preg_match("/^1[34578]\d{9}$/", trim($orderRemark))){
$address = $this->getRandomAddress();
$address = $address->address;
// $address = $this->getssq($address).$_address;
}else{
$address = $orderRemark = trim($orderRemark);
$str = mb_substr($orderRemark,0,2);
$region = DB::Connection("order")->table("lie_region")->whereRaw("region_name like '{$str}%'")->first();
if(!$region){
continue;
}
if($region->parent_id != 1){
$address = $this->getregion($region->parent_id).$address;
}else{
$address = $region->region_name.$address;
}
try{
$address = "";
$order_id = $order->order_id;
$orderRemark = $order->order_remark;
if($orderRemark == "" || !$orderRemark){
$address = $this->getRandomAddress();
$address = $address->address;
// $address = $this->getssq($address).$_address;
}elseif(preg_match("/^1[34578]\d{9}$/", trim($orderRemark))){
$address = $this->getRandomAddress();
$address = $address->address;
// $address = $this->getssq($address).$_address;
}else{
$address = $orderRemark = trim($orderRemark);
$str = mb_substr($orderRemark,0,2);
$region = DB::Connection("order")->table("lie_region")->whereRaw("region_name like '{$str}%'")->first();
if(!$region){
continue;
}
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