dever 7 년 전
부모
커밋
5507aeb007
2개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 0
      applet/database/msg_form.php
  2. 3 3
      applet/src/Msg.php

+ 2 - 0
applet/database/msg_form.php

@@ -29,6 +29,7 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '请输入项目',
 			'match' 	=> 'is_numeric',
+			'list'		=> true,
 		),
 
 		'openid'		=> array
@@ -89,6 +90,7 @@ return array
 			# 匹配的正则或函数 选填项
 			'option' => array
 			(
+				'project_id' => 'yes',
 				'openid' => 'yes',
 				'cdate' => array($time, '<='),
 				'state' => 1,

+ 3 - 3
applet/src/Msg.php

@@ -71,7 +71,7 @@ class Msg
 				$update['emphasis_keyword'] = $emphasis_keyword;
 
 				if (!$update['form_id']) {
-					$update['form_id'] = $this->getFormId($update['touser']);
+					$update['form_id'] = $this->getFormId($info['project_id'], $update['touser']);
 				}
 
 				$where = array();
@@ -128,10 +128,10 @@ class Msg
 		}
 	}
 
-	public function getFormId($openid)
+	public function getFormId($project_id, $openid)
 	{
 		# 获取一个form_id,取最新的100条,然后随机取
-		$info = Dever::db('applet/msg_form')->getAll(array('option_openid' => $openid));
+		$info = Dever::db('applet/msg_form')->getAll(array('option_openid' => $openid, 'option_project_id' => $project_id));
 		if ($info) {
 			$key = array_rand($info, 1);
 			$info = $info[$key];