Open xugames opened 2 years ago
近日使用网易云信通知短信,报错,经检查无云信通知模板短信格式 做一下修改 `switch ($action) { case 'sendCode': $params = $this->buildSendCodeParams($to, $message, $config);
break; case 'sendTemplate': $params = $this->buildSendMsgParams($to, $message, $config); break; case 'verifyCode': $params = $this->buildVerifyCodeParams($to, $message); break; default:`
新增sendTemplate 以及参数格式函数buildSendMsgParams `public function buildSendMsgParams(PhoneNumberInterface $to, MessageInterface $message, Config $config) {
$data = $message->getData($this); $template = $message->getTemplate($this); if (!array_key_exists('params', $data)) { throw new GatewayErrorException('"params" cannot be empty', 0); } return [ 'mobiles' => json_encode([$to->getUniversalNumber()]), 'templateid' => is_string($template) ? $template : '', 'params'=>array_key_exists('params', $data) ? $data['params'] : '', 'needUp' => $config->get('need_up', false), ]; }`
使用方法 $massage=[ 'template' => 'xxxx', 'data' => [ 'params' =>json_encode([$params]), 'action' => 'sendTemplate', ], ];
$massage=[ 'template' => 'xxxx', 'data' => [ 'params' =>json_encode([$params]), 'action' => 'sendTemplate', ], ];
欢迎 PR
近日使用网易云信通知短信,报错,经检查无云信通知模板短信格式 做一下修改 `switch ($action) { case 'sendCode': $params = $this->buildSendCodeParams($to, $message, $config);
新增sendTemplate 以及参数格式函数buildSendMsgParams `public function buildSendMsgParams(PhoneNumberInterface $to, MessageInterface $message, Config $config) {
使用方法
$massage=[ 'template' => 'xxxx', 'data' => [ 'params' =>json_encode([$params]), 'action' => 'sendTemplate', ], ];