AppMsg.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\common\util;
  3. /**
  4. * APP消息类型
  5. */
  6. class AppMsg
  7. {
  8. // 短信模板
  9. const SMS_VERIFY = "您的验证码为:{#code},有效期为10分钟!"; // 短信验证模板
  10. const SMS_PH_DISPATCH = "{#name},有一个新的订单需要您及时处理,订单联系人:{#contact},订单联系电话:{#phone}。"; // 有陪护订单时给调度发消息提醒模板
  11. // 推送类型
  12. const PUSH_USER_ORDER_SEND = 1; //通知客户订单已派发
  13. const PUSH_WORKER_ORDER_SEND = 2; //通知员工有新派的订单
  14. const PUSH_USER_ORDER_FINISH = 3; //通知客户订单已完成
  15. const PUSH_CUSTOM = 4; //通知提醒,自定义内容
  16. const PUSH_WASTE_UNFINISH = 5; //医废未转运提醒
  17. const PUSH_PATROL = 6; //巡更任务提醒
  18. const PUSH_ORDER_ROB = 7; //抢单提醒工人
  19. const PUSH_CLEAN = 8; //专项保洁任务提醒
  20. const PUSH_PH_DISPATCH = 9; //有陪护订单时给调度发消息
  21. const PUSH_DAILY_TASK = 10; //日常工作任务提醒
  22. const PUSH_DEVICE_TASK = 11; //设备台账任务提醒
  23. const PUSH_COMPLAIN_TIMEOUT = 12; //投诉处理超时提醒
  24. const PUSH_COMPLAIN_FINISH = 13; //投诉已处理提醒投诉人
  25. const PUSH_INFORMER_USER = 14; //推送品控知会人提醒
  26. public static function getPushMsg($type,$msg=''){
  27. if($msg){
  28. return $msg;
  29. }
  30. $msgs = [
  31. 1 => '您提交的工单正在处理中',
  32. 2 => '您有新的任务需要处理',
  33. 3 => '您提交的订单已处理',
  34. 5 => '还有未转运订单未处理',
  35. 7 => '来新订单了,请及时抢单',
  36. 12 => '有投诉超时未处理,请知晓。',
  37. 13 => '您的投诉已处理,请知晓。',
  38. ];
  39. $msg = isset($msgs[$type])?$msgs[$type]:'';
  40. return $msg;
  41. }
  42. /**
  43. * 获取短信消息
  44. */
  45. public static function getSmsMsg($template,$params=[]){
  46. foreach ($params as $k=>$v){
  47. $search = '{#'.$k.'}';
  48. $template = str_ireplace($search,$v,$template);
  49. }
  50. return $template;
  51. }
  52. }