Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fbdc96f5
authored
Oct 10, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
f8700ef2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
43 deletions
app/Console/Commands/JingDiaoOrderAddress.php
app/Console/Commands/JingDiaoOrderAddress.php
View file @
fbdc96f5
...
...
@@ -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
(),
]);
}
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment