FW_sms.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维直播系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2010 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. /* 模块的基本信息 */
  8. if (isset($read_modules) && $read_modules == true)
  9. {
  10. $module['server_url'] = 'http://sms.fanwe.com/';
  11. $module['class_name'] = 'FW';
  12. /* 名称 */
  13. $module['name'] = "方维短信平台";
  14. if(ACTION_NAME == "install" || ACTION_NAME == "edit"){
  15. require_once APP_ROOT_PATH."system/sms/FW/transport.php";
  16. $tran = new transport_sms();
  17. $install_info = $tran->request($module['server_url']."data/install.php");
  18. $install_info = json_decode($install_info['body'],1);
  19. $module['lang'] = $install_info['lang'];
  20. $module['config'] = $install_info['config'];
  21. }
  22. return $module;
  23. }
  24. // 企信通短信平台
  25. require_once APP_ROOT_PATH."system/libs/sms.php"; //引入接口
  26. require_once APP_ROOT_PATH."system/sms/FW/transport.php";
  27. class FW_sms implements sms
  28. {
  29. public $sms;
  30. public $message = "";
  31. public function __construct($smsInfo = '')
  32. {
  33. if(!empty($smsInfo))
  34. {
  35. $this->sms = $smsInfo;
  36. }
  37. }
  38. public function sendSMS($mobile_number,$content,$is_adv=0)
  39. {
  40. $sms = new transport_sms();
  41. if(is_array($mobile_number)){
  42. $mobile_number = implode(",",$mobile_number);
  43. }
  44. $this->sms['mobile'] = $mobile_number;
  45. $this->sms['content'] = urlencode($content);
  46. if($is_adv==1){
  47. $this->sms['is_adv'] = 1;
  48. }else{
  49. $this->sms['is_adv'] = 0;
  50. }
  51. $params = json_encode($this->sms);
  52. $result_info = $sms->request($this->sms['server_url']."post",$params);
  53. $return = json_decode($result_info['body'],1);
  54. $result['status'] = $return['status'];
  55. $result['msg'] = $return['msg'];
  56. return $result;
  57. }
  58. public function getSmsInfo()
  59. {
  60. return "方维短信平台";
  61. }
  62. public function check_fee()
  63. {
  64. $sms = new transport_sms();
  65. $url = $this->sms['server_url']."get";
  66. $params = json_encode($this->sms);
  67. $result = $sms->request($url,$params);
  68. $result = json_decode($result['body'],1);
  69. $str = $result['info'];
  70. return $str;
  71. }
  72. }
  73. ?>