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
daad3722
authored
Jun 02, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
数据导入脚本
parent
96a132f1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
21 deletions
app/Console/Commands/SetSupplierFollowUp.php
app/Http/Controllers/SupplierAccountController.php
app/Http/Services/AdminUserService.php
app/Http/Services/DataService.php
app/Http/Services/SupplierService.php
app/Http/function.php
app/Http/routes.php
public/data/supplier_group.xlsx
public/data/猎芯网qc检验记录 - 副本.xlsx:Zone.Identifier
app/Console/Commands/SetSupplierFollowUp.php
View file @
daad3722
...
...
@@ -35,7 +35,9 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierLevel();
// $service->changeSupplierTypeByIsType();
// $service->transferPayType();
$service
->
makeTempTagForSupplier
();
$service
->
importSupplierGroup
(
true
);
// $service->changeSupplierType();
// $service->generateYunxinAccount(false);
// $service->makeSupplierSystemTagAbnormal();
}
}
app/Http/Controllers/SupplierAccountController.php
View file @
daad3722
...
...
@@ -68,7 +68,7 @@ class SupplierAccountController extends Controller
{
$id
=
$request
->
get
(
'id'
);
$model
=
new
SupplierAccountModel
();
$account
=
$model
->
where
(
'id'
,
$id
)
->
first
()
->
toArray
();
$account
=
$model
->
where
(
'id'
,
$id
)
->
first
()
->
toArray
();
//获取所有启用的供应商编码,而且类型是包括云芯
$model
=
new
SupplierChannelModel
();
$suppliers
=
$model
->
where
(
'is_type'
,
0
)
...
...
app/Http/Services/AdminUserService.php
View file @
daad3722
...
...
@@ -20,6 +20,13 @@ class AdminUserService
return
$userInfoModel
->
where
(
'userId'
,
$adminId
)
->
first
();
}
public
function
getCodeIdByUserName
(
$userName
)
{
$userId
=
UserInfoModel
::
where
(
'name'
,
$userName
)
->
value
(
'userId'
);
$codeId
=
IntracodeModel
::
where
(
'admin_id'
,
$userId
)
->
value
(
'code_id'
);
return
$codeId
;
}
public
function
getCodeIdsByUserIds
(
$userIds
)
{
$intraCodeModel
=
new
IntracodeModel
();
...
...
app/Http/Services/DataService.php
View file @
daad3722
This diff is collapsed.
Click to expand it.
app/Http/Services/SupplierService.php
View file @
daad3722
...
...
@@ -418,9 +418,9 @@ class SupplierService
}
//分配采购员
public
function
allocateChannelUser
(
$supplierId
,
$channelUid
)
public
function
allocateChannelUser
(
$supplierId
,
$channelUid
,
$logFlag
=
true
)
{
$result
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
$channelUid
)
{
$result
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
$channelUid
,
$logFlag
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
$supplier
?
$supplier
->
toArray
()
:
[];
...
...
@@ -429,10 +429,18 @@ class SupplierService
$preChannelUid
[]
=
$channelUid
;
$preChannelUid
=
array_unique
(
$preChannelUid
);
$preChannelUid
=
implode
(
','
,
$preChannelUid
);
$preChannelUid
=
trim
(
$preChannelUid
,
','
);
if
(
$logFlag
)
{
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'channel_uid'
=>
$preChannelUid
,
]);
}
else
{
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'channel_uid'
=>
$preChannelUid
,
]);
}
$contactResult
=
false
;
if
(
$result
)
{
$contactModel
=
new
SupplierContactModel
();
...
...
@@ -440,11 +448,11 @@ class SupplierService
'supplier_id'
=>
$supplierId
,
'can_check_uids'
=>
$channelUid
,
'add_time'
=>
time
(),
'admin_id'
=>
request
()
->
user
->
userId
,
'admin_id'
=>
!
empty
(
request
()
->
user
->
userId
)
?
request
()
->
user
->
userId
:
1000
,
];
$contactResult
=
$contactModel
->
insert
(
$contact
);
}
if
(
$contactResult
)
{
if
(
$contactResult
&&
$logFlag
)
{
//判断是否是非正式供应商,如果是,自动转正,并且修改为待审核状态
$this
->
autoChangeIsType
(
$supplier
);
//记录日志
...
...
@@ -511,7 +519,7 @@ class SupplierService
$printData
[
'contact'
]
=
$contact
;
$attachmentModel
=
new
SupplierAttachmentsModel
();
$hasAgreement
=
$attachmentModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'field_name'
,
'quality_assurance_agreement'
)
->
exists
()
?
'已签'
:
'未签'
;
->
where
(
'field_name'
,
'quality_assurance_agreement'
)
->
exists
()
?
'已签'
:
'未签'
;
$printData
[
'has_agreement'
]
=
$hasAgreement
;
$adminUserService
=
new
AdminUserService
();
$user
=
$adminUserService
->
getAdminUserInfo
(
request
()
->
user
->
userId
);
...
...
@@ -580,8 +588,8 @@ class SupplierService
'supplier_type'
,
'settlement_type'
,
];
foreach
(
$supplier
as
$key
=>
&
$value
)
{
if
(
in_array
(
$key
,
$needChangeField
)
&&
empty
(
$value
))
{
foreach
(
$supplier
as
$key
=>
&
$value
)
{
if
(
in_array
(
$key
,
$needChangeField
)
&&
empty
(
$value
))
{
$value
=
''
;
}
}
...
...
app/Http/function.php
View file @
daad3722
...
...
@@ -204,3 +204,43 @@ function checkArrayAllValueNull($array, $excludeField = [])
return
true
;
}
function
generateMobile
(
$count
)
{
$arr
=
[
130
,
131
,
132
,
133
,
134
,
135
,
136
,
137
,
138
,
139
,
144
,
147
,
150
,
151
,
152
,
153
,
155
,
156
,
157
,
158
,
159
,
176
,
177
,
178
,
180
,
181
,
182
,
183
,
184
,
185
,
186
,
187
,
188
,
189
,
];
$phone
=
[];
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$phone
[]
=
$arr
[
array_rand
(
$arr
)]
.
''
.
mt_rand
(
1000
,
9999
)
.
''
.
mt_rand
(
1000
,
9999
);
}
return
array_unique
(
$phone
);
}
function
makePassword
(
$length
)
{
// 密码字符集,可任意添加你需要的字符
// $str = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
// 'i', 'j', 'k', 'l','m', 'n', 'o', 'p', 'q', 'r', 's',
// 't', 'u', 'v', 'w', 'x', 'y','z', 'A', 'B', 'C', 'D',
// 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L','M', 'N', 'O',
// 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y','Z',
// '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
$str
=
array
(
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
);
// 在 $str 中随机取 $length 个数组元素键名
$keys
=
array_rand
(
$str
,
$length
);
$password
=
''
;
for
(
$i
=
0
;
$i
<
$length
;
$i
++
)
{
// 将 $length 个数组元素连接成字符串
$password
.=
$str
[
$keys
[
$i
]];
}
return
$password
;
}
\ No newline at end of file
app/Http/routes.php
View file @
daad3722
...
...
@@ -53,11 +53,5 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () {
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$data
=
[
'sku_ids'
=>
'1163833791883548099,1163833787833091377'
,
'is_long_term'
=>
-
1
,
'operate_type'
=>
1
,
'cp_time'
=>
'2022-05-31 0:0:0'
,
];
(
new
SkuService
())
->
batchUpdateSkuStatus
(
$data
);
// (new \App\Http\Services\DataService())->importSupplierGroup();
});
public/data/supplier_group.xlsx
0 → 100644
View file @
daad3722
No preview for this file type
public/data/猎芯网qc检验记录 - 副本.xlsx:Zone.Identifier
deleted
100644 → 0
View file @
96a132f1
[ZoneTransfer]
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://www.tapd.cn/
HostUrl=https://file.tapd.cn/56056445/attachments/download/1156056445001001663/story
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