123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace app\api\utils;
- use app\common\library\AliyunSms;
- use think\facade\Config;
- /**
- * 后台控制器基类
- * 接口方法权限 必传参数 接口返回 错误抛出 通用参数处理
- */
- class MsgUtils {
- private static function sendSms($phone, $sign, $templateCode, $parmasObj) {
- [
- 'accessKeyId' => $accessKeyId,
- 'accessKeySecret' => $accessKeySecret,
- 'product' => $product,
- 'domain' => $domain,
- 'region' => $region,
- 'endPointName' => $endPointName
- ] = Config::get('msg_options');
- AliyunSms::sendSms($phone, $sign, $templateCode, $parmasObj, $accessKeyId, $accessKeySecret, $product, $domain, $region, $endPointName);
- }
- /*
- * 向上级医师发送[远程诊断申请]短信
- * 亲爱的${name}医生您好!收到新的${type},请您及时于${time}前登录系统处理
- * @param {string} phone 手机号码
- * @param {string} time 时间
- * @param {string} name 姓名(姓)
- */
- public static function sendSms2Apply($phone, $time = '', $name = '') {
- [
- 'sign' => $sign,
- 'templateCode' => $arrayCode
- ] = Config::get('msg_options');
- $templateCode = $arrayCode['apply'];
- return self::sendSms($phone, $sign, $templateCode, array("time" => $time,"name" => $name));
- }
- /*
- * 向下级医师发送[远程诊断申请被驳回]短信
- * 很抱歉,您发起的远程诊断申请被驳回,请您及时处理后重新发起申请。驳回原因:${description}
- * @param {string} description 驳回理由
- */
- public static function sendSms2RejectApply($phone, $description = '') {
- [
- 'sign' => $sign,
- 'templateCode' => $arrayCode
- ] = Config::get('msg_options');
- $templateCode = $arrayCode['rejectApply'];
- return self::sendSms($phone, $sign, $templateCode, array("description" => $description));
- }
- /*
- * 向下级医院发送[远程诊断报告已经被写完]短信
- * 您发起的远程诊断申请已由${doctor}医师完成,请您登录系统查看
- * @param {string} doctor 医生
- */
- public static function sendSms2CompleteReport($phone, $doctor = '') {
- [
- 'sign' => $sign,
- 'templateCode' => $arrayCode
- ] = Config::get('msg_options');
- $templateCode = $arrayCode['completeReport'];
- return self::sendSms($phone, $sign, $templateCode, array("doctor" => $doctor));
- }
- /*
- * 发送[内部通知]短信
- * 通知: 类型:${type} 内容:${content}
- * @param {string} type 通知类型
- * @param {string} content 通知内容
- */
- public static function sendSms2Self($phone,$type = '', $content = '') {
- [
- 'sign' => $sign,
- 'templateCode' => $arrayCode
- ] = Config::get('msg_options');
- $templateCode = $arrayCode['self'];
- return self::sendSms($phone, $sign, $templateCode, array("t" => $type, "c" => $content));
- }
- }
|