This commit is contained in:
2024-05-07 14:38:47 +08:00
parent 76bf8cc2fc
commit de4f58d3e3
+16 -2
View File
@@ -63,18 +63,32 @@ class SecCheck extends SmallProgram
} }
const SCENE_INFO = 1;
const SCENE_REPLY = 2;
const SCENE_DISCAZ = 3;
const SCENE_SHEJIAO = 4;
/** /**
* @param string $content * @param string $content
* @param int $scene
* @param string $openId
* @return Result * @return Result
*/ */
public function text(string $content): Result public function text(string $content, int $scene, string $openId): Result
{ {
if (empty($content)) { if (empty($content)) {
return $this->sendError('文件不存在', 404); return $this->sendError('文件不存在', 404);
} }
$requestUrl = $this->_msgUrl . $this->payConfig->getAccessToken(); $requestUrl = $this->_msgUrl . $this->payConfig->getAccessToken();
return $this->post('api.weixin.qq.com', $requestUrl, ['content' => $content]); return $this->post('api.weixin.qq.com', $requestUrl, json_encode([
'content' => $content,
'version' => 2,
'scene' => $scene,
'openid' => $openId
], JSON_UNESCAPED_UNICODE),'application/json');
} }
} }