WechatTempleService.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace liuniu;
  3. use app\admin\model\wechat\TemplateInfo;
  4. class WechatTempleService
  5. {
  6. /**
  7. * 主营行业:IT科技 互联网|电子商务
  8. * 副营行业:IT科技 IT软件与服务
  9. */
  10. //培训提醒通知
  11. const RAINING_REMINDER = 'OPENTM412298968';
  12. //服务续费提醒通知
  13. const RENWAL_REINDER = 'TM202168523';
  14. //订单会员通知
  15. const BECOME_VIP = 'OPENTM406048156';
  16. //工单受理提醒
  17. const WORK_STATUS = 'OPENTM417758252';
  18. //报名成功通知
  19. const REGISTRATION_SUCCESS = 'OPENTM413131902';
  20. //工单超时通知
  21. const WORK_TIMEOUT = 'OPENTM418425938';
  22. //申请拒绝通知
  23. const REQUEXST_REFUSE = 'OPENTM418263428';
  24. //支援者应答通知
  25. const SUPPAORTER_REPLY = 'OPENTM415748334';
  26. //紧急救援通知
  27. const EMERGANCY_RESCUE = 'OPENTM415748326';
  28. /**
  29. * 发送模板消息
  30. */
  31. public static function sendTemplate($cid,$openid, $templateId, array $data, $url = null)
  32. {
  33. $tempid = TemplateInfo::where('cid',$cid)->where('tempkey', $templateId)->value('tempid');
  34. if (!$tempid) return false;
  35. try {
  36. return WechatService::sendTemplate($openid,$tempid,$data,$url,$cid);
  37. } catch (\Exception $e) {
  38. return false;
  39. }
  40. }
  41. }