shish il y a 6 ans
Parent
commit
677ae42a8c

+ 5 - 5
app/business/controllers/TestController.php

@@ -11,7 +11,7 @@ use common\components\util;
 class TestController extends BaseController
 {
 	
-	public $withoutLogin = ['inform','notice'];
+	public $withoutLogin = ['inform', 'notice'];
 	
 	//添加订单
 	public function actionAddOrder()
@@ -22,13 +22,13 @@ class TestController extends BaseController
 		require_once $dada . 'client/dadaResponse.php';
 		require_once $dada . 'config/config.php';
 		require_once $dada . 'model/orderModel.php';
-
+		
 		// isOnline 判断是否是测试环境,会有不同的域名等
 		$isOnline = false;
 		$sourceId = 1000000;
 		// 初始化一个config
 		$config = new \Config($sourceId, $isOnline);
-
+		
 		$orderModel = new \OrderModel();
 		$orderModel->setShopNo('11047059');
 		$orderModel->setOriginId('2018091100000002');
@@ -91,7 +91,7 @@ class TestController extends BaseController
 	//宝贝售出提醒 shish 2020.1.30
 	public function actionInform()
 	{
-		InformAdminService::addInform(12362, 'income', []);
+		InformAdminService::addInform(12362, 'send', []);
 	}
 
 	public function actionNotice()
@@ -103,5 +103,5 @@ class TestController extends BaseController
 		$msg = serialize($data);
 		$r = $producer->publish($msg, 'exInform', 'routeInform');
 	}
-
+	
 }

+ 27 - 0
biz/message/classes/InformAdminClass.php

@@ -22,6 +22,9 @@ class InformAdminClass extends BaseClass
 				//收入提醒
 				$respond = self::incomeInform($params, $admin, $TMList);
 				break;
+			case 'send':
+				$respond = self::sendInform($params, $admin, $TMList);
+				break;
 			default:
 		}
 		$data = ['messageType' => 'inform', 'informWay' => 'wx', 'userType' => 'admin', 'id' => 6, 'mobile' => '15280215347'];
@@ -34,6 +37,30 @@ class InformAdminClass extends BaseClass
 		var_dump($r);
 	}
 	
+	//送到通知 shish 2020.1.31
+	public static function sendInform($params, $admin, $TMList)
+	{
+		$totalFee = 199;
+		$userName = '石头';
+		$data['briefContent'] = "客户" . $userName . "付款" . $totalFee . '元';
+		$openId = $admin['openId'];
+		$shortTempId = 'OPENTM201205968';
+		$tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
+		$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"]]
+		];
+		$data['tMessage'] = json_encode($tMessage);
+		$msg = "客户" . $userName . "付款" . $totalFee . '元';
+		$data['content'] = $msg;
+		return $data;
+	}
+
 	public static function incomeInform($params, $admin, $TMList)
 	{
 		$totalFee = 199;