SmsSend.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\common\service;
  3. use app\common\library\Sms;
  4. class SmsSend{
  5. protected $mobile;
  6. protected $code;
  7. protected $event;
  8. /**
  9. * @param mixed $mobile
  10. */
  11. public static function setMobile($mobile)
  12. {
  13. $clss=new self;
  14. $clss->mobile = $mobile;
  15. return $clss;
  16. }
  17. /**
  18. * @param mixed $code
  19. */
  20. public function setCode($code)
  21. {
  22. $this->code = $code;
  23. return $this;
  24. }
  25. /**
  26. * @param mixed $event
  27. */
  28. public function setEvent($event)
  29. {
  30. $this->event = $event;
  31. return $this;
  32. }
  33. public function check(){
  34. $config=config('site.system_sms_open');
  35. if(!$config){
  36. return;
  37. }
  38. if(!Sms::check($this->mobile,$this->code,$this->event)){
  39. throw_user('验证码错误');
  40. }
  41. }
  42. public static function orderSend($mobile,$transName,$transNo){
  43. return Sms::send($mobile,null,'temp_send_order','temp_send_order',[
  44. 'expresscorp'=>$transName,
  45. 'expressno'=>$transNo
  46. ]);
  47. }
  48. public static function orderUnPay($mobile,$no){
  49. return Sms::send($mobile,null,'temp_unpay','temp_unpay',[
  50. ]);
  51. }
  52. public static function orderSubmit($mobile){
  53. return Sms::send($mobile,null,'temp_submit_order','temp_submit_order');
  54. }
  55. public static function orderPayed($mobile){
  56. return Sms::send($mobile,null,'temp_payed_order','temp_payed_order',[
  57. ]);
  58. }
  59. public static function orderRefund($mobile){
  60. return Sms::send($mobile,null,'temp_refund_order','temp_refund_order',[
  61. ]);
  62. }
  63. public static function mobileDown($mobile){
  64. return Sms::send($mobile,null,'temp_down','temp_down',[
  65. ]);
  66. }
  67. }