Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
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
c9fc98bb
authored
Jun 15, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量修改内部编码
parent
c9e2e736
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
c9fc98bb
...
...
@@ -395,12 +395,47 @@ class DataService
$createTimestamp
=
$lastTimestamp
+
rand
(
60
,
3600
);
}
$lastTimestamp
=
$createTimestamp
;
dump
(
date
(
'Y-m-d H:i:s'
,
$createTimestamp
));
dump
(
date
(
'Y-m-d H:i:s'
,
$createTimestamp
));
SupplierAccountModel
::
where
(
'id'
,
$account
[
'id'
])
->
update
([
'create_time'
=>
$createTimestamp
]);
}
}
//修复采购员有问题的数据
public
function
fixHasProblemChannelUid
(
$isUpdate
=
false
)
{
//1743
//1753
//1527
$channelUidsMap
=
[
1743
=>
10201
,
1753
=>
10207
,
1527
=>
10177
,
];
$supplierModel
=
\DB
::
connection
(
'web'
);
foreach
(
$channelUidsMap
as
$channelUid
=>
$codeId
)
{
$suppliers
=
$supplierModel
->
table
(
'supplier_channel'
)
->
where
(
'channel_uid'
,
'like'
,
"
$channelUid
%"
)
->
where
(
'is_type'
,
0
)
->
get
();
foreach
(
$suppliers
as
$supplier
)
{
$channelUidNew
=
str_replace
(
$channelUid
,
$codeId
,
$supplier
[
'channel_uid'
]);
dump
(
"旧的采购员是 : "
.
$supplier
[
'channel_uid'
]);
dump
(
"新的采购员是 : "
.
$channelUidNew
);
if
(
$isUpdate
)
{
$supplierModel
->
table
(
'supplier_channel'
)
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'channel_uid'
=>
$channelUidNew
,
]);
SupplierContactModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
where
(
'can_check_uids'
,
$channelUid
)
->
update
([
'can_check_uids'
=>
$codeId
]);
}
}
}
}
}
app/Http/routes.php
View file @
c9fc98bb
...
...
@@ -53,5 +53,5 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () {
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
// (new \App\Http\Services\DataService())->importSupplierGroup(
);
(
new
\App\Http\Services\DataService
())
->
fixHasProblemChannelUid
(
false
);
});
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