'letter', 'name' => '站内信'], ['id' => 'sms', 'name' => '短信'], ['id' => 'wechat_service', 'name' => '微信公众号模板消息'], ['id' => 'wechat_applet', 'name' => '微信小程序订阅消息'], //['id' => 'app', 'name' => 'APP推送'], //['id' => 'email', 'name' => '邮箱'], ]; return $value; } # 发送消息 public function send($template, $account = [], $param = [], $project = 'api') { $template = Dever::db('template', 'msg')->find(['key' => $template, 'status' => 1]); if (!$template) { Dever::error('消息模板不存在'); } if ($template['type'] == 1) { $method = 'notify'; } elseif ($template['type'] == 2) { $method = 'code'; } $template['method'] = explode(',', $template['method']); return Dever::load('type/' . $method, 'msg')->send($template, $account, $param, $project); } # 验证码检查 public function check($template, $account, $code, $update = 1) { $template = Dever::db('template', 'msg')->find(['key' => $template, 'status' => 1]); if (!$template) { Dever::error('消息模板不存在'); } if ($template['type'] == 2) { $state = Dever::load('type/code', 'msg')->check($template['id'], $account, $code, $update); if (!$state) { Dever::error('验证码错误'); } } } }