|
|
@@ -11,38 +11,51 @@ class InformAdminClass extends BaseClass
|
|
|
public static $baseFile = '\biz\message\models\InformAdmin';
|
|
|
|
|
|
//宝贝售出通知 shish 2019.12.24
|
|
|
- public static function goodsSoldInformAdmin($params, $informWay = 0, $TMList = [])
|
|
|
+ public static function goodsSoldInformAdmin($params, $admin, $TMList)
|
|
|
{
|
|
|
- $params = [];
|
|
|
+ $informWay = isset($admin['openId']) && !empty($admin['openId']) && isset($admin['subscribe']) && $admin['subscribe'] == 1 ? 'wx' : 'sms';
|
|
|
+ $totalFee = 199;
|
|
|
+ $orderSn = '2051229823132466';
|
|
|
+ $orderName = '商品';
|
|
|
+ $userName = '石头';
|
|
|
+ $data = ['tMessage' => '', 'content' => '', 'briefContent' => ''];
|
|
|
+ $data['briefContent'] = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
if ($informWay == 'wx') {
|
|
|
//收入提醒
|
|
|
+ $openId = $admin['openId'];
|
|
|
$shortTempId = 'OPENTM207422813';
|
|
|
$tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
|
|
|
- $tmData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
|
|
|
+ $tMessage = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderSn, "data" => [
|
|
|
"first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
|
|
|
- "keyword1" => ["value" => (string)$orderId, "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"]]];
|
|
|
- return $tmData;
|
|
|
+ $data['tMessage'] = json_encode($tMessage);
|
|
|
}
|
|
|
if ($informWay == 'sms') {
|
|
|
- return "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
+ $msg = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
+ $data['content'] = $msg;
|
|
|
}
|
|
|
+ return $data;
|
|
|
}
|
|
|
-
|
|
|
- //宝贝售出通知 shish 2019.12.24
|
|
|
- public static function inform($params, $type, $informWay = 0, $TMList = [])
|
|
|
+
|
|
|
+ //通知员工 shish
|
|
|
+ public static function addInform($params, $admin, $type, $TMList)
|
|
|
{
|
|
|
switch ($type) {
|
|
|
- case 'goodsSoldInformAdmin':
|
|
|
- $respond = self::goodsSoldInformAdmin($params, $informWay, $TMList);
|
|
|
+ case 'goodsSold':
|
|
|
+ $respond = self::goodsSoldInformAdmin($params, $admin, $TMList);
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
|
- return $respond;
|
|
|
+ $data = ['messageType' => 'inform', 'informWay' => 'wx', 'userType' => 'admin', 'id' => 1, 'mobile' => '15280215347'];
|
|
|
+ $data = array_merge($data, $respond);
|
|
|
+ $producer = Yii::$app->rabbitmq->getProducer('producerInform');
|
|
|
+ $msg = serialize($data);
|
|
|
+ $producer->publish($msg, 'exInform', 'routeInform');die;
|
|
|
}
|
|
|
|
|
|
//门店收入提醒 shish 2019.12.24
|
|
|
@@ -60,7 +73,7 @@ class InformAdminClass extends BaseClass
|
|
|
$openId = $admin['openId'];
|
|
|
if (!empty($openId) && $admin['subscribe'] == 1) {
|
|
|
$data = ["touser" => $openId, "template_id" => $tempId,
|
|
|
- "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
|
|
|
+ "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderSn, "data" => [
|
|
|
"first" => ["value" => $userName . $payWay . '付款', "color" => "#173177"],
|
|
|
"keyword1" => ["value" => $totalFee . '元', "color" => "#173177"],
|
|
|
"keyword2" => ["value" => '客户付款', "color" => "#173177"],
|
|
|
@@ -79,7 +92,6 @@ class InformAdminClass extends BaseClass
|
|
|
//宝贝售出通知 shish 2019.12.24
|
|
|
public static function goodsSoldInformAdmin2($merchantId)
|
|
|
{
|
|
|
-
|
|
|
$TMList = xhTMessageService::getList($merchantId);
|
|
|
$merchant = MerchantService::getById($merchantId);
|
|
|
$shortTempId = 'OPENTM207422813';//收入提醒
|
|
|
@@ -87,9 +99,9 @@ class InformAdminClass extends BaseClass
|
|
|
foreach ($adminList as $adminKey => $admin) {
|
|
|
$openId = $admin['openId'];
|
|
|
if (!empty($openId) && $admin['subscribe'] == 1) {
|
|
|
- $sendData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
|
|
|
+ $sendData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderSn, "data" => [
|
|
|
"first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
|
|
|
- "keyword1" => ["value" => (string)$orderId, "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"],
|