|
|
@@ -18,6 +18,14 @@ class InformAdminClass extends BaseClass
|
|
|
//增加通知员工 shish
|
|
|
public static function addInform($params, $admin, $type, $TMList)
|
|
|
{
|
|
|
+ //没有关注公众号暂时不进行通知
|
|
|
+ if (isset($admin['subscribe']) == false && $admin['subscribe'] == 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //没有小程序id暂时不进行通知,目前只有小程序商家版,没有h5
|
|
|
+ if (isset($admin['miniOpenId']) == false || empty($admin['miniOpenId'])) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
switch ($type) {
|
|
|
case 'goodsSold':
|
|
|
//宝贝售出
|
|
|
@@ -32,12 +40,13 @@ class InformAdminClass extends BaseClass
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
|
- $data = ['messageType' => 'inform', 'informWay' => 'wx', 'userType' => 'admin', 'id' => 6, 'mobile' => '15280215347'];
|
|
|
+ $data = ['messageType' => 'inform', 'informWay' => 'miniProgram', 'userType' => 'admin', 'id' => 6, 'mobile' => '15280215347'];
|
|
|
$data = array_merge($data, $respond);
|
|
|
$producer = Yii::$app->rabbitmq->getProducer('informProducer');
|
|
|
$msg = serialize($data);
|
|
|
Yii::info('消息通知:' . $msg);
|
|
|
$producer->publish($msg, 'informExchange', 'informRoute');
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//送到通知 shish 2020.1.31
|
|
|
@@ -46,17 +55,21 @@ class InformAdminClass extends BaseClass
|
|
|
$totalFee = 199;
|
|
|
$userName = '石头';
|
|
|
$data['briefContent'] = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
- $openId = $admin['openId'];
|
|
|
+ $openId = isset($admin['openId']) && !empty($admin['openId']) ? $admin['openId'] : '';
|
|
|
+ $miniOpenId = isset($admin['miniOpenId']) && !empty($admin['miniOpenId']) ? $admin['miniOpenId'] : '';
|
|
|
$shortTempId = 'OPENTM201205968';
|
|
|
$tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
|
|
|
- $tMessage = ["touser" => $openId, "template_id" => $tempId,
|
|
|
+ $tMessage = [
|
|
|
+ "touser" => $openId,
|
|
|
+ "template_id" => $tempId,
|
|
|
"url" => Yii::$app->params['frontUrl'] . "/center/order-detail?id=1225&account=12362",
|
|
|
"data" => [
|
|
|
"first" => ["value" => '您的订单已送达', "color" => "#173177"],
|
|
|
"keyword1" => ["value" => (string)1525, "color" => "#173177"],
|
|
|
"keyword2" => ["value" => '石头', "color" => "#173177"],
|
|
|
"keyword3" => ["value" => '已送达', "color" => "#173177"],
|
|
|
- "remark" => ["value" => '感谢您惠顾,祝你生活愉快!', "color" => "#173177"]]
|
|
|
+ "remark" => ["value" => '感谢您惠顾,祝你生活愉快!', "color" => "#173177"]
|
|
|
+ ]
|
|
|
];
|
|
|
$data['tMessage'] = json_encode($tMessage);
|
|
|
$msg = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
@@ -68,33 +81,45 @@ class InformAdminClass extends BaseClass
|
|
|
{
|
|
|
$totalFee = 199;
|
|
|
$orderSn = '2051229823132466';
|
|
|
+ $orderId = $params['orderId'];
|
|
|
$orderName = '商品';
|
|
|
$userName = '石头';
|
|
|
$data['briefContent'] = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
//收入提醒
|
|
|
- $openId = $admin['openId'];
|
|
|
+ $openId = isset($admin['openId']) && !empty($admin['openId']) ? $admin['openId'] : '';
|
|
|
+ $miniOpenId = isset($admin['miniOpenId']) && !empty($admin['miniOpenId']) ? $admin['miniOpenId'] : '';
|
|
|
$shortTempId = 'OPENTM207422813';
|
|
|
$tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
|
|
|
- $tMessage = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderSn, "data" => [
|
|
|
- "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
|
|
|
- "keyword1" => ["value" => (string)$orderSn, "color" => "#173177"],
|
|
|
- "keyword2" => ["value" => $orderName, "color" => "#173177"],
|
|
|
- "keyword3" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
|
|
|
- "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
|
|
|
- "keyword5" => ["value" => $userName, "color" => "#173177"],
|
|
|
- "remark" => ["value" => '点此查看详细、编辑收花人信息。', "color" => "#173177"]]];
|
|
|
+ $tMessage = [
|
|
|
+ "touser" => $openId,
|
|
|
+ "template_id" => $tempId,
|
|
|
+ "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderSn,
|
|
|
+ "data" => [
|
|
|
+ "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
|
|
|
+ "keyword1" => ["value" => (string)$orderSn, "color" => "#173177"],
|
|
|
+ "keyword2" => ["value" => $orderName, "color" => "#173177"],
|
|
|
+ "keyword3" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
|
|
|
+ "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
|
|
|
+ "keyword5" => ["value" => $userName, "color" => "#173177"],
|
|
|
+ "remark" => ["value" => '点此查看详细、编辑收花人信息。', "color" => "#173177"]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ if (!empty($miniOpenId)) {
|
|
|
+ $tMessage['miniprogram']['appid'] = $params['miniAppId'];
|
|
|
+ $tMessage['miniprogram']['pagepath'] = 'admin/order/detail?id=' . $orderId;
|
|
|
+ }
|
|
|
$data['tMessage'] = json_encode($tMessage);
|
|
|
$msg = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
$data['content'] = $msg;
|
|
|
return $data;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//添加通知内容 shish 2020.1.8
|
|
|
public static function addData($data)
|
|
|
{
|
|
|
self::add($data);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//订单完成通知店长 shish 2020.3.19
|
|
|
public static function sendComplete($order, $merchant)
|
|
|
{
|
|
|
@@ -110,38 +135,41 @@ class InformAdminClass extends BaseClass
|
|
|
$remindUserIds[] = $admin['userId'];
|
|
|
}
|
|
|
}
|
|
|
- if(empty($remindUserIds)){
|
|
|
+ if (empty($remindUserIds)) {
|
|
|
return false;
|
|
|
}
|
|
|
$remindUserIds = array_filter(array_unique($remindUserIds));
|
|
|
if (empty($remindUserIds)) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
- $userList = UserClass::getByIds($remindUserIds);
|
|
|
|
|
|
- $allTM = xhTMessageService::getList($merchantId);
|
|
|
- $shortTempId = 'OPENTM201205968';//订单送达通知
|
|
|
- $tempId = $allTM[$shortTempId];
|
|
|
-
|
|
|
- foreach ($userList as $user) {
|
|
|
- if (isset($user['subscribe']) && $user['subscribe'] == 1) {
|
|
|
- $openId = $user['openId'];
|
|
|
- $url = Yii::$app->params['shopDomain'] . "/#/admin/order/detail?id=" . $order['id'];
|
|
|
- $url = httpUtil::becomeHttps($url);
|
|
|
- $data = [
|
|
|
- "touser" => $openId,
|
|
|
- "template_id" => $tempId,
|
|
|
- "url" => $url,
|
|
|
- "data" => [
|
|
|
- "first" => ["value" => '客户订单已送达', "color" => "#173177"],
|
|
|
- "keyword1" => ["value" => (string)$order['orderSn'], "color" => "#173177"],
|
|
|
- "keyword2" => ["value" => $order['bookName'], "color" => "#173177"],
|
|
|
- "keyword3" => ["value" => '已送达', "color" => "#173177"],
|
|
|
- "remark" => ["value" => '', "color" => "#173177"]]];
|
|
|
- wxUtil::sendTaskInform($data, $merchant);
|
|
|
- }
|
|
|
- }
|
|
|
+// $userList = UserClass::getByIds($remindUserIds);
|
|
|
+//
|
|
|
+// $allTM = xhTMessageService::getList($merchantId);
|
|
|
+// $shortTempId = 'OPENTM201205968';//订单送达通知
|
|
|
+// $tempId = $allTM[$shortTempId];
|
|
|
+//
|
|
|
+// foreach ($userList as $user) {
|
|
|
+// if (isset($user['subscribe']) && $user['subscribe'] == 1) {
|
|
|
+// $openId = $user['openId'];
|
|
|
+// $url = Yii::$app->params['shopDomain'] . "/#/admin/order/detail?id=" . $order['id'];
|
|
|
+// $url = httpUtil::becomeHttps($url);
|
|
|
+// $data = [
|
|
|
+// "touser" => $openId,
|
|
|
+// "template_id" => $tempId,
|
|
|
+// "url" => $url,
|
|
|
+// "data" => [
|
|
|
+// "first" => ["value" => '客户订单已送达', "color" => "#173177"],
|
|
|
+// "keyword1" => ["value" => (string)$order['orderSn'], "color" => "#173177"],
|
|
|
+// "keyword2" => ["value" => $order['bookName'], "color" => "#173177"],
|
|
|
+// "keyword3" => ["value" => '已送达', "color" => "#173177"],
|
|
|
+// "remark" => ["value" => '', "color" => "#173177"]
|
|
|
+// ]
|
|
|
+// ];
|
|
|
+// wxUtil::sendTaskInform($data, $merchant);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|