Commit 7d6907d7 by 朱继来

调整采购邮件

parent b056ade5
...@@ -2093,6 +2093,8 @@ Class OrderController extends Controller ...@@ -2093,6 +2093,8 @@ Class OrderController extends Controller
$CmsModel = new CmsModel(); $CmsModel = new CmsModel();
$sale_name = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员 $sale_name = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员
$to_user_array = [];
//循环订单详情 //循环订单详情
foreach ($info['order_items_info'] as $key => $value) { foreach ($info['order_items_info'] as $key => $value) {
if ($value['status'] == -1) continue; if ($value['status'] == -1) continue;
...@@ -2121,11 +2123,10 @@ Class OrderController extends Controller ...@@ -2121,11 +2123,10 @@ Class OrderController extends Controller
$send_buyers[$value['buyer_id']]['date'] = intval($id); $send_buyers[$value['buyer_id']]['date'] = intval($id);
$send_buyers[$value['buyer_id']]['id'] = $sale_name; $send_buyers[$value['buyer_id']]['id'] = $sale_name;
$send_buyers[$value['buyer_id']]['ccUser'] = []; $to_user_array[] = $value['send_email'];
$tmp['projectId'] = $key+1; // $tmp['projectId'] = $key+1;
$data['data'][] = $tmp; // $data['data'][] = $tmp;
} }
$cc_send_mail_array = Config('config.cc_email'); // 固定抄送人 $cc_send_mail_array = Config('config.cc_email'); // 固定抄送人
...@@ -2150,7 +2151,6 @@ Class OrderController extends Controller ...@@ -2150,7 +2151,6 @@ Class OrderController extends Controller
// 各个采购邮件推入队列 // 各个采购邮件推入队列
foreach ($send_buyers as $k => &$v) { foreach ($send_buyers as $k => &$v) {
$v['combined'] = 0; $v['combined'] = 0;
$v['ccUser'] = $cc_send_mail_array;
foreach ($v['data'] as $item) { foreach ($v['data'] as $item) {
$v['combined'] += $item['totalPrice']; $v['combined'] += $item['totalPrice'];
...@@ -2159,27 +2159,45 @@ Class OrderController extends Controller ...@@ -2159,27 +2159,45 @@ Class OrderController extends Controller
// 若不属于自营采购部,则添加联营采购管理人员 // 若不属于自营采购部,则添加联营采购管理人员
if (!$perm->checkUserDepartment($k, 51)) { if (!$perm->checkUserDepartment($k, 51)) {
$joint_purchase_manager = Config('config.joint_purchase_manager'); $joint_purchase_manager = Config('config.joint_purchase_manager');
$v['ccUser'] = array_merge($cc_send_mail_array, $joint_purchase_manager); $cc_send_mail_array = array_merge($cc_send_mail_array, $joint_purchase_manager);
} }
array_push($v['ccUser'], $request->user->email); array_push($cc_send_mail_array, $request->user->email); // 默认抄送给当前客服
$v['ccUser'] = array_unique($v['ccUser']); // 默认抄送给当前客服 $cc_send_mail_array = array_unique($cc_send_mail_array);
$v['ccUser'] = $cc_send_mail_array;
$this->pushQueue($v); $this->pushQueue($v);
} }
$data['toUser'] = $request->user->email; // 收件人 // $data['toUser'] = $request->user->email; // 收件人
$data['ccUser'] = $cc_send_mail_array; // $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());
// $data['kefu_remark'] = $info['order_temp_info']['kefu_remark']; // 客服备注 // $data['id'] = $sale_name;
$data['id'] = $sale_name; // $data['order_id'] = intval($id);
$data['order_id'] = intval($id); // $data['operator_id'] = intval($request->user->userId);
$data['operator_id'] = intval($request->user->userId); // $data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($data['toUser']).',抄送人邮箱:'.json_encode($data['ccUser']);
$data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($data['toUser']).',抄送人邮箱:'.json_encode($data['ccUser']);
// $this->pushQueue($data);
$event = '发送邮件成功,收件人邮箱:'.json_encode($to_user_array).',抄送人邮箱:'.json_encode($cc_send_mail_array);
// 添加操作日志
$OrderActionLogModel = new OrderActionLogModel;
$OrderActionLogModel->addLog($id, $request->user->userId, 2, $event);
// 同步到ERP
$url = Config('website.api_domain').'order/sysiteminfo';
$resData['order_id'] = $id;
$resData['k1'] = time();
$resData['k2'] = md5(md5($resData['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $resData, "POST"), true); // 连接API
$this->pushQueue($data); if ($temp['err_code'] != 0) return ['errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']];
return ['errcode'=>0, 'errmsg'=>'推送到邮件队列成功,请稍等...']; return ['errcode'=>0, 'errmsg'=>'推送到邮件队列成功,请稍等...'];
} }
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
<td> <td>
<!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> --> <!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> -->
<?php if (in_array($order_info['status'], [1, 2, 3]) && $v['status'] == 1) { ?> <?php if (in_array($order_info['status'], [1, 2, 3, 4]) && $v['status'] == 1) { ?>
<button type="button" class="btn btn-success btn-xs edit-item" data-id="<?= $v['rec_id'] ?>" data-batch="<?= $v['batch'] ?>" data-bid="<?= $v['buyer_id'] ?>" data-remarks="<?= $v['remarks'] ?>">编辑</button> <button type="button" class="btn btn-success btn-xs edit-item" data-id="<?= $v['rec_id'] ?>" data-batch="<?= $v['batch'] ?>" data-bid="<?= $v['buyer_id'] ?>" data-remarks="<?= $v['remarks'] ?>">编辑</button>
<?php } ?> <?php } ?>
</td> </td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment