Browse Source

消息通知

shish 6 năm trước cách đây
mục cha
commit
cfe03e6b55

+ 8 - 3
biz/message/classes/InformAdminClass.php

@@ -55,7 +55,7 @@ class InformAdminClass extends BaseClass
 		$data = array_merge($data, $respond);
 		$producer = Yii::$app->rabbitmq->getProducer('producerInform');
 		$msg = serialize($data);
-		$producer->publish($msg, 'exInform', 'routeInform');die;
+		$producer->publish($msg, 'exInform', 'routeInform');
 	}
 	
 	//门店收入提醒 shish 2019.12.24
@@ -116,6 +116,11 @@ class InformAdminClass extends BaseClass
 			}
 		}
 	}
-	
-	
+
+	//添加通知内容 shish 2020.1.8
+	public static function addData($data)
+	{
+		self::add($data);
+	}
+
 }

+ 31 - 3
biz/message/services/InformAdminService.php

@@ -32,7 +32,7 @@ class InformAdminService extends BaseService
 			InformAdminClass::addInform($params, $admin, $type, $TMList);
 		}
 	}
-
+	
 	//消费通知队列 shish 2020.1.1
 	public static function consumeInformQueue($data)
 	{
@@ -43,17 +43,45 @@ class InformAdminService extends BaseService
 		$merchantId = $admin['merchantId'];
 		$mobile = $data['mobile'];
 		$merchant = MerchantService::getMerchantById($merchantId);
+		$hasSend = false;
+		$noticeWay = 0;
 		if ($informWay == 'wx') {
 			$tMessage = json_decode($data['tMessage'], true);
 			weixinUtil::sendTaskInform($tMessage, $merchant);
 			Yii::info('tm:' . json_encode($respond));
+			$hasSend = true;
+			$noticeWay = 0;
 		}
 		if ($informWay == 'sms') {
 			$msg = $data['content'];
 			sms::merchantSend($mobile, $msg, $merchant);
+			$hasSend = true;
+			$noticeWay = 1;
 		}
+		
 		//存入数据库
-		//InformAdminService::addData();
+		if ($hasSend) {
+			$informData = [
+				'userId' => $admin['userId'],
+				'adminId' => $id,
+				'merchantId' => $merchantId,
+				'noticeType' => 0,
+				'content' => $data['briefContent'],
+				'noticeWay' => $noticeWay,
+				'status' => 1,
+				'sourceType' => 0,
+				'sourceId' => 0,
+				'addTime' => time(),
+				'createTime' => date("Y-m-d H:i:s"),
+			];
+			InformAdminService::addData($informData);
+		}
 	}
-
+	
+	//添加记录 shish 2020.1.8
+	public static function addData($data)
+	{
+		return InformAdminClass::addData($data);
+	}
+	
 }