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
f9dad095
authored
Jan 15, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
抄送邮件时获取联营客服上级主管
parent
ef8b4d33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
7 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
app/Http/Controllers/OrderController.php
View file @
f9dad095
...
...
@@ -2060,10 +2060,9 @@ Class OrderController extends Controller
*/
public
function
send_mail
(
Request
$request
)
{
$id
=
$request
->
input
(
'id'
);
$cc_email
=
$request
->
input
(
'cc_email'
,
''
);
$info
=
$this
->
orderDetail
(
$request
,
$id
);
$id
=
$request
->
input
(
'id'
);
$cc_email
=
$request
->
input
(
'cc_email'
,
''
);
// 额外抄送人
$info
=
$this
->
orderDetail
(
$request
,
$id
);
//循环订单详情
foreach
(
$info
[
'order_items_info'
]
as
$key
=>
$value
)
{
...
...
@@ -2114,11 +2113,21 @@ Class OrderController extends Controller
$data
[
'toUser'
]
=
$send_mail_array
;
// 收件人
$cc_send_mail_array
=
Config
(
'config.cc_email'
);
// 固定抄送人
$perm
=
new
PermController
;
$manager_email
=
$perm
->
getManager
(
$request
);
// 获取上级主管邮箱
if
(
$manager_email
)
{
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$manager_email
);
// 合并上级主管邮箱
}
$cc_send_mail_array
[]
=
$request
->
user
->
email
;
// 默认抄送给自己
$cc_send_mail_array
=
array_unique
(
$cc_send_mail_array
);
// 去重
$cc_email_arr
=
[];
if
(
$cc_email
)
{
// 后台选择的抄送人
if
(
$cc_email
)
{
// 后台选择的
额外
抄送人
$CmsModel
=
new
CmsModel
();
foreach
(
$cc_email
as
$v
)
{
...
...
app/Http/Controllers/PermController.php
View file @
f9dad095
...
...
@@ -146,7 +146,7 @@
$roleId
=
isset
(
$role
->
roleId
)
?
$role
->
roleId
:
0
;
// $user = DB::select("SELECT * FROM `t_user_perm` WHERE `bid` = $bid AND `roles` REGEXP $roleId");
$user
=
DB
::
select
(
"SELECT
*
FROM `t_user_perm` WHERE `bid` =
$bid
AND `roles` LIKE '%
\"
"
.
$roleId
.
"
\"
%' ORDER BY `mtime`"
);
$user
=
DB
::
select
(
"SELECT
`userId`
FROM `t_user_perm` WHERE `bid` =
$bid
AND `roles` LIKE '%
\"
"
.
$roleId
.
"
\"
%' ORDER BY `mtime`"
);
if
(
$user
)
{
foreach
(
$user
as
$v
)
{
...
...
@@ -155,7 +155,7 @@
if
(
$userId
)
{
foreach
(
$userId
as
$id
)
{
$userInfo
=
DB
::
table
(
'user_info'
)
->
where
(
'userId'
,
$id
)
->
select
(
'userId'
,
'name'
,
'status'
)
->
first
();
$userInfo
=
DB
::
table
(
'user_info'
)
->
where
(
'userId'
,
$id
)
->
select
(
'userId'
,
'name'
,
'
email'
,
'
status'
)
->
first
();
// 判断用户是否已离职 4为离职状态
// if ($userInfo->status != 4) {
...
...
@@ -342,4 +342,30 @@
return
$data
;
}
// 获取角色对应的主管邮箱
public
function
getManager
(
$request
)
{
$role
=
$this
->
getUserRole
(
$request
);
// 当前用户角色
$manager_key
=
array_search
(
$role
,
Config
(
'perm_args.manager_to_kefu'
));
// 获取对应的主管key
if
(
!
$manager_key
)
return
false
;
$role_name
=
array_search
(
$manager_key
,
Config
(
'perm_args.roles'
));
// 获取主管对应的角色名称
if
(
!
$role_name
)
return
false
;
$res
=
$this
->
getRoleUsers
(
$request
,
$role_name
);
// 获取角色对应的用户
$email
=
[];
if
(
$res
)
{
foreach
(
$res
as
$v
)
{
$email
[]
=
$v
->
email
;
}
}
return
$email
;
}
}
\ No newline at end of file
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