diff --git a/README.md b/README.md index c378890..3889ac5 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,15 @@ PC端 +PC企业站 + ![alt text](/public/images/screenshots.jpg "网站截图") +PC商城 + +![alt text](/public/images/pcscreenshots1.jpg "网站截图") +![alt text](/public/images/pcscreenshots2.jpg "网站截图") + WAP端 ![alt text](/public/images/wapscreenshots.png "手机站截图") diff --git a/app/Common/Wechat/WechatAuth.php b/app/Common/Wechat/WechatAuth.php new file mode 100644 index 0000000..fb4d920 --- /dev/null +++ b/app/Common/Wechat/WechatAuth.php @@ -0,0 +1,184 @@ +开发者模式->获取 + private $app_id; + private $app_secret; + + public function __construct($app_id, $app_secret) + { + $this->app_id = $app_id; + $this->app_secret = $app_secret; + } + + /** + * 获取微信授权链接 + * + * @param string $redirect_uri 回调地址,授权后重定向的回调链接地址,请使用urlEncode对链接进行处理 + * @param mixed $state 可以为空,重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值,最多128字节 + */ + public function get_authorize_url($redirect_uri = '', $state = '') + { + return "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$this->app_id."&redirect_uri=".urlencode($redirect_uri)."&response_type=code&scope=snsapi_userinfo&state=".$state."#wechat_redirect"; + } + + /** + * 微信PC扫码授权登录链接 + * + * @param string $redirect_uri 回调地址,授权后重定向的回调链接地址,请使用urlEncode对链接进行处理 + * @param mixed $state 可以为空,重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值,最多128字节 + */ + public function get_qrconnect_url($redirect_uri = '', $state = '') + { + return "https://open.weixin.qq.com/connect/qrconnect?appid".$this->app_id."&redirect_uri=".urlencode($redirect_uri)."&response_type=code&scope=snsapi_login&state=".$state."#wechat_redirect"; + } + + /** + * 获取授权token + * + * @param string $code 通过get_authorize_url获取到的code + */ + public function get_access_token($code = '') + { + $token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$this->app_id}&secret={$this->app_secret}&code={$code}&grant_type=authorization_code"; + $token_data = $this->http($token_url); + + return json_decode($token_data, true); + } + + /** + * 获取access_token,access_token是公众号的全局唯一接口调用凭据,公众号调用各接口时都需使用access_token。access_token的存储至少要保留512个字符空间。access_token的有效期目前为2个小时,需定时刷新,重复获取将导致上次获取的access_token失效。 + */ + public function get_token() + { + $token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->app_id}&secret={$this->app_secret}"; + $token_data = $this->http($token_url); + return json_decode($token_data, true); + } + + /** + * 获取小程序码,适用于需要的码数量较少的业务场景,通过该接口生成的小程序码,永久有效,数量限制见文末说明,请谨慎使用。 + * @param string $path 不能为空,最大长度 128 字节 + * @param int $width 二维码的宽度,默认430 + */ + public function getwxacode($path, $width = 430) + { + $access_token = $this->get_token(); + $url = 'https://api.weixin.qq.com/wxa/getwxacode?access_token='.$access_token['access_token']; + $path ="pages/mine/mine/mine?query=1"; + $data ='{"path":"'.$path.'","width":'.$width.'}'; + $res = $this->http($url, $data); + + return $res; + //将生成的小程序码存入相应文件夹下 + //file_put_contents('./public/wxyido/img/'.time().'.jpg',$return); + } + + /** + * 获取小程序码,通过该接口生成的小程序码,永久有效,数量暂无限制。用户扫描该码进入小程序后,开发者需在对应页面获取的码中 scene 字段的值,再做处理逻辑。 + * @param string $data['scene'] 二维码场景值 + * @param string $data['page'] 必须是已经发布的小程序存在的页面(否则报错),例如 "pages/index/index" ,根路径前不要填加'/',不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面 + * @param int $data['width'] 二维码的宽度,默认430 + * @param int $data['type'] 0路径存储,1base64 + */ + public function getwxacodeunlimit($data) + { + $access_token = $this->get_token(); + $url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token='.$access_token['access_token']; + + $post_data = array(); + $post_data['scene'] = $data['scene']; + $post_data['page'] = $data['page']; + $post_data['width'] = $data['width']; + + $res = $this->http($url, json_encode($post_data)); + if($data['type']==0) + { + file_put_contents($data['image_path'], $res); + } + else + { + $res = $this->data_uri($res); + } + + return $res; + //将生成的小程序码存入相应文件夹下 + //file_put_contents('./public/wxyido/img/'.time().'.jpg',$res); + } + + public function data_uri($contents, $mime = 'image/png') + { + $base64 = base64_encode($contents); + return ('data:' . $mime . ';base64,' . $base64); + } + + /** + * 获取授权后的微信用户信息 + * + * @param string $access_token + * @param string $open_id + */ + public function get_user_info($access_token = '', $open_id = '') + { + $info_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$access_token}&openid={$open_id}&lang=zh_CN"; + $info_data = $this->http($info_url); + + return json_decode($info_data, true); + } + + /** + * 获取用户基本信息(包括UnionID机制) + * + * @param string $access_token + * @param string $open_id + */ + public function get_user_unionid($access_token = '', $open_id = '') + { + $info_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$access_token}&openid={$open_id}&lang=zh_CN"; + $info_data = $this->http($info_url); + + return json_decode($info_data, true); + } + + /** + * 小程序登录凭证校验 + * 小程序调用wx.login() 获取 临时登录凭证code ,并回传到开发者服务器。 + * 开发者服务器以code换取 用户唯一标识openid 和 会话密钥session_key。 + * 临时登录凭证校验接口是一个 HTTPS 接口,开发者服务器使用 临时登录凭证code 获取 session_key 和 openid 等。 + * @param string $js_code 小程序登录时获取的code + */ + public function miniprogram_wxlogin($js_code) + { + $url = "https://api.weixin.qq.com/sns/jscode2session?appid={$this->app_id}&secret={$this->app_secret}&js_code=$js_code&grant_type=authorization_code"; + $res = $this->http($url); + + return json_decode($res, true); + } + + // cURL函数简单封装 + public function http($url, $data = null) + { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); + + if (!empty($data)) + { + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + } + + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + $output = curl_exec($curl); + curl_close($curl); + + return $output; + } +} \ No newline at end of file diff --git a/app/Common/WechatCallbackApi.php b/app/Common/Wechat/WechatCallbackApi.php similarity index 99% rename from app/Common/WechatCallbackApi.php rename to app/Common/Wechat/WechatCallbackApi.php index 0fef54d..a39b445 100644 --- a/app/Common/WechatCallbackApi.php +++ b/app/Common/Wechat/WechatCallbackApi.php @@ -1,5 +1,5 @@ $this->component_appid); - $result = $this->httpPost(self::API_URL_PREFIX . self::GET_PREAUTHCODE_URL . $access_token, json_encode($arr)); + $result = $this->httpPost(self::API_URL_PREFIX . self::GET_PREAUTHCODE_URL . $component_access_token, json_encode($arr)); if ($result) { $json = json_decode($result, true); if (!$json || !empty($json['errcode'])) { diff --git a/app/Common/aes/demo.php b/app/Common/Wechat/aes/demo.php similarity index 99% rename from app/Common/aes/demo.php rename to app/Common/Wechat/aes/demo.php index 896d4b8..a32fc28 100644 --- a/app/Common/aes/demo.php +++ b/app/Common/Wechat/aes/demo.php @@ -37,4 +37,4 @@ if ($errCode == 0) { print("解密后: " . $msg . "\n"); } else { print($errCode . "\n"); -} +} \ No newline at end of file diff --git a/app/Common/aes/errorCode.php b/app/Common/Wechat/aes/errorCode.php similarity index 99% rename from app/Common/aes/errorCode.php rename to app/Common/Wechat/aes/errorCode.php index f56a914..cb37f17 100644 --- a/app/Common/aes/errorCode.php +++ b/app/Common/Wechat/aes/errorCode.php @@ -1,5 +1,4 @@ @@ -31,5 +30,4 @@ class ErrorCode public static $DecodeBase64Error = -40010; public static $GenReturnXmlError = -40011; } - ?> \ No newline at end of file diff --git a/app/Common/aes/pkcs7Encoder.php b/app/Common/Wechat/aes/pkcs7Encoder.php similarity index 96% rename from app/Common/aes/pkcs7Encoder.php rename to app/Common/Wechat/aes/pkcs7Encoder.php index f040fb5..bde0587 100644 --- a/app/Common/aes/pkcs7Encoder.php +++ b/app/Common/Wechat/aes/pkcs7Encoder.php @@ -1,5 +1,4 @@ 32) { + + if ($pad < 1 || $pad > 32) + { $pad = 0; } + return substr($text, 0, (strlen($text) - $pad)); } } @@ -58,12 +59,12 @@ class PKCS7Encoder class Prpcrypt { public $key; - + function __construct($k) { $this->key = base64_decode($k . "="); } - + /** * 对明文进行加密 * @param string $text 需要加密的明文 @@ -71,7 +72,6 @@ class Prpcrypt */ public function encrypt($text, $appid) { - try { //获得16位随机字符串,填充到明文之前 $random = $this->getRandomStr(); @@ -97,7 +97,7 @@ class Prpcrypt return array(ErrorCode::$EncryptAESError, null); } } - + /** * 对密文进行解密 * @param string $encrypted 需要解密的密文 @@ -105,7 +105,6 @@ class Prpcrypt */ public function decrypt($encrypted, $appid) { - try { //使用BASE64对需要解密的字符串进行解码 $ciphertext_dec = base64_decode($encrypted); @@ -120,8 +119,7 @@ class Prpcrypt } catch (Exception $e) { return array(ErrorCode::$DecryptAESError, null); } - - + try { //去除补位字符 $pkc_encoder = new PKCS7Encoder; @@ -141,26 +139,24 @@ class Prpcrypt if ($from_appid != $appid) return array(ErrorCode::$ValidateAppidError, null); return array(0, $xml_content); - } - - + /** * 随机生成16位字符串 * @return string 生成的字符串 */ function getRandomStr() { - $str = ""; $str_pol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $max = strlen($str_pol) - 1; - for ($i = 0; $i < 16; $i++) { + + for ($i = 0; $i < 16; $i++) + { $str .= $str_pol[mt_rand(0, $max)]; } + return $str; } - } - ?> \ No newline at end of file diff --git a/app/Common/aes/sha1.php b/app/Common/Wechat/aes/sha1.php similarity index 99% rename from app/Common/aes/sha1.php rename to app/Common/Wechat/aes/sha1.php index 0a0a79e..f5e8d3f 100644 --- a/app/Common/aes/sha1.php +++ b/app/Common/Wechat/aes/sha1.php @@ -1,5 +1,4 @@ \ No newline at end of file diff --git a/app/Common/Wechat/aes/wxBizDataCrypt.php b/app/Common/Wechat/aes/wxBizDataCrypt.php new file mode 100644 index 0000000..a9079d0 --- /dev/null +++ b/app/Common/Wechat/aes/wxBizDataCrypt.php @@ -0,0 +1,81 @@ + + + *
  • -41001: encodingAesKey 非法
  • + *
  • -41003: aes 解密失败
  • + *
  • -41004: 解密后得到的buffer非法
  • + *
  • -41005: base64加密失败
  • + *
  • -41016: base64解密失败
  • + * + */ +class ErrorCode +{ + public static $OK = 0; + public static $IllegalAesKey = -41001; + public static $IllegalIv = -41002; + public static $IllegalBuffer = -41003; + public static $DecodeBase64Error = -41004; +} + +class WXBizDataCrypt +{ + private $appid; + private $sessionKey; + + /** + * 构造函数 + * @param $sessionKey string 用户在小程序登录后获取的会话密钥 + * @param $appid string 小程序的appid + */ + public function __construct( $appid, $sessionKey) + { + $this->sessionKey = $sessionKey; + $this->appid = $appid; + } + + /** + * 检验数据的真实性,并且获取解密后的明文. + * @param $encryptedData string 加密的用户数据 + * @param $iv string 与用户数据一同返回的初始向量 + * @param $data string 解密后的原文 + * + * @return int 成功0,失败返回对应的错误码 + */ + public function decryptData( $encryptedData, $iv, &$data ) + { + if (strlen($this->sessionKey) != 24) { + return ErrorCode::$IllegalAesKey; + } + $aesKey=base64_decode($this->sessionKey); + + + if (strlen($iv) != 24) { + return ErrorCode::$IllegalIv; + } + $aesIV=base64_decode($iv); + + $aesCipher=base64_decode($encryptedData); + + $result=openssl_decrypt( $aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV); + + $dataObj=json_decode( $result ); + if( $dataObj == NULL ) + { + return ErrorCode::$IllegalBuffer; + } + if( $dataObj->watermark->appid != $this->appid ) + { + return ErrorCode::$IllegalBuffer; + } + $data = $result; + return ErrorCode::$OK; + } +} \ No newline at end of file diff --git a/app/Common/aes/wxBizMsgCrypt.php b/app/Common/Wechat/aes/wxBizMsgCrypt.php similarity index 99% rename from app/Common/aes/wxBizMsgCrypt.php rename to app/Common/Wechat/aes/wxBizMsgCrypt.php index 672541b..83cf743 100644 --- a/app/Common/aes/wxBizMsgCrypt.php +++ b/app/Common/Wechat/aes/wxBizMsgCrypt.php @@ -1,12 +1,10 @@ generate($encrypt, $signature, $timeStamp, $nonce); return ErrorCode::$OK; } - - + /** * 检验消息的真实性,并且获取解密后的明文. *
      @@ -145,6 +142,4 @@ class WXBizMsgCrypt return ErrorCode::$OK; } - -} - +} \ No newline at end of file diff --git a/app/Common/aes/xmlparse.php b/app/Common/Wechat/aes/xmlparse.php similarity index 99% rename from app/Common/aes/xmlparse.php rename to app/Common/Wechat/aes/xmlparse.php index f740847..6474ce2 100644 --- a/app/Common/aes/xmlparse.php +++ b/app/Common/Wechat/aes/xmlparse.php @@ -8,7 +8,6 @@ include_once "errorCode.php"; */ class XMLParse { - /** * 提取出xml数据包中的加密消息 * @param string $xmltext 待提取的xml字符串 @@ -29,7 +28,7 @@ class XMLParse return array(ErrorCode::$ParseXmlError, null, null); } } - + /** * 生成xml消息 * @param string $encrypt 加密后的消息密文 @@ -47,8 +46,5 @@ class XMLParse "; return sprintf($format, $encrypt, $signature, $timestamp, $nonce); } - } - - ?> \ No newline at end of file diff --git a/app/Common/WechatAuth.php b/app/Common/WechatAuth.php deleted file mode 100644 index cc37d45..0000000 --- a/app/Common/WechatAuth.php +++ /dev/null @@ -1,103 +0,0 @@ -开发者模式->获取 - private $app_id; - private $app_secret; - - public function __construct($app_id, $app_secret) - { - $this->app_id = $app_id; - $this->app_secret = $app_secret; - } - - /** - * 获取微信授权链接 - * - * @param string $redirect_uri 回调地址,授权后重定向的回调链接地址,请使用urlEncode对链接进行处理 - * @param mixed $state 可以为空,重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值,最多128字节 - */ - public function get_authorize_url($redirect_uri = '', $state = '') - { - return "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$this->app_id."&redirect_uri=".urlencode($redirect_uri)."&response_type=code&scope=snsapi_userinfo&state=".$state."#wechat_redirect"; - } - - /** - * 微信PC扫码授权登录链接 - * - * @param string $redirect_uri 回调地址,授权后重定向的回调链接地址,请使用urlEncode对链接进行处理 - * @param mixed $state 可以为空,重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值,最多128字节 - */ - public function get_qrconnect_url($redirect_uri = '', $state = '') - { - return "https://open.weixin.qq.com/connect/qrconnect?appid".$this->app_id."&redirect_uri=".urlencode($redirect_uri)."&response_type=code&scope=snsapi_login&state=".$state."#wechat_redirect"; - } - - /** - * 获取授权token - * - * @param string $code 通过get_authorize_url获取到的code - */ - public function get_access_token($code = '') - { - $token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$this->app_id}&secret={$this->app_secret}&code={$code}&grant_type=authorization_code"; - $token_data = $this->http($token_url); - - return json_decode($token_data, true); - } - - /** - * 获取授权后的微信用户信息 - * - * @param string $access_token - * @param string $open_id - */ - public function get_user_info($access_token = '', $open_id = '') - { - $info_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$access_token}&openid={$open_id}&lang=zh_CN"; - $info_data = $this->http($info_url); - - return json_decode($info_data, true); - } - - /** - * 获取用户基本信息(包括UnionID机制) - * - * @param string $access_token - * @param string $open_id - */ - public function get_user_unionid($access_token = '', $open_id = '') - { - $info_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$access_token}&openid={$open_id}&lang=zh_CN"; - $info_data = $this->http($info_url); - - return json_decode($info_data, true); - } - - // cURL函数简单封装 - public function http($url, $data = null) - { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); - - if (!empty($data)) - { - curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, $data); - } - - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - $output = curl_exec($curl); - curl_close($curl); - - return $output; - } -} \ No newline at end of file diff --git a/app/Common/aes/ReadMe.txt b/app/Common/aes/ReadMe.txt deleted file mode 100644 index e93b8ff..0000000 --- a/app/Common/aes/ReadMe.txt +++ /dev/null @@ -1,4 +0,0 @@ -ע -1.WXBizMsgCrypt.phpļṩWXBizMsgCryptʵ֣ûҵ΢ŵĽӿࡣSample.phpṩʾԹ߲οerrorCode.php, pkcs7Encoder.php, sha1.php, xmlparse.phpļʵĸ࣬ʵ֡ -2.WXBizMsgCryptװ DecryptMsg, EncryptMsgӿڣֱڿ߽Լ߻ظϢļܡʹ÷ԲοSample.phpļ -3.ӽЭο΢Źƽ̨ٷĵ \ No newline at end of file diff --git a/app/Http/Controllers/Admin/WeixinMenuController.php b/app/Http/Controllers/Admin/WeixinMenuController.php index 0c8d4a5..09e0a64 100644 --- a/app/Http/Controllers/Admin/WeixinMenuController.php +++ b/app/Http/Controllers/Admin/WeixinMenuController.php @@ -6,7 +6,7 @@ use App\Common\Helper; use Illuminate\Http\Request; use App\Http\Logic\WeixinMenuLogic; use App\Http\Model\WeixinMenu; -use App\Common\WechatMenu; +use App\Common\Wechat\WechatMenu; class WeixinMenuController extends CommonController { diff --git a/app/Http/Controllers/Api/ImageController.php b/app/Http/Controllers/Api/ImageController.php index 258f07f..1eafbbd 100644 --- a/app/Http/Controllers/Api/ImageController.php +++ b/app/Http/Controllers/Api/ImageController.php @@ -207,4 +207,54 @@ class ImageController extends CommonController return $fileArray; } + + /** + * base64图片上传,成功返回路径,不含域名,只能单图上传 + * @param string img base64字符串 + * @return string + */ + public function base64ImageUpload(Request $request) + { + $res = []; + $base64_img = $_POST['img']; + + if($base64_img) + { + if(preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_img, $result)) + { + $type = $result[2]; + if(in_array($type, array('jpeg','jpg','gif','bmp','png'))) + { + $image_path = $this->path.'/'.date('Ymdhis',time()).rand(1000,9999).'.'.$type; + $uploads_path = $this->path; //存储路径 + + if(!file_exists($this->public_path.$uploads_path)) + { + Helper::createDir($this->public_path.$uploads_path); //创建文件夹; + } + + if(file_put_contents($this->public_path.$image_path, base64_decode(str_replace($result[1], '', $base64_img)))) + { + return ReturnData::create(ReturnData::SUCCESS,null,$image_path); + } + else + { + return ReturnData::create(ReturnData::SYSTEM_FAIL,null,'图片上传失败'); + } + } + else + { + //文件类型错误 + return ReturnData::create(ReturnData::SYSTEM_FAIL,null,'图片上传类型错误'); + } + } + else + { + //文件错误 + return ReturnData::create(ReturnData::SYSTEM_FAIL,null,'文件错误'); + } + } + + return ReturnData::create(ReturnData::SYSTEM_FAIL,null,'请上传文件'); + } } \ No newline at end of file diff --git a/app/Http/Controllers/Api/NotifyController.php b/app/Http/Controllers/Api/NotifyController.php index 9c3d2f1..628b407 100644 --- a/app/Http/Controllers/Api/NotifyController.php +++ b/app/Http/Controllers/Api/NotifyController.php @@ -24,7 +24,9 @@ class NotifyController extends CommonController Log::info('微信支付回调数据:'.$GLOBALS['HTTP_RAW_POST_DATA']); //获取通知的数据 - $xml = $GLOBALS['HTTP_RAW_POST_DATA']; + //$xml = $GLOBALS['HTTP_RAW_POST_DATA']; + $xml = file_get_contents("php://input"); + //将XML转为array //禁止引用外部xml实体 libxml_disable_entity_loader(true); diff --git a/app/Http/Controllers/Weixin/UserController.php b/app/Http/Controllers/Weixin/UserController.php index 5ed85db..c9f74c2 100644 --- a/app/Http/Controllers/Weixin/UserController.php +++ b/app/Http/Controllers/Weixin/UserController.php @@ -5,7 +5,7 @@ use App\Http\Controllers\Weixin\CommonController; use Illuminate\Http\Request; use App\Common\ReturnCode; use App\Common\ReturnData; -use App\Common\WechatAuth; +use App\Common\Wechat\WechatAuth; use App\Common\Helper; class UserController extends CommonController diff --git a/app/Http/Service/Smsbao.php b/app/Http/Service/Smsbao.php new file mode 100644 index 0000000..f1bb861 --- /dev/null +++ b/app/Http/Service/Smsbao.php @@ -0,0 +1,86 @@ + "短信发送成功", + "-1" => "参数不全", + "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!", + "30" => "密码错误", + "40" => "账号不存在", + "41" => "余额不足", + "42" => "帐户已过期", + "43" => "IP地址限制", + "50" => "内容含有敏感词" + ); + + public function __construct($user_name, $password) + { + $this->user_name = $user_name; + $this->password = $password; + } + + /** + * 国内短信 + * + * @param string $sms_content 要发送的短信内容 + * @param string $sms_phone 接收的手机号,单发:15205201314,群发:15205201314,15205201315,群发时多个手机号以逗号分隔,一次不要超过99个号码 + * return string + */ + public function sms($sms_content, $sms_phone) + { + $user = $this->user_name; //短信平台帐号 + $pass = md5($this->password); //短信平台密码 + $content = $sms_content; //要发送的短信内容 + $phone = $sms_phone; //要发送短信的手机号码 + $sendurl = $this->smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content); + $result = file_get_contents($sendurl) ; + + return $this->status_str[$result]; + } + + /** + * 国际短信 + * + * @param string $sms_content 要发送的短信内容 + * @param string $sms_phone 接收的手机号,单发:+60901234567,群发:+60901234567,+60901234567,群发时多个手机号以逗号分隔,一次不要超过99个号码,注:国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,如:urlencode("+60901234567")否则会出现格式错误) + * return string + */ + public function wsms($sms_content, $sms_phone) + { + $user = $this->user_name; //短信平台帐号 + $pass = md5($this->password); //短信平台密码 + $content = $sms_content; //要发送的短信内容 + $phone = $sms_phone; //要发送短信的手机号码 + $sendurl = $this->smsapi."wsms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content); + $result = file_get_contents($sendurl) ; + + return $this->status_str[$result]; + } + + /** + * 语音验证码发送 + * + * @param string $sms_code 发送的验证码 + * @param string $sms_phone 目标手机号码 + * return string + */ + public function voice($sms_code, $sms_phone) + { + $user = $this->user_name; //短信平台帐号 + $pass = md5($this->password); //短信平台密码 + $content = $sms_code; //要发送的短信内容 + $phone = $sms_phone; //要发送短信的手机号码 + $sendurl = $this->smsapi."voice?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content); + $result = file_get_contents($sendurl) ; + + return $this->status_str[$result]; + } +} \ No newline at end of file diff --git a/public/images/pcscreenshots1.jpg b/public/images/pcscreenshots1.jpg new file mode 100644 index 0000000..fc61f93 Binary files /dev/null and b/public/images/pcscreenshots1.jpg differ diff --git a/public/images/pcscreenshots2.jpg b/public/images/pcscreenshots2.jpg new file mode 100644 index 0000000..5f7256e Binary files /dev/null and b/public/images/pcscreenshots2.jpg differ