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
cd093441
authored
Jun 23, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
离职下拉
parent
693c6a1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
app/Http/Transformers/SupplierTransformer.php
app/Model/IntracodeModel.php
app/Http/Transformers/SupplierTransformer.php
View file @
cd093441
...
...
@@ -20,7 +20,7 @@ class SupplierTransformer
public
function
transformList
(
$list
)
{
$intracodeModel
=
new
IntracodeModel
();
$users
=
$intracodeModel
->
getSampleEncode
();
$users
=
$intracodeModel
->
getSampleEncode
(
true
);
$supplierIds
=
array_column
(
$list
,
'supplier_id'
);
$viewCheckService
=
new
ViewCheckService
();
$viewData
=
$viewCheckService
->
checkSupplierView
(
$supplierIds
);
...
...
@@ -90,7 +90,7 @@ class SupplierTransformer
return
[];
}
$intracodeModel
=
new
IntracodeModel
();
$users
=
$intracodeModel
->
getSampleEncode
();
$users
=
$intracodeModel
->
getSampleEncode
(
true
);
$supplier
[
'qualification_photos'
]
=
trim
(
$supplier
[
'qualification_photos'
]);
$supplier
[
'stockup_type_data'
]
=
$this
->
transformStockupTypeData
(
$supplier
[
'stockup_type'
]);
$supplier
[
'established_time'
]
=
!
empty
(
$supplier
[
'established_time'
])
?
date
(
'Y-m-d'
,
...
...
app/Model/IntracodeModel.php
View file @
cd093441
...
...
@@ -11,14 +11,18 @@ class IntracodeModel extends Model
protected
$table
=
'lie_intracode'
;
protected
$primaryKey
=
'code_id'
;
//不包含离职
public
function
getEncode
()
//
默认
不包含离职
public
function
getEncode
(
$includeResigned
=
false
)
{
$redis
=
new
RedisModel
();
$codeList
=
json_decode
(
$redis
->
get
(
'EncodedList_supplier
'
),
true
);
$codeList
=
json_decode
(
$redis
->
get
(
'EncodedList_supplier
_'
.
$includeResigned
),
true
);
if
(
!
$codeList
)
{
$codeList
=
$this
->
where
(
'admin_id'
,
'>'
,
0
)
->
join
(
'user_info'
,
'lie_intracode.admin_id'
,
'='
,
'user_info.userId'
)
->
where
(
'user_info.status'
,
'!='
,
4
)
->
select
(
'code_id'
,
'admin_id'
,
'name'
,
$query
=
$this
->
where
(
'admin_id'
,
'>'
,
0
)
->
join
(
'user_info'
,
'lie_intracode.admin_id'
,
'='
,
'user_info.userId'
);
if
(
!
$includeResigned
)
{
$query
->
where
(
'user_info.status'
,
'!='
,
4
);
}
$codeList
=
$query
->
select
(
'code_id'
,
'admin_id'
,
'name'
,
'email'
)
->
get
();
if
(
$codeList
)
{
$codeList
=
$codeList
->
toArray
();
...
...
@@ -27,8 +31,8 @@ class IntracodeModel extends Model
$v
[
'name'
]
=
$v
[
'email'
];
}
}
$redis
->
set
(
'EncodedList_supplier
'
,
json_encode
(
$codeList
));
$redis
->
expire
(
'EncodedList_supplier
'
,
60
*
10
);
//缓存10分钟
$redis
->
set
(
'EncodedList_supplier
_'
.
$includeResigned
,
json_encode
(
$codeList
));
$redis
->
expire
(
'EncodedList_supplier
_'
.
$includeResigned
,
60
*
10
);
//缓存10分钟
}
}
return
$codeList
;
...
...
@@ -40,7 +44,8 @@ class IntracodeModel extends Model
$redis
=
new
RedisModel
();
$codeList
=
json_decode
(
$redis
->
get
(
'EncodedList_all_supplier'
),
true
);
if
(
!
$codeList
)
{
$codeList
=
$this
->
where
(
'admin_id'
,
'>'
,
0
)
->
join
(
'user_info'
,
'lie_intracode.admin_id'
,
'='
,
'user_info.userId'
)
$codeList
=
$this
->
where
(
'admin_id'
,
'>'
,
0
)
->
join
(
'user_info'
,
'lie_intracode.admin_id'
,
'='
,
'user_info.userId'
)
->
select
(
'code_id'
,
'admin_id'
,
'name'
,
'email'
)
->
get
();
if
(
$codeList
)
{
$codeList
=
$codeList
->
toArray
();
...
...
@@ -57,9 +62,10 @@ class IntracodeModel extends Model
}
//获取简单的内部用户数据
public
function
getSampleEncode
()
//默认不包含离职的
public
function
getSampleEncode
(
$includeResigned
=
false
)
{
$codeList
=
$this
->
getEncode
();
$codeList
=
$this
->
getEncode
(
$includeResigned
);
$result
=
[];
foreach
(
$codeList
as
$code
)
{
$result
[
$code
[
'code_id'
]]
=
$code
[
'name'
]
.
'('
.
$code
[
'code_id'
]
.
')'
;
...
...
@@ -88,7 +94,7 @@ class IntracodeModel extends Model
$usersOperation
=
$departmentService
->
getUserByDepartmentId
(
9
);
//采购部
$userChannel
=
$departmentService
->
getUserByDepartmentId
(
8
);
$users
=
array_merge
(
array_merge
(
$usersMarket
,
$usersOperation
),
$userChannel
);
$users
=
array_merge
(
array_merge
(
$usersMarket
,
$usersOperation
),
$userChannel
);
$userIds
=
array_column
(
$users
,
'userId'
);
$users
=
$this
->
getEncodeByUserIds
(
$userIds
);
$result
=
[];
...
...
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