Browse Source

订单通知

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

+ 2 - 3
biz/admin/classes/AdminClass.php

@@ -181,14 +181,13 @@ class AdminClass extends BaseClass
 		self::updateById($id, $data);
 	}
 	
-	//取商家需要收款通知的全部员工 shish 2019.12.24
-	public static function getAllNoticeAdmin($merchantId)
+	//取收款通知的全部员工 shish 2019.12.24
+	public static function getRemindAdmin($merchantId)
 	{
 		$list = self::getAllByCondition(['merchantId' => $merchantId, 'delStatus' => 0, 'status' => 1, 'remind' => 1], null, '*');
 		if (empty($list)) {
 			return [];
 		}
-		//需要收款通知的需要拿到是否关注公众号
 		$list = self::groupAdminBaseInfo($list);
 		return $list;
 	}

+ 3 - 3
biz/admin/services/AdminService.php

@@ -96,10 +96,10 @@ class AdminService extends BaseService
         AdminClass::getAllAdmin($merchantId, $notice);
     }
 
-    //取商家需要收款通知的全部员工 shish 2019.12.24
-    public static function getAllNoticeAdmin($merchantId)
+    //取收款通知的全部员工 shish 2019.12.24
+    public static function getRemindAdmin($merchantId)
     {
-        return AdminClass::getAllNoticeAdmin($merchantId);
+        return AdminClass::getRemindAdmin($merchantId);
     }
 
     //添加员工

+ 31 - 50
biz/message/classes/InformAdminClass.php

@@ -15,11 +15,6 @@ class InformAdminClass extends BaseClass
 	
 	public static $baseFile = '\biz\message\models\InformAdmin';
 	
-	public static function goodsSoldInform($params, $adminShop, $TMList)
-	{
-	
-	}
-	
 	//增加通知员工 shish
 	public static function addInform($params, $adminShop, $type, $TMList)
 	{
@@ -144,57 +139,43 @@ class InformAdminClass extends BaseClass
 	{
 		self::add($data);
 	}
-	
+
 	//订单完成通知店长 shish 2020.3.19
 	public static function sendComplete($order, $merchant)
 	{
 		$merchantId = $merchant['id'];
-		$adminList = AdminClass::getAdminList($merchantId);
-		if (empty($adminList)) {
-			return false;
-		}
-		$remindUserIds = [];
-		foreach ($adminList as $admin) {
-			$remind = $admin['remind'];
-			if ($remind == 1) {
-				$remindUserIds[] = $admin['userId'];
+		$orderId = $order['id'];
+		$adminList = AdminClass::getRemindAdmin($merchantId);
+		$tm = xhTMessageService::getList($merchantId);
+		$shortTempId = 'OPENTM201205968';//订单送达通知
+		$tempId = $tm[$shortTempId];
+		if (!empty($adminList)) {
+			foreach ($adminList as $admin) {
+				if (isset($admin['subscribe']) && $admin['subscribe'] == 1) {
+					$openId = $admin['openId'];
+					$miniOpenId = $admin['miniOpenId'];
+					$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"]
+						]
+					];
+					if (!empty($miniOpenId)) {
+						$data['miniprogram']['appid'] = $merchant['miniAppId'];
+						$data['miniprogram']['pagepath'] = 'admin/order/detail?id=' . $orderId;
+					}
+					wxUtil::sendTaskInform($data, $merchant);
+				}
 			}
 		}
-		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);
-//			}
-//		}
-	
 	}
 	
 }