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
e7b57553
authored
Jun 15, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整邮件
parent
4fe55788
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
35 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
config/config.php
app/Http/Controllers/OrderController.php
View file @
e7b57553
...
@@ -2069,11 +2069,11 @@ Class OrderController extends Controller
...
@@ -2069,11 +2069,11 @@ Class OrderController extends Controller
{
{
$id
=
$request
->
input
(
'id'
);
$id
=
$request
->
input
(
'id'
);
$cc_email
=
$request
->
input
(
'cc_email'
,
''
);
// 额外抄送人
$cc_email
=
$request
->
input
(
'cc_email'
,
''
);
// 额外抄送人
$info
=
$this
->
orderDetail
(
$request
,
$id
);
$info
=
$this
->
orderDetail
(
$request
,
$id
);
$send_buyers
=
[];
// 发送采购邮件数据
$send_buyers
=
[];
// 发送采购邮件数据
$CmsModel
=
new
CmsModel
();
$CmsModel
=
new
CmsModel
();
$sale_name
=
$CmsModel
->
getUserName
(
$info
[
'order_info'
][
'sale_id'
]);
//获取业务员
$sale_name
=
$CmsModel
->
getUserName
(
$info
[
'order_info'
][
'sale_id'
]);
//获取业务员
//循环订单详情
//循环订单详情
foreach
(
$info
[
'order_items_info'
]
as
$key
=>
$value
)
{
foreach
(
$info
[
'order_items_info'
]
as
$key
=>
$value
)
{
...
@@ -2097,47 +2097,24 @@ Class OrderController extends Controller
...
@@ -2097,47 +2097,24 @@ Class OrderController extends Controller
$tmp
[
'deliveryTime'
]
=
$value
[
'batch'
];
//批次
$tmp
[
'deliveryTime'
]
=
$value
[
'batch'
];
//批次
$tmp
[
'send_email'
]
=
!
empty
(
$value
[
'send_email'
])
?
$value
[
'send_email'
]
:
''
;
$tmp
[
'send_email'
]
=
!
empty
(
$value
[
'send_email'
])
?
$value
[
'send_email'
]
:
''
;
$send_buyers
[
$value
[
'send_email'
]][
'data'
][]
=
$tmp
;
$send_buyers
[
$value
[
'buyer_id'
]][
'data'
][]
=
$tmp
;
$send_buyers
[
$value
[
'send_email'
]][
'toUser'
]
=
$value
[
'send_email'
];
$send_buyers
[
$value
[
'buyer_id'
]][
'toUser'
]
=
$value
[
'send_email'
];
$send_buyers
[
$value
[
'send_email'
]][
'ccUser'
]
=
[];
$send_buyers
[
$value
[
'buyer_id'
]][
'date'
]
=
date
(
'Y-m-d'
,
time
());
$send_buyers
[
$value
[
'send_email'
]][
'date'
]
=
date
(
'Y-m-d'
,
time
());
$send_buyers
[
$value
[
'buyer_id'
]][
'date'
]
=
intval
(
$id
);
$send_buyers
[
$value
[
'send_email'
]][
'date'
]
=
intval
(
$id
);
$send_buyers
[
$value
[
'buyer_id'
]][
'id'
]
=
$sale_name
;
$send_buyers
[
$value
[
'send_email'
]][
'id'
]
=
$sale_name
;
$send_buyers
[
$value
[
'buyer_id'
]][
'ccUser'
]
=
[];
$tmp
[
'projectId'
]
=
$key
+
1
;
$tmp
[
'projectId'
]
=
$key
+
1
;
$data
[
'data'
][]
=
$tmp
;
$data
[
'data'
][]
=
$tmp
;
}
}
// 各个采购邮件推入队列
foreach
(
$send_buyers
as
&
$v
)
{
$v
[
'combined'
]
=
0
;
foreach
(
$v
[
'data'
]
as
$item
)
{
$v
[
'combined'
]
+=
$item
[
'totalPrice'
];
}
$this
->
pushQueue
(
$v
);
}
$data
[
'toUser'
]
=
$request
->
user
->
email
;
// 收件人
$cc_send_mail_array
=
Config
(
'config.cc_email'
);
// 固定抄送人
$cc_send_mail_array
=
Config
(
'config.cc_email'
);
// 固定抄送人
$perm
=
new
PermController
;
$perm
=
new
PermController
;
$kefu_manager_email
=
$perm
->
getManager
(
$request
->
user
->
userId
,
63
);
// 获取当前客服的上级主管邮箱,63-销售经理
$kefu_manager_email
=
$perm
->
getManager
(
$request
->
user
->
userId
,
63
);
// 获取当前客服的上级主管邮箱,63-销售经理
$kefu_manager_email
&&
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$kefu_manager_email
);
// 合并上级主管邮箱
$kefu_manager_email
&&
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$kefu_manager_email
);
// 合并上级主管邮箱
// 获取采购经理
$buyer_ids
=
array_unique
(
array_column
(
$info
[
'order_items_info'
],
'buyer_id'
));
foreach
(
$buyer_ids
as
$v
)
{
$buyer_manager_email
=
$perm
->
getManager
(
$v
,
41
);
// 获取当前采购的上级主管邮箱,41-采购经理
$buyer_manager_email
&&
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$buyer_manager_email
);
}
$cc_send_mail_array
=
array_unique
(
$cc_send_mail_array
);
// 去重
$cc_email_arr
=
[];
$cc_email_arr
=
[];
...
@@ -2150,7 +2127,28 @@ Class OrderController extends Controller
...
@@ -2150,7 +2127,28 @@ Class OrderController extends Controller
}
}
}
}
$data
[
'ccUser'
]
=
array_unique
(
array_merge
(
$cc_send_mail_array
,
$cc_email_arr
));
$cc_send_mail_array
=
array_unique
(
array_merge
(
$cc_send_mail_array
,
$cc_email_arr
));
// 各个采购邮件推入队列
foreach
(
$send_buyers
as
$k
=>
&
$v
)
{
$v
[
'combined'
]
=
0
;
$v
[
'ccUser'
]
=
$cc_send_mail_array
;
foreach
(
$v
[
'data'
]
as
$item
)
{
$v
[
'combined'
]
+=
$item
[
'totalPrice'
];
}
// 若不属于自营采购部,则添加联营采购管理人员
if
(
!
$perm
->
checkUserDepartment
(
$k
,
51
))
{
$joint_purchase_manager
=
Config
(
'config.joint_purchase_manager'
);
$v
[
'ccUser'
]
=
array_merge
(
$cc_send_mail_array
,
$joint_purchase_manager
);
}
$this
->
pushQueue
(
$v
);
}
$data
[
'toUser'
]
=
$request
->
user
->
email
;
// 收件人
$data
[
'ccUser'
]
=
$cc_send_mail_array
;
$data
[
'combined'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'combined'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'order_amount'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'order_amount'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'date'
]
=
date
(
'Y-m-d'
,
time
());
$data
[
'date'
]
=
date
(
'Y-m-d'
,
time
());
...
...
app/Http/Controllers/PermController.php
View file @
e7b57553
...
@@ -518,5 +518,15 @@
...
@@ -518,5 +518,15 @@
return
$user
;
return
$user
;
}
}
// 检查用户是否属于某部门
public
function
checkUserDepartment
(
$userId
,
$department_id
)
{
$map
=
[];
$map
[
'userId'
]
=
$userId
;
$map
[
'department_id'
]
=
$department_id
;
return
DB
::
table
(
'user_info'
)
->
where
(
$map
)
->
select
(
'userId'
)
->
first
();
}
}
}
\ No newline at end of file
config/config.php
View file @
e7b57553
...
@@ -23,4 +23,9 @@ return [
...
@@ -23,4 +23,9 @@ return [
// 'zoe@ichunt.com',
// 'zoe@ichunt.com',
],
],
// 联营采购负责人
'joint_purchase_manager'
=>
[
'zty@ichunt.com'
,
],
];
];
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