smsKey === null){ throw new InvalidConfigException("smsKey 是必要参数"); }elseif($this->smsSecret === null){ throw new InvalidConfigException("smsSecret 是必要参数"); }elseif($this->smsSignName === null){ throw new InvalidConfigException("smsSignName 是必要参数"); } require(SMS_ROOT.'aliyun/TopSdk.php'); $this->aliSms = new \TopClient; $this->aliSms->appkey = $this->smsKey; $this->aliSms->secretKey = $this->smsSecret; $this->req = new \AlibabaAliqinFcSmsNumSendRequest; $this->req->setSmsFreeSignName($this->smsSignName); } /** * 手机验证码 * 模版内容: ${code}(手机验证码,有效期5分钟) * 申请说明: 验证手机是否有效 * @param $phone * @param $code * @param $signName * @return mixed */ public function sendRegCode($phone, $code, $signName = '') { // 设置短信签名 if (!empty($signName)) { $this->req->setSmsFreeSignName($signName); } $this->req->setSmsType("normal"); $this->req->setSmsParam("{\"code\":\"".$code."\"}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_62690160"); $result = $this->aliSms->execute($this->req); return $result; } /** * 绑定手机号成功, 推送极办公业务介绍短信(已作废) * 模版内容: 办公设备极速报修平台。 新用户享50元优惠券!修完抢最高50元红包。提供打印机、复印机、电脑维修服务!-回复T退订 * 申请说明: 给用户发送认证成功后消息 * @param $phone * @return mixed */ public function sendBindPhoneSuccessMsg($phone) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_131430002"); $result = $this->aliSms->execute($this->req); return $result; } /** * 补发首单有礼优惠券短信(已废弃) * 模版内容: 打印机、复印机维修,换耗材,“极办公”给您派新年利是!100元优惠券,首次报修可全额抵扣,请到#极办公小程序#个人中心查看。-回复T退订 * 申请说明: 回馈极办公老客户,派发维修费代金券 * @param $phone * @return mixed */ public function reSendBindPhoneCouponMsg($phone) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_118725110"); $result = $this->aliSms->execute($this->req); return $result; } /** * 发送订单质保申请通知 * 模版内容: 收到客户质保申请,请${contactHour}小时内致电客户,${finishHour}小时内处理完毕。逾期未处理账号将无法接单。若故障未解决,可能会扣除您该笔订单的维修费用。 * 申请说明: 当有用户维修订单出现质保问题时发送给工程师,提醒工程师及时处理质保问题 * @param $phone 手机号 * @param $contactHour 多少小时内联系客户 * @param $finishHour 多少小时内处理完毕 * @return mixed */ public function sendWarrantyApplyMsg($phone, $contactHour, $finishHour) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{contactHour:" . $contactHour . ", finishHour:" . $finishHour . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_150170068"); // SMS_147200443 $result = $this->aliSms->execute($this->req); return $result; } /** * 新订单 * 模版内容: 您收到一个“${device}”的平台订单,马上打开极窝订单宝微信公众号查看吧~ * 申请说明: 用于通知工程师收到新的平台订单 * @param $phone * @return mixed */ public function sendNewOrderMsg($phone, $device) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $params = json_encode(['device' => (string)$device]); $this->req->setSmsParam($params); $this->req->setSmsTemplateCode("SMS_173479889"); $result = $this->aliSms->execute($this->req); return $result; } /** * 系统关闭订单通知 * 模版内容: 您的“${device}”订单暂无工程师接单已经关闭,建议您换个时间再次提交报修。 * 申请说明: 关闭短信,通知用户 * @param $phone * @return mixed */ public function sendCloseOrderMsg($phone, $device, $signName = '') { // 设置短信签名 if (!empty($signName)) { $this->req->setSmsFreeSignName($signName); } $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $params = json_encode(['device' => (string)$device]); $this->req->setSmsParam($params); $this->req->setSmsTemplateCode("SMS_149417787"); // SMS_125810114 $result = $this->aliSms->execute($this->req); return $result; } /** * 设备绑定成功(目前未启用) * 模版内容: 您绑定的用户设备“${device}”已审核通过,马上打开极办公微信公众号查看吧! * 申请说明: 提醒 工程师设备绑定申请已经成功 * @return mixed */ public function sendBindDeviceSuccessMsg($phone,$device) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{\"device\":\"".$device."\"}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_65935276"); $result = $this->aliSms->execute($this->req); return $result; } /** * 设备绑定失败(目前未启用) * 模版内容: 您绑定的用户设备“${device}”审核不通过,请打开极办公微信公众号查看原因! * 申请说明: 设备绑定失败的时候通知工程师 * @param $phone * @return mixed */ public function sendBindDeviceFailMsg($phone,$device) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{\"device\":\"".$device."\"}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_65925271"); $result = $this->aliSms->execute($this->req); return $result; } /** * 技能认证成功通知 * 模版内容: 恭喜您通过“${skill}”技能认证。极办公工程师公众号接单,收入约40元-100元/单,新工程师完成的前10单补贴10元/单。SMS_149422688 * 模版内容: 恭喜您通过“${skill}”技能认证。极办公工程师公众号接单,收入约40元-100元/单 SMS_155570179 * 模版内容: 恭喜您通过“${skill}”技能认证。接下来能接到更多订单了。SMS_173341678 * 申请说明: 工程师技能认证通过推送消息 */ public function sendSkillAuthSuccessMsg($phone, $skill, $freeCommissionCount) { if ($freeCommissionCount > 0) { // 恭喜您通过“${skill}”技能认证。极办公工程师公众号接单,收入约50元-200元/单,前${count}单不抽佣,佣金全额返还。 $param = "{skill:" . $skill . "}"; $templateCode = "SMS_173341678"; } else { // 恭喜您通过“${skill}”技能认证。极办公工程师公众号接单,收入约50元-200元/单。 $param = "{skill:" . $skill . "}"; $templateCode = "SMS_173341678"; } $this->req->setSmsType("normal"); $this->req->setSmsParam($param); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode($templateCode); $result = $this->aliSms->execute($this->req); return $result; } /** * 技能认证考试失败(已废弃) * 模版内容: 您的“${skill}”技能认证审核不通过!请打开极办公微信公众号查看原因! * 申请说明: 工程师技能认证失败通知 */ public function sendSkillAuthFailMsg($phone,$skill) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{\"skill\":\"".$skill."\"}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_66020229"); $result = $this->aliSms->execute($this->req); return $result; } /** * 实名认证成功 * 模版内容: 恭喜您成功通过实名认证!请打开极办公微信公众号继续完成技能认证! * 申请说明: 工程师实名认证成功后通知工程师 * @param $phone * @return mixed */ public function sendUserAuthSuccessMsg($phone) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_66070260"); $result = $this->aliSms->execute($this->req); return $result; } /** * 实名认证失败 * 模版内容: 您的实名认证审核不通过!请打开极办公微信公众号查看原因! * 申请说明: 工程师实名认证失败的时候通知工程师 * @param $phone * @return mixed */ public function sendUserAuthFailMsg($phone) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_66005216"); $result = $this->aliSms->execute($this->req); return $result; } /** * 余额不足提醒(已废弃) * 模版内容: 微信商户平台${appid}余额不足,请及时充值! * 申请说明: 用户提现的时候,发现余额不足,提醒管理员 */ public function sendNoMoneyNotice($phone, $appid) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{\"appid\":\"".$appid."\"}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_76950035"); $result = $this->aliSms->execute($this->req); return $result; } /** * 微信商户号余额不足提醒 * 模版内容: 微信商户号${mch_id}当前余额${balance}元,低于${warning_balance}元,请及时充值! * 申请说明: 用户提现的时候,发现微信商户号余额不足,提醒管理员 */ public function sendNoMoneyWarning($phone, $mchId, $balance, $warningBalance) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{mch_id:" . $mchId . ", balance:" . $balance . ", warning_balance:" . $warningBalance . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_140731639"); $result = $this->aliSms->execute($this->req); return $result; } /** * 发票已经发送提醒 * 模版内容: 您于${date}申请的电子票已发送,您可前往“极办公小程序”个人中心或者登录您的邮箱,查看电子票信息,感谢您的使用! * 申请说明: 用于通知客户已经发送开具的电子票到指定邮箱 */ public function sendInvoiceNotice($phone, $date, $signName = SmsMessage::SIGN_NAME_JIWORK) { $this->req->setSmsFreeSignName($signName); $this->req->setSmsType("normal"); $this->req->setSmsParam("{\"date\":\"".$date."\"}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_149417844"); $result = $this->aliSms->execute($this->req); return $result; } /** * 通过技能实操考核(已废弃) * 模版内容: 恭喜您通过“${skill}”技能的实操考核!请打开极办公工程师微信公众号开始接单吧~ * 申请说明: 通过技能实操考核短信提醒 */ public function sendSkillPracticeSuccessMsg($phone, $skill) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{\"skill\":\"".$skill."\"}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_128455012"); $result = $this->aliSms->execute($this->req); return $result; } /** * 微信支付接口告警 * 模版内容: 微信支付接口告警(${client_name}) 错误描述: ${errorMsg},请及时处理! * 申请说明: 当平台调用微信支付接口返回错误时需及时通知平台管理员。 * 示例:微信支付接口告警(微信小程序) 错误描述:NOTENOUGH=>商户后台余额不足,请及时处理! */ public function sendWechatPayNotice($phone, $clientName, $errorMsg) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{client_name:" . $clientName . ", errorMsg:" . $errorMsg . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_128595001"); $result = $this->aliSms->execute($this->req); return $result; } /** 封号短信(已废弃) * 模版内容: 您的账号因为${reason}被系统封号,如有疑问请联系极办公客服 * 申请说明: 工程师封号 * @param $phone * @param $reason * @return mixed */ public function sendBlockEngineerMsg($phone, $reason) { $this->req->setSmsType("normal"); $this->req->setSmsParam('{"reason":"' . $reason . '"}'); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_135345116"); $result = $this->aliSms->execute($this->req); return $result; } /** 解封短信 * 模版内容: 您的账号已经解封,未来请严格按照平台规则接单。 * 申请说明: 解封工程师账号 * @param $phone * @return mixed */ public function sendUnblockEngineerMsg($phone) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_149417910"); // SMS_135355121 $result = $this->aliSms->execute($this->req); return $result; } /** 【客服】48小时质保申请延期通知 * 模版内容: 收到一条客户质保申请,来自订单号(${orderno}),已超过48小时,请提醒工程师处理。 * 申请说明: 客服订单质保通知 * @param $phone * @param $orderno * @return mixed */ public function sendCustomServiceWarrantyDelayMsg($phone, $orderno) { $this->req->setSmsType("normal"); $this->req->setSmsParam('{"orderno":"' . $orderno . '"}'); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_149422796"); // SMS_147195475 $result = $this->aliSms->execute($this->req); return $result; } /**【客服】工程师频繁质保通知 * 模版内容: 工程师${engineer}一个月内被客户申请质保达到${times}次,已被系统禁用${days}天,请重新安排技能实操考核。 * 申请说明: 工程师服务质量太差,频繁被申请质保通知客服处理 * @param $phone * @param $engineer * @param $times * @param $days * @return mixed */ public function sendCustomServiceFreqWarrantyMsg($phone, $engineer, $times, $days) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{engineer:" . $engineer . ", times:" . $times . ", days:" . $days . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_150180079"); $result = $this->aliSms->execute($this->req); return $result; } /** * 工程师接单成功短信模板 * 模版内容: 您的“${device}”维修订单已经被${engineer}接单,稍后工程师会与您电话联系。为保护客户隐私,我们的来电为虚拟电话。进入“极办公”公众号查看订单进度 * 申请说明: 工程师接单成功短信提醒 */ public function sendPickOrderNotice($phone, $device, $engineer, $signName = '') { // 设置短信签名 if (!empty($signName)) { $this->req->setSmsFreeSignName($signName); } $this->req->setSmsType("normal"); $this->req->setSmsParam("{device:" . $device . ", engineer:" . $engineer . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_178980160"); $result = $this->aliSms->execute($this->req); return $result; } /** * 工程师取消订单短信 * 模版内容: 您的“${device}”维修订单,已被${engineer}取消,取消原因:${reason}。再下个订单吧,让其它工程师为您服务。 * 申请说明: 工程师取消订单短信通知 */ public function sendEngineerCancelOrderNotice($phone, $device, $engineer, $reason, $signName = '') { // 设置短信签名 if (!empty($signName)) { $this->req->setSmsFreeSignName($signName); } $this->req->setSmsType("normal"); $this->req->setSmsParam("{device:" . $device . ", engineer:" . $engineer . ", reason:" . $reason . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_149422817"); // SMS_140731732 $result = $this->aliSms->execute($this->req); return $result; } /** * 用户新年利是短信 * 模版内容: 打印机电脑报修平台,感谢老客户。微信搜索关注“极办公”公众号,领取猪年开工利是,${expire_hour}小时内有效。 * 申请说明: 用户新年利是短信 */ public function sendUserNewYearRedPackNotice($phone, $expire_hour = 24) { $this->req->setSmsType("normal"); $this->req->setSmsParam("{expire_hour:" . (int)$expire_hour . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_156470575"); // SMS_156470575 $result = $this->aliSms->execute($this->req); return $result; } /** * 模版名称: 用户新年利是(新) * 模版CODE: SMS_157284328 * 模版内容: 打印机电脑报修平台,感谢老客户。微信搜索关注“极办公”公众号,输入暗号${order}, 领取猪年开工利是,${expire_hour}小时内有效。 */ public function sendUserNewYearRedPackNoticeHasOrder($phone, $expire_hour = 24, $order_word = "") { $this->req->setSmsType("normal"); $this->req->setSmsParam("{expire_hour:" . (int)$expire_hour . ", order:" . $order_word . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_157284328"); // SMS_156470575 $result = $this->aliSms->execute($this->req); return $result; } /** * 您下的***机器的维修订单暂无工程师接单,如需急用,可增加感谢费加快接单速度 * @param $phone * @param int $expire_hour * @return mixed */ public function sendThankFeeNotice($phone, $deviceName, $signName = '') { // 设置短信签名 if (!empty($signName)) { $this->req->setSmsFreeSignName($signName); } $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $this->req->setSmsParam("{device_name:" . $deviceName . "}"); $this->req->setSmsTemplateCode("SMS_166776550"); $result = $this->aliSms->execute($this->req); return $result; } /** * 工程师修改手机验证码 * 验证码:${code},10分钟内有效。您正在申请修改手机号码 * @param $phone * @return mixed */ public function sendEngineerPhoneCode($phone, $code) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $params = json_encode(['code' => (string)$code]); $this->req->setSmsParam($params); $this->req->setSmsTemplateCode("SMS_169642915"); $result = $this->aliSms->execute($this->req); return $result; } /** * 订单宝: 订单宝-自有订单通知 * 模版内容: 您收到一张自有订单,设备“${device}”。进入公众号,您可以自己接单或者把订单转给其他工程师处理。 * 申请说明: 用于通知工程师收到新的专属订单 * @param $phone * @return mixed */ public function sendPrivateNewOrderMsg($phone, $device) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $params = json_encode(['device' => (string)$device]); $this->req->setSmsParam($params); $this->req->setSmsTemplateCode("SMS_173474941"); $result = $this->aliSms->execute($this->req); return $result; } /** * 订单宝: 订单宝-转出订单通知 * 模版内容: 您收到了一张“${device}”设备的转出订单,马上打开极窝订单宝微信公众号查看吧~ * 申请说明: 用于通知工程师收到新的专属订单 * @param $phone * @return mixed */ public function sendPrivateForwardOrderMsg($phone, $device) { $this->req->setSmsType("normal"); $this->req->setRecNum($phone); $params = json_encode(['device' => (string)$device]); $this->req->setSmsParam($params); $this->req->setSmsTemplateCode("SMS_173474272"); $result = $this->aliSms->execute($this->req); return $result; } /** * 工程师接自有订单单成功短信模板(自有订单) * 模版内容: 您的“${device}”维修订单已经被${engineer}接单,稍后工程师会与您电话联系。进入“订单宝客户端”微信小程序查看订单进度。 * 申请说明: 工程师接单成功短信提醒 */ public function sendPickPrivateOrderNotice($phone, $device, $engineer, $signName = '') { // 设置短信签名 if (!empty($signName)) { $this->req->setSmsFreeSignName($signName); } $this->req->setSmsType("normal"); $this->req->setSmsParam("{device:" . $device . ", engineer:" . $engineer . "}"); $this->req->setRecNum($phone); $this->req->setSmsTemplateCode("SMS_173760001"); $result = $this->aliSms->execute($this->req); return $result; } }