tiams@foxmail.com 9 år sedan
förälder
incheckning
e97e0b6432

+ 133 - 102
core/framework/libraries/sms.php

@@ -10,69 +10,69 @@ defined('InShopNC') or exit('Access Invalid!');
 
 class Sms
 {
-	const register_code = 1;
-	const resetpass_code = 2;
-	const getbonus_code = 3;
-	const getbind_code = 4;
+    const register_code = 1;
+    const resetpass_code = 2;
+    const getbonus_code = 3;
+    const getbind_code = 4;
 
     /*
      * 发送手机短信
      * @param unknown $mobile 手机号
      * @param unknown $content 短信内容
     */
-    public function send($mobile,$content) 
+    public function send($mobile, $content)
     {
-		$mobile_host_type=C('mobile_host_type');
-		if($mobile_host_type == 1) {
-			return $this->mysend_smsbao($mobile,$content);
-		}
-		elseif($mobile_host_type == 2) {
-			return $this->mysend_yunpian($mobile,$content);
-		}
-        elseif($mobile_host_type == 3) {
-            return $this->mysend_yuntx($mobile,$content);
+        $mobile_host_type = C('mobile_host_type');
+        if ($mobile_host_type == 1) {
+            return $this->mysend_smsbao($mobile, $content);
+        } elseif ($mobile_host_type == 2) {
+            return $this->mysend_yunpian($mobile, $content);
+        } elseif ($mobile_host_type == 3) {
+            return $this->mysend_yuntx($mobile, $content);
+        } elseif ($mobile_host_type == 4) {
+            $this->send_yunpian($mobile, $content);
         }
     }
 
-    public function send_msg($mobile,$code,$type,$extime='5')
+    public function send_msg($mobile, $code, $type, $extime = '5')
     {
-		Log::record("SMS send:{$mobile} {$code} {$type}",Log::DEBUG);
-    	$folder = 'yuntx';
-    	$plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $folder)));
-    	if (!empty($plugin)) {
-    	    define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
+        Log::record("SMS send:{$mobile} {$code} {$type}", Log::DEBUG);
+        $folder = 'yuntx';
+        $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $folder)));
+        if (!empty($plugin)) {
+            define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
             require_once(PLUGIN_ROOT . DS . $plugin . DS . 'CCPRestSDK.php');
-    	    require_once(PLUGIN_ROOT . DS . $plugin . DS . 'SendSMS.php');
+            require_once(PLUGIN_ROOT . DS . $plugin . DS . 'SendSMS.php');
 
-    	    return sendSMS($mobile, array($code,$extime),$type);
-    	} else {
-    	    return -1;
-    	}
+            return sendSMS($mobile, array($code, $extime), $type);
+        } else {
+            return -1;
+        }
     }
-    
-   /*
-	您于{$send_time}绑定手机号,验证码是:{$verify_code}。【{$site_name}】
-	0  提交成功
-	30:密码错误
-	40:账号不存在
-	41:余额不足
-	42:帐号过期
-	43:IP地址限制
-	50:内容含有敏感词
-	51:手机号码不正确
-	http://api.smsbao.com/sms?u=USERNAME&p=PASSWORD&m=PHONE&c=CONTENT
-	*/
+
+    /*
+     您于{$send_time}绑定手机号,验证码是:{$verify_code}。【{$site_name}】
+     0  提交成功
+     30:密码错误
+     40:账号不存在
+     41:余额不足
+     42:帐号过期
+     43:IP地址限制
+     50:内容含有敏感词
+     51:手机号码不正确
+     http://api.smsbao.com/sms?u=USERNAME&p=PASSWORD&m=PHONE&c=CONTENT
+     */
     private function mysend_yuntx($mobile, $content)
     {
         $code = $content['code'];
         $time = $content['time'];
         $type = intval($content['type']);
 
-		static $templates = array(self::register_code => '59006',self::resetpass_code => '63477', self::getbonus_code => '63479',self::getbind_code => '59006');
-		if(!array_key_exists($type,$templates)) return -1;
+        static $templates = array(self::register_code => '59006', self::resetpass_code => '63477', self::getbonus_code => '63479', self::getbind_code => '59006');
+        if (!array_key_exists($type, $templates)) return -1;
 
-        return $this->send_msg($mobile,$code,$templates[$type],$time);
-	}
+        return $this->send_msg($mobile, $code, $templates[$type], $time);
+    }
 
     /*
 	您于{$send_time}绑定手机号,验证码是:{$verify_code}。【{$site_name}】
@@ -86,75 +86,106 @@ class Sms
 	51:手机号码不正确
 	http://api.smsbao.com/sms?u=USERNAME&p=PASSWORD&m=PHONE&c=CONTENT
 	*/
-    private function mysend_smsbao($mobile,$content)
-    {     
-	   $user_id = urlencode(C('mobile_username')); // 这里填写用户名
- 	   $pass = urlencode(C('mobile_pwd')); // 这里填登陆密码
- 	   if(!$mobile || !$content || !$user_id || !$pass) return false;
-	   if(is_array($mobile)) $mobile = implode(",",$mobile);
-       $mobile=urlencode($mobile);
-       //$content=$content."【我的网站】";
-       $content=urlencode($content);
-	   $pass =md5($pass);//MD5加密
-	   $url="http://api.smsbao.com/sms?u=".$user_id."&p=".$pass."&m=".$mobile."&c=".$content."";
- 	   $res = file_get_contents($url);
- 	   //return $res;
- 	   $ok=$res=="0";
- 	   if($ok) {
- 	     return true;
- 	   }
- 	   return false;
+    private function mysend_smsbao($mobile, $content)
+    {
+        $user_id = urlencode(C('mobile_username')); // 这里填写用户名
+        $pass = urlencode(C('mobile_pwd')); // 这里填登陆密码
+        if (!$mobile || !$content || !$user_id || !$pass) return false;
+        if (is_array($mobile)) $mobile = implode(",", $mobile);
+        $mobile = urlencode($mobile);
+        //$content=$content."【我的网站】";
+        $content = urlencode($content);
+        $pass = md5($pass);//MD5加密
+        $url = "http://api.smsbao.com/sms?u=" . $user_id . "&p=" . $pass . "&m=" . $mobile . "&c=" . $content . "";
+        $res = file_get_contents($url);
+        //return $res;
+        $ok = $res == "0";
+        if ($ok) {
+            return true;
+        }
+        return false;
 
     }
-	 /**
-	 * http://www.yunpian.com/
+
+    /**
+     * http://www.yunpian.com/
      * 发送手机短信
      * @param unknown $mobile 手机号
      * @param unknown $content 短信内容
-	  0 	OK 	调用成功,该值为null 	无需处理
-	  1 	请求参数缺失 	补充必须传入的参数 	开发者
-	  2 	请求参数格式错误 	按提示修改参数值的格式 	开发者
-	  3 	账户余额不足 	账户需要充值,请充值后重试 	开发者
-	  4 	关键词屏蔽 	关键词屏蔽,修改关键词后重试 	开发者
-	  5 	未找到对应id的模板 	模板id不存在或者已经删除 	开发者
-	  6 	添加模板失败 	模板有一定的规范,按失败提示修改 	开发者
-	  7 	模板不可用 	审核状态的模板和审核未通过的模板不可用 	开发者
-	  8 	同一手机号30秒内重复提交相同的内容 	请检查是否同一手机号在30秒内重复提交相同的内容 	开发者
-	  9 	同一手机号5分钟内重复提交相同的内容超过3次 	为避免重复发送骚扰用户,同一手机号5分钟内相同内容最多允许发3次 	开发者
-	  10 	手机号黑名单过滤 	手机号在黑名单列表中(你可以把不想发送的手机号添加到黑名单列表) 	开发者
-	  11 	接口不支持GET方式调用 	接口不支持GET方式调用,请按提示或者文档说明的方法调用,一般为POST 	开发者
-	  12 	接口不支持POST方式调用 	接口不支持POST方式调用,请按提示或者文档说明的方法调用,一般为GET 	开发者
-	  13 	营销短信暂停发送 	由于运营商管制,营销短信暂时不能发送 	开发者
-	  14 	解码失败 	请确认内容编码是否设置正确 	开发者
-	  15 	签名不匹配 	短信签名与预设的固定签名不匹配 	开发者
-	  16 	签名格式不正确 	短信内容不能包含多个签名【 】符号 	开发者
-	  17 	24小时内同一手机号发送次数超过限制 	请检查程序是否有异常或者系统是否被恶意攻击 	开发者
-	  -1 	非法的apikey 	apikey不正确或没有授权 	开发者
-	  -2 	API没有权限 	用户没有对应的API权限 	开发者
-	  -3 	IP没有权限 	访问IP不在白名单之内,可在后台"账户设置->IP白名单设置"里添加该IP 	开发者
-	  -4 	访问次数超限 	调整访问频率或者申请更高的调用量 	开发者
-	  -5 	访问频率超限 	短期内访问过于频繁,请降低访问频率 	开发者
-	  -50 未知异常 	系统出现未知的异常情况 	技术支持
-	  -51 系统繁忙 	系统繁忙,请稍后重试 	技术支持
-	  -52 充值失败 	充值时系统出错 	技术支持
-	  -53 提交短信失败 	提交短信时系统出错 	技术支持
-	  -54 记录已存在 	常见于插入键值已存在的记录 	技术支持
-	  -55 记录不存在 	没有找到预期中的数据 	技术支持
-	  -57 用户开通过固定签名功能,但签名未设置 	联系客服或技术支持设置固定签名 	技术支持
+     * 0    OK    调用成功,该值为null    无需处理
+     * 1    请求参数缺失    补充必须传入的参数    开发者
+     * 2    请求参数格式错误    按提示修改参数值的格式    开发者
+     * 3    账户余额不足    账户需要充值,请充值后重试    开发者
+     * 4    关键词屏蔽    关键词屏蔽,修改关键词后重试    开发者
+     * 5    未找到对应id的模板    模板id不存在或者已经删除    开发者
+     * 6    添加模板失败    模板有一定的规范,按失败提示修改    开发者
+     * 7    模板不可用    审核状态的模板和审核未通过的模板不可用    开发者
+     * 8    同一手机号30秒内重复提交相同的内容    请检查是否同一手机号在30秒内重复提交相同的内容    开发者
+     * 9    同一手机号5分钟内重复提交相同的内容超过3次    为避免重复发送骚扰用户,同一手机号5分钟内相同内容最多允许发3次    开发者
+     * 10    手机号黑名单过滤    手机号在黑名单列表中(你可以把不想发送的手机号添加到黑名单列表)    开发者
+     * 11    接口不支持GET方式调用    接口不支持GET方式调用,请按提示或者文档说明的方法调用,一般为POST    开发者
+     * 12    接口不支持POST方式调用    接口不支持POST方式调用,请按提示或者文档说明的方法调用,一般为GET    开发者
+     * 13    营销短信暂停发送    由于运营商管制,营销短信暂时不能发送    开发者
+     * 14    解码失败    请确认内容编码是否设置正确    开发者
+     * 15    签名不匹配    短信签名与预设的固定签名不匹配    开发者
+     * 16    签名格式不正确    短信内容不能包含多个签名【 】符号    开发者
+     * 17    24小时内同一手机号发送次数超过限制    请检查程序是否有异常或者系统是否被恶意攻击    开发者
+     * -1    非法的apikey    apikey不正确或没有授权    开发者
+     * -2    API没有权限    用户没有对应的API权限    开发者
+     * -3    IP没有权限    访问IP不在白名单之内,可在后台"账户设置->IP白名单设置"里添加该IP    开发者
+     * -4    访问次数超限    调整访问频率或者申请更高的调用量    开发者
+     * -5    访问频率超限    短期内访问过于频繁,请降低访问频率    开发者
+     * -50 未知异常    系统出现未知的异常情况    技术支持
+     * -51 系统繁忙    系统繁忙,请稍后重试    技术支持
+     * -52 充值失败    充值时系统出错    技术支持
+     * -53 提交短信失败    提交短信时系统出错    技术支持
+     * -54 记录已存在    常见于插入键值已存在的记录    技术支持
+     * -55 记录不存在    没有找到预期中的数据    技术支持
+     * -57 用户开通过固定签名功能,但签名未设置    联系客服或技术支持设置固定签名    技术支持
+     * @return bool|string
      */
-    private function mysend_yunpian($mobile,$content) {
-		$yunpian='yunpian';
-		$plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '',$yunpian)));
+    private function mysend_yunpian($mobile, $content)
+    {
+        $yunpian = 'yunpian';
+        $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $yunpian)));
         if (!empty($plugin)) {
-            define('PLUGIN_ROOT', BASE_DATA_PATH . DS .'api/smsapi');
+            define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
             require_once(PLUGIN_ROOT . DS . $plugin . DS . 'Send.php');
             return send_sms($content, $mobile);
+        } else {
+            return false;
         }
-		else
-		{
-			return false;
-		}
     }
-	
-   
+
+    protected function send_yunpian($mobile, $content)
+    {
+        $code = $content['code'];
+        //$time = $content['time'];
+        $type = intval($content['type']);
+
+        static $templates = array(self::register_code => '1382929', self::resetpass_code => '1386969', self::getbonus_code => '1386979', self::getbind_code => '1382929');
+        if (!array_key_exists($type, $templates)) return -1;
+
+        return $this->tpl_send_sms($mobile, $code, $templates[$type]);
+    }
+
+
+    protected function tpl_send_sms($mobile, $tpl_value, $tpl_id)
+    {
+        $yunpian = 'yunpian';
+        $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $yunpian)));
+        Log::record("SMS yunpian send:{$mobile} {$tpl_value} {$tpl_id}", Log::DEBUG);
+
+        if (!empty($plugin)) {
+            $plugin_root = BASE_DATA_PATH . DS . 'api/smsapi';
+            require_once($plugin_root . DS . $plugin . DS . 'Send.php');
+
+            return tpl_send_sms($tpl_id, $tpl_value, $mobile);
+        } else {
+
+            return false;
+        }
+    }
+
+
 }

+ 0 - 26
crontab/control/testpush.php

@@ -1,26 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: zry
- * Date: 2016/5/9
- * Time: 12:55
- */
-defined('InShopNC') or exit('Access Invalid!');
-ini_set('default_socket_timeout', -1);
-
-class testpushControl extends BaseCronControl
-{
-
-    public function indexOp() {
-        if (ob_get_level()) ob_end_clean();
-
-        $param = array(
-            'member_id'=>'36489',
-            'text'     =>'Helloworld',
-            'go_type'  =>'bonus',
-        );
-
-        QueueClient::push('upushSendMsg',$param);
-
-    }
-}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 934 - 0
data/api/smsapi/yunpian/README.html


+ 12 - 46
data/api/smsapi/yunpian/Send.php

@@ -1,66 +1,32 @@
 <?php
 defined('InShopNC') or exit('Access Invalid!');
-
-require_once(dirname(__FILE__) . DS . 'lib/HttpClient.class.php');
-require_once(dirname(__FILE__) . DS . 'config.inc.php');
-
-$GLOBALS['sms_options'] = $options;
+require_once(dirname(__FILE__) . DS . 'YunpianAutoload.php');
 
 /**
 * 模板接口发短信
-* apikey 为云片分配的apikey
 * tpl_id 为模板id
 * tpl_value 为模板值
 * mobile 为接收短信的手机号
 */
 function tpl_send_sms($tpl_id, $tpl_value, $mobile){
-	$path = "/v1/sms/tpl_send.json";
-	return Send::sendSms($path, $GLOBALS['sms_options']['apikey'], $mobile, $tpl_id, $tpl_value);
+	$smsOperator = new SmsOperator();
+	$data['mobile'] = $mobile;
+    $data['tpl_id'] = $tpl_id;
+	$data['tpl_value'] = urlencode("#code#") . "=" . urlencode($tpl_value) ;
+
+	return $smsOperator->tpl_send($data);
 }
 
 /**
 * 普通接口发短信
-* apikey 为云片分配的apikey
-* text 为短信内容
+* content 为短信内容
 * mobile 为接收短信的手机号
 */
 function send_sms($content, $mobile){
-	$path = "/v1/sms/send.json";
-	return Send::sendSms($path, $GLOBALS['sms_options']['apikey'], str_replace(C('site_name'), $GLOBALS['sms_options']['signature'], $content), $mobile);
-}
+	$smsOperator = new SmsOperator();
+	$data['mobile'] = $mobile;
+	$data['text'] = $content;
 
-class Send {
-
-	const HOST = 'yunpian.com';
-
-	final private static function __replyResult($jsonStr) {
-		//header("Content-type: text/html; charset=utf-8");
-		$result = json_decode($jsonStr);
-		if ($result->code == 0) {
-			$data['state'] = 'true';
-			return ture;
-		} else {
-			$data['state'] = 'false';
-			$data['msg'] = $result->msg;
-			return false;
-		}
-	}
-
-	final public static function sendSms($path, $apikey, $encoded_text, $mobile, $tpl_id = '', $encoded_tpl_value = '') {
-		$client = new HttpClient(self::HOST);
-		$client->setDebug(false);
-		if (!$client->post($path, array (
-				'apikey' 		=> $apikey,
-				'text' 			=> $encoded_text,
-				'mobile' 		=> $mobile,
-				'tpl_id' 		=> $tpl_id,
-				'tpl_value' 	=> $encoded_tpl_value
-		))) {
-			return '-10000';
-		} else {
-			return self::__replyResult($client->getContent());
-		}
-	}
+	return $smsOperator->single_send($data);
 }
-
 ?>

+ 30 - 0
data/api/smsapi/yunpian/YunpianAutoload.php

@@ -0,0 +1,30 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/20
+ * Time: 上午10:20
+ */
+require_once(dirname(__FILE__) . DS . 'config.php');
+function YAutoload($classname)
+{
+    $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib/'. $classname . '.php';
+    echo $filename;
+    if (is_readable($filename)) {
+        require $filename;
+    }
+}
+
+if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
+    if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+        spl_autoload_register('YAutoload', true, true);
+    } else {
+        spl_autoload_register('YAutoload');
+    }
+} else {
+    function __autoload($classname)
+    {
+        YAutoload($classname);
+    }
+}
+?>

+ 0 - 10
data/api/smsapi/yunpian/config.inc.php

@@ -1,10 +0,0 @@
-<?php
-defined('InShopNC') or exit('Access Invalid!');
-/*
- * 配置文件 好商城V3
- */
-$options = array();
-$options['apikey'] = C('mobile_key'); //apikey
-$options['signature'] =  C('mobile_signature'); //签名
-return $options;
-?>

+ 57 - 0
data/api/smsapi/yunpian/config.php

@@ -0,0 +1,57 @@
+<?php
+/*
+ * config file
+ */
+//You can get the APIKEY and APISECRET from http://www.yunpian.com/ when log on.
+
+$yunpian_config = array();
+$yunpian_config['APIKEY'] = "ec9c15640fe9997720c70b1ad828fa49";
+
+// php sdk 暂不支持加密算法
+$yunpian_config['API_SECRET'] = "229d68d3";
+
+//System
+$yunpian_config['SMS_HOST'] = 'https://sms.yunpian.com';
+$yunpian_config['VOICE_HOST'] = 'https://voice.yunpian.com';
+$yunpian_config['FLOW_HOST'] = 'https://flow.yunpian.com';
+$yunpian_config['VERSION'] = '/v1';
+
+// retry times
+$yunpian_config['RETRY_TIMES'] = 3;
+// 短信
+$yunpian_config['URI_SEND_SINGLE_SMS'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/sms/single_send.json";
+$yunpian_config['URI_SEND_BATCH_SMS'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/sms/batch_send.json";
+$yunpian_config['URI_SEND_MULTI_SMS'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/sms/multi_send.json";
+$yunpian_config['URI_SEND_TPL_SMS'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . '/sms/tpl_send.json';
+$yunpian_config['URI_PULL_SMS_STATUS'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/sms/pull_status.json";
+# 获取回复短信
+$yunpian_config['URI_PULL_SMS_REPLY'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/sms/pull_reply.json";
+# 查询回复短信
+$yunpian_config['URI_GET_SMS_REPLY'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/sms/get_reply.json";
+# 查短信发送记录
+$yunpian_config['URI_GET_SMS_RECORD'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/sms/get_record.json";
+
+// 语音
+$yunpian_config['URI_SEND_VOICE_SMS'] = $yunpian_config['VOICE_HOST'] . $yunpian_config['VERSION'] . "/voice/send.json";
+$yunpian_config['URI_PULL_VOICE_STATUS'] = $yunpian_config['VOICE_HOST'] . $yunpian_config['VERSION'] . "/voice/pull_status.json";
+
+// 流量
+$yunpian_config['URI_GET_FLOW_PACKAGE'] = $yunpian_config['FLOW_HOST'] . $yunpian_config['VERSION'] . "/flow/get_package.json";
+$yunpian_config['URI_PULL_FLOW_STATUS'] = $yunpian_config['FLOW_HOST'] . $yunpian_config['VERSION'] . "/flow/pull_status.json";
+$yunpian_config['URI_RECHARGE_FLOW'] = $yunpian_config['FLOW_HOST'] . $yunpian_config['VERSION'] . "/flow/recharge.json";
+
+// 用户操作
+$yunpian_config['URI_GET_USER_INFO'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/user/get.json";
+$yunpian_config['URI_SET_USER_INFO'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/user/set.json";
+
+
+// 模板操作
+$yunpian_config['URI_GET_DEFAULT_TEMPLATE'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/tpl/get_default.json";
+$yunpian_config['URI_GET_TEMPLATE'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/tpl/get.json";
+$yunpian_config['URI_ADD_TEMPLATE'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/tpl/add.json";
+$yunpian_config['URI_UPD_TEMPLATE'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/tpl/update.json";
+$yunpian_config['URI_DEL_TEMPLATE'] = $yunpian_config['SMS_HOST'] . $yunpian_config['VERSION'] . "/tpl/del.json";
+$GLOBALS['YUNPIAN_CONFIG'] = $yunpian_config;
+
+//print_r($yunpian_config);
+?>

+ 26 - 0
data/api/smsapi/yunpian/lib/ArrayToObject.php

@@ -0,0 +1,26 @@
+<?php
+/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
+   Manual: http://scripts.incutio.com/httpclient/
+*/
+
+function arrayToObject($e){
+    if( gettype($e)!='array' ) return;
+    foreach($e as $k=>$v){
+        if( gettype($v)=='array' || getType($v)=='object' )
+            $e[$k]=(object)arrayToObject($v);
+    }
+    return (object)$e;
+}
+ 
+ 
+function objectToArray($e){
+    $e=(array)$e;
+    foreach($e as $k=>$v){
+        if( gettype($v)=='resource' ) return;
+        if( gettype($v)=='object' || gettype($v)=='array' )
+            $e[$k]=(array)objectToArray($v);
+    }
+    return $e;
+} 
+
+?>

+ 95 - 0
data/api/smsapi/yunpian/lib/EncryptUtil.php

@@ -0,0 +1,95 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/19
+ * Time: 下午6:18
+ */
+
+
+
+class EncryptUtil
+{
+    public static function encryptForYunpian($msg, $key)
+    {
+        $key = EncryptUtil::getTeaKey($key);
+        $info=EncryptUtil::getBytes($msg);
+        $retLen = count($info) + 8 - count($info) % 8;
+
+    }
+    public static function encrypt($content, $offset, $key, $times){
+        $tempInt=EncryptUtil::bytesToInteger($content,$offset);
+        $y=$tempInt[0];
+        $z=$tempInt[1];
+        $sum=0;
+        $a=$key[0];$b=$key[1];$c=$key[2];$d=$key[3];
+        $delta=0x9e3779b9;
+        for ($i = 0; $i < $times; $i++) {
+            $sum += $delta;
+            $y += (($z<<4) + $a) ^ ($z + $sum) ^ (($z>>5) + $b);
+            $z += (($y<<4) + $c) ^ ($y + $sum) ^ (($y>>5) + $d);
+        }
+        $tempInt[0]=$y;
+        $tempInt[1]=$z;
+        return EncryptUtil::integerToBytes($tempInt, 0);
+
+
+    }
+    public static function decrypt($bytes){
+
+    }
+    public static function bytesToInteger($bytes, $position) {
+        $val = 0;
+        $val = $bytes[$position + 3] & 0xff;
+        $val <<= 8;
+        $val |= $bytes[$position + 2] & 0xff;
+        $val <<= 8;
+        $val |= $bytes[$position + 1] & 0xff;
+        $val <<= 8;
+        $val |= $bytes[$position] & 0xff;
+        return $val;
+    }
+    public static function integerToBytes($val) {
+        $byt = array();
+        $byt[0] = ($val & 0xff);
+        $byt[1] = ($val >> 8 & 0xff);
+        $byt[2] = ($val >> 16 & 0xff);
+        $byt[3] = ($val >> 24 & 0xff);
+        return $byt;
+    }
+
+
+    public static function getBytes($string)
+    {
+        $bytes = array();
+        for ($i = 0; $i < strlen($string); $i++) {
+            $bytes[] = ord($string[$i]);
+        }
+        return $bytes;
+    }
+
+    public static function getTeaKey($key)
+    {
+        $ints = array();
+        $ints[0] = intval(substr($key, 0, 8),16);
+        $ints[1] = intval(substr($key, 8, 8),16);
+        $ints[2] = intval(substr($key, 16, 8),16);
+        $ints[3] = intval(substr($key, 24, 8),16);
+        return $ints;
+
+    }
+    public static function strToHex($string)//字符串转十六进制
+    {
+        $hex = "";
+        for ($i = 0; $i < strlen($string); $i++)
+            $hex .= dechex(ord($string[$i]));
+        $hex = strtoupper($hex);
+        return $hex;
+    }
+
+
+
+}
+
+print_r(EncryptUtil::getTeaKey("12345678123456781234567812345678"));
+print_r(ord('a'));

+ 54 - 0
data/api/smsapi/yunpian/lib/FlowOperator.php

@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/19
+ * Time: 下午5:42
+ */
+class FlowOperator
+{
+    public $apikey;
+    public $api_secret;
+    public $yunpian_config;
+
+    public function __construct($apikey = null, $api_secret = null)
+    {
+        $this->yunpian_config = $GLOBALS['YUNPIAN_CONFIG'];
+        if ($api_secret == null)
+            $this->api_secret = $this->yunpian_config['API_SECRET'];
+        else
+            $this->api_secret = $apikey;
+        if ($apikey == null)
+            $this->apikey = $this->yunpian_config['APIKEY'];
+        else
+            $this->apikey = $api_secret;
+    }
+
+    public function encrypt(&$data)
+    {
+
+    }
+
+    public function get_package($data=array())
+    {
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_GET_FLOW_PACKAGE'], $data);
+    }
+
+    public function pull_status($data=array())
+    {
+        $data['apikey'] = $this->apikey;
+        return HttpUtil::PostCURL($this->yunpian_config['URI_PULL_FLOW_STATUS'], $data);
+    }
+
+    public function recharge($data=array())
+    {
+        if (!array_key_exists('mobile', $data))
+            return new Result(null,$data,null,$error = 'mobile 为空');
+
+        $data['apikey'] = $this->apikey;
+        return HttpUtil::PostCURL($this->yunpian_config['URI_RECHARGE_FLOW'], $data);
+    }
+}

+ 337 - 338
data/api/smsapi/yunpian/lib/HttpClient.class.php

@@ -1,339 +1,338 @@
-<?php
-defined('InShopNC') or exit('Access Invalid!');
-/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
-   Manual: http://scripts.incutio.com/httpclient/
-*/
-
-class HttpClient {
-    // Request vars
-    var $host;
-    var $port;
-    var $path;
-    var $method;
-    var $postdata = '';
-    var $cookies = array();
-    var $referer;
-    var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
-    var $accept_encoding = 'gzip';
-    var $accept_language = 'en-us';
-    var $user_agent = 'Incutio HttpClient v0.9';
-    // Options
-    var $timeout = 20;
-    var $use_gzip = true;
-    var $persist_cookies = true;  // If true, received cookies are placed in the $this->cookies array ready for the next request
-                                  // Note: This currently ignores the cookie path (and time) completely. Time is not important, 
-                                  //       but path could possibly lead to security problems.
-    var $persist_referers = true; // For each request, sends path of last request as referer
-    var $debug = false;
-    var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
-    var $max_redirects = 5;
-    var $headers_only = false;    // If true, stops receiving once headers have been read.
-    // Basic authorization variables
-    var $username;
-    var $password;
-    // Response vars
-    var $status;
-    var $headers = array();
-    var $content = '';
-    var $errormsg;
-    // Tracker variables
-    var $redirect_count = 0;
-    var $cookie_host = '';
-    function HttpClient($host, $port=80) {
-        $this->host = $host;
-        $this->port = $port;
-    }
-    function get($path, $data = false) {
-        $this->path = $path;
-        $this->method = 'GET';
-        if ($data) {
-            $this->path .= '?'.$this->buildQueryString($data);
-        }
-        return $this->doRequest();
-    }
-    function post($path, $data) {
-        $this->path = $path;
-        $this->method = 'POST';
-        $this->postdata = $this->buildQueryString($data);
-        return $this->doRequest();
-    }
-    function buildQueryString($data) {
-        $querystring = '';
-        if (is_array($data)) {
-            // Change data in to postable data
-            foreach ($data as $key => $val) {
-                if (is_array($val)) {
-                    foreach ($val as $val2) {
-                        $querystring .= urlencode($key).'='.urlencode($val2).'&';
-                    }
-                } else {
-                    $querystring .= urlencode($key).'='.urlencode($val).'&';
-                }
-            }
-            $querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
-        } else {
-            $querystring = $data;
-        }
-        return $querystring;
-    }
-    function doRequest() {
-        // Performs the actual HTTP request, returning true or false depending on outcome
-        if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) {
-            // Set error message
-            switch($errno) {
-                case -3:
-                    $this->errormsg = 'Socket creation failed (-3)';
-                case -4:
-                    $this->errormsg = 'DNS lookup failure (-4)';
-                case -5:
-                    $this->errormsg = 'Connection refused or timed out (-5)';
-                default:
-                    $this->errormsg = 'Connection failed ('.$errno.')';
-                $this->errormsg .= ' '.$errstr;
-                $this->debug($this->errormsg);
-            }
-            return false;
-        }
-        socket_set_timeout($fp, $this->timeout);
-        $request = $this->buildRequest();
-        $this->debug('Request', $request);
-        fwrite($fp, $request);
-        // Reset all the variables that should not persist between requests
-        $this->headers = array();
-        $this->content = '';
-        $this->errormsg = '';
-        // Set a couple of flags
-        $inHeaders = true;
-        $atStart = true;
-        // Now start reading back the response
-        while (!feof($fp)) {
-            $line = fgets($fp, 4096);
-            if ($atStart) {
-                // Deal with first line of returned data
-                $atStart = false;
-                if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
-                    $this->errormsg = "Status code line invalid: ".htmlentities($line);
-                    $this->debug($this->errormsg);
-                    return false;
-                }
-                $http_version = $m[1]; // not used
-                $this->status = $m[2];
-                $status_string = $m[3]; // not used
-                $this->debug(trim($line));
-                continue;
-            }
-            if ($inHeaders) {
-                if (trim($line) == '') {
-                    $inHeaders = false;
-                    $this->debug('Received Headers', $this->headers);
-                    if ($this->headers_only) {
-                        break; // Skip the rest of the input
-                    }
-                    continue;
-                }
-                if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
-                    // Skip to the next header
-                    continue;
-                }
-                $key = strtolower(trim($m[1]));
-                $val = trim($m[2]);
-                // Deal with the possibility of multiple headers of same name
-                if (isset($this->headers[$key])) {
-                    if (is_array($this->headers[$key])) {
-                        $this->headers[$key][] = $val;
-                    } else {
-                        $this->headers[$key] = array($this->headers[$key], $val);
-                    }
-                } else {
-                    $this->headers[$key] = $val;
-                }
-                continue;
-            }
-            // We're not in the headers, so append the line to the contents
-            $this->content .= $line;
-        }
-        fclose($fp);
-        // If data is compressed, uncompress it
-        if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
-            $this->debug('Content is gzip encoded, unzipping it');
-            $this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
-            $this->content = gzinflate($this->content);
-        }
-        // If $persist_cookies, deal with any cookies
-        if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
-            $cookies = $this->headers['set-cookie'];
-            if (!is_array($cookies)) {
-                $cookies = array($cookies);
-            }
-            foreach ($cookies as $cookie) {
-                if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
-                    $this->cookies[$m[1]] = $m[2];
-                }
-            }
-            // Record domain of cookies for security reasons
-            $this->cookie_host = $this->host;
-        }
-        // If $persist_referers, set the referer ready for the next request
-        if ($this->persist_referers) {
-            $this->debug('Persisting referer: '.$this->getRequestURL());
-            $this->referer = $this->getRequestURL();
-        }
-        // Finally, if handle_redirects and a redirect is sent, do that
-        if ($this->handle_redirects) {
-            if (++$this->redirect_count >= $this->max_redirects) {
-                $this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
-                $this->debug($this->errormsg);
-                $this->redirect_count = 0;
-                return false;
-            }
-            $location = isset($this->headers['location']) ? $this->headers['location'] : '';
-            $uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
-            if ($location || $uri) {
-                $url = parse_url($location.$uri);
-                // This will FAIL if redirect is to a different site
-                return $this->get($url['path']);
-            }
-        }
-        return true;
-    }
-    function buildRequest() {
-        $headers = array();
-        $headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
-        $headers[] = "Host: {$this->host}";
-        $headers[] = "User-Agent: {$this->user_agent}";
-        $headers[] = "Accept: {$this->accept}";
-        if ($this->use_gzip) {
-            $headers[] = "Accept-encoding: {$this->accept_encoding}";
-        }
-        $headers[] = "Accept-language: {$this->accept_language}";
-        if ($this->referer) {
-            $headers[] = "Referer: {$this->referer}";
-        }
-        // Cookies
-        if ($this->cookies) {
-            $cookie = 'Cookie: ';
-            foreach ($this->cookies as $key => $value) {
-                $cookie .= "$key=$value; ";
-            }
-            $headers[] = $cookie;
-        }
-        // Basic authentication
-        if ($this->username && $this->password) {
-            $headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
-        }
-        // If this is a POST, set the content type and length
-        if ($this->postdata) {
-            $headers[] = 'Content-Type: application/x-www-form-urlencoded';
-            $headers[] = 'Content-Length: '.strlen($this->postdata);
-        }
-        $request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
-        return $request;
-    }
-    function getStatus() {
-        return $this->status;
-    }
-    function getContent() {
-        return $this->content;
-    }
-    function getHeaders() {
-        return $this->headers;
-    }
-    function getHeader($header) {
-        $header = strtolower($header);
-        if (isset($this->headers[$header])) {
-            return $this->headers[$header];
-        } else {
-            return false;
-        }
-    }
-    function getError() {
-        return $this->errormsg;
-    }
-    function getCookies() {
-        return $this->cookies;
-    }
-    function getRequestURL() {
-        $url = 'http://'.$this->host;
-        if ($this->port != 80) {
-            $url .= ':'.$this->port;
-        }            
-        $url .= $this->path;
-        return $url;
-    }
-    // Setter methods
-    function setUserAgent($string) {
-        $this->user_agent = $string;
-    }
-    function setAuthorization($username, $password) {
-        $this->username = $username;
-        $this->password = $password;
-    }
-    function setCookies($array) {
-        $this->cookies = $array;
-    }
-    // Option setting methods
-    function useGzip($boolean) {
-        $this->use_gzip = $boolean;
-    }
-    function setPersistCookies($boolean) {
-        $this->persist_cookies = $boolean;
-    }
-    function setPersistReferers($boolean) {
-        $this->persist_referers = $boolean;
-    }
-    function setHandleRedirects($boolean) {
-        $this->handle_redirects = $boolean;
-    }
-    function setMaxRedirects($num) {
-        $this->max_redirects = $num;
-    }
-    function setHeadersOnly($boolean) {
-        $this->headers_only = $boolean;
-    }
-    function setDebug($boolean) {
-        $this->debug = $boolean;
-    }
-    // "Quick" static methods
-    function quickGet($url) {
-        $bits = parse_url($url);
-        $host = $bits['host'];
-        $port = isset($bits['port']) ? $bits['port'] : 80;
-        $path = isset($bits['path']) ? $bits['path'] : '/';
-        if (isset($bits['query'])) {
-            $path .= '?'.$bits['query'];
-        }
-        $client = new HttpClient($host, $port);
-        if (!$client->get($path)) {
-            return false;
-        } else {
-            return $client->getContent();
-        }
-    }
-    function quickPost($url, $data) {
-        $bits = parse_url($url);
-        $host = $bits['host'];
-        $port = isset($bits['port']) ? $bits['port'] : 80;
-        $path = isset($bits['path']) ? $bits['path'] : '/';
-        $client = new HttpClient($host, $port);
-        if (!$client->post($path, $data)) {
-            return false;
-        } else {
-            return $client->getContent();
-        }
-    }
-    function debug($msg, $object = false) {
-        if ($this->debug) {
-            print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg;
-            if ($object) {
-                ob_start();
-                print_r($object);
-                $content = htmlentities(ob_get_contents());
-                ob_end_clean();
-                print '<pre>'.$content.'</pre>';
-            }
-            print '</div>';
-        }
-    }   
-}
-
+<?php
+/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
+   Manual: http://scripts.incutio.com/httpclient/
+*/
+
+class HttpClient {
+    // Request vars
+    var $host;
+    var $port;
+    var $path;
+    var $method;
+    var $postdata = '';
+    var $cookies = array();
+    var $referer;
+    var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
+    var $accept_encoding = 'gzip';
+    var $accept_language = 'en-us';
+    var $user_agent = 'Incutio HttpClient v0.9';
+    // Options
+    var $timeout = 20;
+    var $use_gzip = true;
+    var $persist_cookies = true;  // If true, received cookies are placed in the $this->cookies array ready for the next request
+                                  // Note: This currently ignores the cookie path (and time) completely. Time is not important, 
+                                  //       but path could possibly lead to security problems.
+    var $persist_referers = true; // For each request, sends path of last request as referer
+    var $debug = false;
+    var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
+    var $max_redirects = 5;
+    var $headers_only = false;    // If true, stops receiving once headers have been read.
+    // Basic authorization variables
+    var $username;
+    var $password;
+    // Response vars
+    var $status;
+    var $headers = array();
+    var $content = '';
+    var $errormsg;
+    // Tracker variables
+    var $redirect_count = 0;
+    var $cookie_host = '';
+    function HttpClient($host, $port=80) {
+        $this->host = $host;
+        $this->port = $port;
+    }
+    function get($path, $data = false) {
+        $this->path = $path;
+        $this->method = 'GET';
+        if ($data) {
+            $this->path .= '?'.$this->buildQueryString($data);
+        }
+        return $this->doRequest();
+    }
+    function post($path, $data) {
+        $this->path = $path;
+        $this->method = 'POST';
+        $this->postdata = $this->buildQueryString($data);
+        return $this->doRequest();
+    }
+    function buildQueryString($data) {
+        $querystring = '';
+        if (is_array($data)) {
+            // Change data in to postable data
+            foreach ($data as $key => $val) {
+                if (is_array($val)) {
+                    foreach ($val as $val2) {
+                        $querystring .= urlencode($key).'='.urlencode($val2).'&';
+                    }
+                } else {
+                    $querystring .= urlencode($key).'='.urlencode($val).'&';
+                }
+            }
+            $querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
+        } else {
+            $querystring = $data;
+        }
+        return $querystring;
+    }
+    function doRequest() {
+        // Performs the actual HTTP request, returning true or false depending on outcome
+        if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) {
+            // Set error message
+            switch($errno) {
+                case -3:
+                    $this->errormsg = 'Socket creation failed (-3)';
+                case -4:
+                    $this->errormsg = 'DNS lookup failure (-4)';
+                case -5:
+                    $this->errormsg = 'Connection refused or timed out (-5)';
+                default:
+                    $this->errormsg = 'Connection failed ('.$errno.')';
+                $this->errormsg .= ' '.$errstr;
+                $this->debug($this->errormsg);
+            }
+            return false;
+        }
+        socket_set_timeout($fp, $this->timeout);
+        $request = $this->buildRequest();
+        $this->debug('Request', $request);
+        fwrite($fp, $request);
+        // Reset all the variables that should not persist between requests
+        $this->headers = array();
+        $this->content = '';
+        $this->errormsg = '';
+        // Set a couple of flags
+        $inHeaders = true;
+        $atStart = true;
+        // Now start reading back the response
+        while (!feof($fp)) {
+            $line = fgets($fp, 4096);
+            if ($atStart) {
+                // Deal with first line of returned data
+                $atStart = false;
+                if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
+                    $this->errormsg = "Status code line invalid: ".htmlentities($line);
+                    $this->debug($this->errormsg);
+                    return false;
+                }
+                $http_version = $m[1]; // not used
+                $this->status = $m[2];
+                $status_string = $m[3]; // not used
+                $this->debug(trim($line));
+                continue;
+            }
+            if ($inHeaders) {
+                if (trim($line) == '') {
+                    $inHeaders = false;
+                    $this->debug('Received Headers', $this->headers);
+                    if ($this->headers_only) {
+                        break; // Skip the rest of the input
+                    }
+                    continue;
+                }
+                if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
+                    // Skip to the next header
+                    continue;
+                }
+                $key = strtolower(trim($m[1]));
+                $val = trim($m[2]);
+                // Deal with the possibility of multiple headers of same name
+                if (isset($this->headers[$key])) {
+                    if (is_array($this->headers[$key])) {
+                        $this->headers[$key][] = $val;
+                    } else {
+                        $this->headers[$key] = array($this->headers[$key], $val);
+                    }
+                } else {
+                    $this->headers[$key] = $val;
+                }
+                continue;
+            }
+            // We're not in the headers, so append the line to the contents
+            $this->content .= $line;
+        }
+        fclose($fp);
+        // If data is compressed, uncompress it
+        if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
+            $this->debug('Content is gzip encoded, unzipping it');
+            $this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
+            $this->content = gzinflate($this->content);
+        }
+        // If $persist_cookies, deal with any cookies
+        if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
+            $cookies = $this->headers['set-cookie'];
+            if (!is_array($cookies)) {
+                $cookies = array($cookies);
+            }
+            foreach ($cookies as $cookie) {
+                if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
+                    $this->cookies[$m[1]] = $m[2];
+                }
+            }
+            // Record model of cookies for security reasons
+            $this->cookie_host = $this->host;
+        }
+        // If $persist_referers, set the referer ready for the next request
+        if ($this->persist_referers) {
+            $this->debug('Persisting referer: '.$this->getRequestURL());
+            $this->referer = $this->getRequestURL();
+        }
+        // Finally, if handle_redirects and a redirect is sent, do that
+        if ($this->handle_redirects) {
+            if (++$this->redirect_count >= $this->max_redirects) {
+                $this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
+                $this->debug($this->errormsg);
+                $this->redirect_count = 0;
+                return false;
+            }
+            $location = isset($this->headers['location']) ? $this->headers['location'] : '';
+            $uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
+            if ($location || $uri) {
+                $url = parse_url($location.$uri);
+                // This will FAIL if redirect is to a different site
+                return $this->get($url['path']);
+            }
+        }
+        return true;
+    }
+    function buildRequest() {
+        $headers = array();
+        $headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
+        $headers[] = "Host: {$this->host}";
+        $headers[] = "User-Agent: {$this->user_agent}";
+        $headers[] = "Accept: {$this->accept}";
+        if ($this->use_gzip) {
+            $headers[] = "Accept-encoding: {$this->accept_encoding}";
+        }
+        $headers[] = "Accept-language: {$this->accept_language}";
+        if ($this->referer) {
+            $headers[] = "Referer: {$this->referer}";
+        }
+        // Cookies
+        if ($this->cookies) {
+            $cookie = 'Cookie: ';
+            foreach ($this->cookies as $key => $value) {
+                $cookie .= "$key=$value; ";
+            }
+            $headers[] = $cookie;
+        }
+        // Basic authentication
+        if ($this->username && $this->password) {
+            $headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
+        }
+        // If this is a POST, set the content type and length
+        if ($this->postdata) {
+            $headers[] = 'Content-Type: application/x-www-form-urlencoded';
+            $headers[] = 'Content-Length: '.strlen($this->postdata);
+        }
+        $request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
+        return $request;
+    }
+    function getStatus() {
+        return $this->status;
+    }
+    function getContent() {
+        return $this->content;
+    }
+    function getHeaders() {
+        return $this->headers;
+    }
+    function getHeader($header) {
+        $header = strtolower($header);
+        if (isset($this->headers[$header])) {
+            return $this->headers[$header];
+        } else {
+            return false;
+        }
+    }
+    function getError() {
+        return $this->errormsg;
+    }
+    function getCookies() {
+        return $this->cookies;
+    }
+    function getRequestURL() {
+        $url = 'http://'.$this->host;
+        if ($this->port != 80) {
+            $url .= ':'.$this->port;
+        }            
+        $url .= $this->path;
+        return $url;
+    }
+    // Setter methods
+    function setUserAgent($string) {
+        $this->user_agent = $string;
+    }
+    function setAuthorization($username, $password) {
+        $this->username = $username;
+        $this->password = $password;
+    }
+    function setCookies($array) {
+        $this->cookies = $array;
+    }
+    // Option setting methods
+    function useGzip($boolean) {
+        $this->use_gzip = $boolean;
+    }
+    function setPersistCookies($boolean) {
+        $this->persist_cookies = $boolean;
+    }
+    function setPersistReferers($boolean) {
+        $this->persist_referers = $boolean;
+    }
+    function setHandleRedirects($boolean) {
+        $this->handle_redirects = $boolean;
+    }
+    function setMaxRedirects($num) {
+        $this->max_redirects = $num;
+    }
+    function setHeadersOnly($boolean) {
+        $this->headers_only = $boolean;
+    }
+    function setDebug($boolean) {
+        $this->debug = $boolean;
+    }
+    // "Quick" static methods
+    function quickGet($url) {
+        $bits = parse_url($url);
+        $host = $bits['host'];
+        $port = isset($bits['port']) ? $bits['port'] : 80;
+        $path = isset($bits['path']) ? $bits['path'] : '/';
+        if (isset($bits['query'])) {
+            $path .= '?'.$bits['query'];
+        }
+        $client = new HttpClient($host, $port);
+        if (!$client->get($path)) {
+            return false;
+        } else {
+            return $client->getContent();
+        }
+    }
+    function quickPost($url, $data) {
+        $bits = parse_url($url);
+        $host = $bits['host'];
+        $port = isset($bits['port']) ? $bits['port'] : 80;
+        $path = isset($bits['path']) ? $bits['path'] : '/';
+        $client = new HttpClient($host, $port);
+        if (!$client->post($path, $data)) {
+            return false;
+        } else {
+            return $client->getContent();
+        }
+    }
+    function debug($msg, $object = false) {
+        if ($this->debug) {
+            print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg;
+            if ($object) {
+                ob_start();
+                print_r($object);
+                $content = htmlentities(ob_get_contents());
+                ob_end_clean();
+                print '<pre>'.$content.'</pre>';
+            }
+            print '</div>';
+        }
+    }   
+}
+
 ?>

+ 50 - 0
data/api/smsapi/yunpian/lib/HttpUtil.php

@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/19
+ * Time: 下午3:39
+ */
+require_once('Result.php');
+class HttpUtil
+{
+    public static function PostCURL($url,$post_data){
+        $ch = curl_init();
+
+        /* 设置验证方式 */
+
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept:text/plain;charset=utf-8', 'Content-Type:application/x-www-form-urlencoded','charset=utf-8'));
+
+        /* 设置返回结果为流 */
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+        /* 设置超时时间*/
+        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
+
+        /* 设置通信方式 */
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+        curl_setopt ($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
+        $retry=0;
+        // 若执行失败则重试
+        do{
+            $output = curl_exec($ch);
+            $retry++;
+//            echo $retry."\n";
+        }while((curl_errno($ch) !== 0) && $retry<$GLOBALS['YUNPIAN_CONFIG']['RETRY_TIMES']);
+
+        if (curl_errno($ch) !== 0) {
+            $r = new Result(null, $post_data, null,curl_error($ch));
+            curl_close($ch);
+            return $r;
+        }
+        $output = trim($output, "\xEF\xBB\xBF");
+        $statusCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
+        $ret = new Result($statusCode,$post_data,json_decode($output,true),null);
+        curl_close($ch);
+        return $ret;
+    }
+}

+ 35 - 0
data/api/smsapi/yunpian/lib/Result.php

@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/19
+ * Time: 下午4:15
+ */
+
+class Result
+{
+    public $success;
+    public $statusCode;
+    public $requestData;
+    public $responseData;
+    public $error;
+    public function __construct($statusCode=null,$requestData = null, $responseData = null,$error=null )
+    {
+        $this->success = false;
+        if ($statusCode == 200)
+            $this->success = true;
+        $this->statusCode = $statusCode;
+        $this->requestData = $requestData;
+        $this->responseData = $responseData;
+        $this->error = $error;
+    }
+
+    public function getData()
+    {
+        return $this->responseData;
+    }
+    public function isSuccess(){
+        return $this->success;
+    }
+}

+ 88 - 0
data/api/smsapi/yunpian/lib/SmsOperator.php

@@ -0,0 +1,88 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/19
+ * Time: 下午5:42
+ */
+
+require_once('HttpUtil.php');
+
+class SmsOperator
+{
+    public $apikey;
+    public $api_secret;
+    public $yunpian_config;
+
+    public function __construct($apikey = null, $api_secret = null)
+    {
+        $this->yunpian_config = $GLOBALS['YUNPIAN_CONFIG'];
+        if ($api_secret == null)
+            $this->api_secret = $this->yunpian_config['API_SECRET'];
+        else
+            $this->api_secret = $apikey;
+        if ($apikey == null)
+            $this->apikey = $this->yunpian_config['APIKEY'];
+        else
+            $this->apikey = $api_secret;
+    }
+
+    public function encrypt(&$data)
+    {
+
+    }
+
+    public function single_send($data = array())
+    {
+        if (!array_key_exists('mobile', $data))
+            return new Result(null, $data, null, 'mobile 为空');
+        if (!array_key_exists('text', $data))
+            return new Result(null, $data, null, 'text 为空');
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_SEND_SINGLE_SMS'], $data);
+    }
+
+    public function batch_send($data = array())
+    {
+        if (!array_key_exists('mobile', $data))
+            return new Result(null, $data, null, $error = 'mobile 为空');
+        if (!array_key_exists('text', $data))
+            return new Result(null, $data, null, $error = 'text 为空');
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_SEND_BATCH_SMS'], $data);
+    }
+
+    public function multi_send($data = array())
+    {
+        if (!array_key_exists('mobile', $data))
+            return new Result(null, $data, null, $error = 'mobile 为空');
+        if (!array_key_exists('text', $data))
+            return new Result(null, $data, null, $error = 'text 为空');
+        if (count(explode(',', $data['mobile'])) != count(explode(',', $data['text'])))
+            return new Result(null, $data, null, $error = 'mobile 与 text 个数不匹配');
+        $data['apikey'] = $this->apikey;
+        $text_array = explode(',', $data['text']);
+        $data['text'] = '';
+        for ($index = 0; $index < count($text_array); $index++) {
+            $data['text'] .= urlencode($text_array[$index]) . ',';
+        }
+        $data['text'] = substr($data['text'],0,-1);
+        return HttpUtil::PostCURL($this->yunpian_config['URI_SEND_MULTI_SMS'], $data);
+    }
+
+    public function tpl_send($data = array())
+    {
+        if (!array_key_exists('mobile', $data))
+            return new Result(null, $data, null, 'mobile 为空');
+        if (!array_key_exists('tpl_id', $data))
+            return new Result(null, $data, null, 'tpl_id 为空');
+        if (!array_key_exists('tpl_value', $data))
+            return new Result(null, $data, null, 'tpl_value 为空');
+
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_SEND_TPL_SMS'], $data);
+    }
+}

+ 304 - 0
data/api/smsapi/yunpian/lib/TeaUtil.php

@@ -0,0 +1,304 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/19
+ * Time: 下午6:21
+ */
+
+
+$date = '';
+$key = '002d88e24fdaf41801d1d18ef8109996';
+$t = new TeaUtil ();
+$tea = $t->encrypt($date, $key);
+$eetea = $t->decrypt($tea, $key);
+print $eetea;
+var_dump(base64_encode($tea));
+var_dump($eetea);
+
+class TeaUtil
+{
+    public static function getBytes($string)
+    {
+        $bytes = array();
+        for ($i = 0; $i < strlen($string); $i++) {
+            $bytes[] = ord($string[$i]);
+        }
+        return $bytes;
+    }
+
+    private $a, $b, $c, $d;
+    private $n_iter;
+
+    public function __construct()
+    {
+        $this->setIter(32);
+    }
+
+    private function setIter($n_iter)
+    {
+        $this->n_iter = $n_iter;
+    }
+
+    private function getIter()
+    {
+        return $this->n_iter;
+    }
+
+    public function encrypt($data, $key)
+    {
+        // resize data to 32 bits (4 bytes)
+        $n = $this->_resize($data, 8);
+
+        // convert data to long
+        $data_long [0] = $n;
+        $n_data_long = $this->_str2long($n, $data, $data_long);
+
+        // resize data_long to 64 bits (2 longs of 32 bits)
+        $n = count($data_long);
+        if (($n & 1) == 1) {
+            $data_long [$n] = chr(0);
+            $n_data_long++;
+        }
+
+        // resize key to a multiple of 128 bits (16 bytes)
+        $this->_resize($key, 16, true);
+        if ('' == $key)
+            $key = '0000000000000000';
+
+        // convert key to long
+        $n_key_long = $this->_str2long(0, $key, $key_long);
+
+        // encrypt the long data with the key
+        $enc_data = '';
+        $w = array(0, 0);
+        $j = 0;
+        $k = array(0, 0, 0, 0);
+        for ($i = 0; $i < $n_data_long; ++$i) {
+            // get next key part of 128 bits
+            if ($j + 4 <= $n_key_long) {
+                $k [0] = $key_long [$j];
+                $k [1] = $key_long [$j + 1];
+                $k [2] = $key_long [$j + 2];
+                $k [3] = $key_long [$j + 3];
+            } else {
+                $k [0] = $key_long [$j % $n_key_long];
+                $k [1] = $key_long [($j + 1) % $n_key_long];
+                $k [2] = $key_long [($j + 2) % $n_key_long];
+                $k [3] = $key_long [($j + 3) % $n_key_long];
+            }
+            $j = ($j + 4) % $n_key_long;
+
+            $this->_encipherLong($data_long [$i], $data_long [++$i], $w, $k);
+
+            // append the enciphered longs to the result
+            $enc_data .= $this->_long2str($w [0]);
+            $enc_data .= $this->_long2str($w [1]);
+        }
+
+        return $enc_data;
+    }
+
+    public function decrypt($enc_data, $key)
+    {
+        // convert data to long
+        $n_enc_data_long = $this->_str2long(0, $enc_data, $enc_data_long);
+
+        // resize key to a multiple of 128 bits (16 bytes)
+        $this->_resize($key, 16, true);
+        if ('' == $key)
+            $key = '0000000000000000';
+
+        // convert key to long
+        $n_key_long = $this->_str2long(0, $key, $key_long);
+
+        // decrypt the long data with the key
+        $data = '';
+        $w = array(0, 0);
+        $j = 0;
+        $len = 0;
+        $k = array(0, 0, 0, 0);
+        $pos = 0;
+
+        for ($i = 0; $i < $n_enc_data_long; $i += 2) {
+            // get next key part of 128 bits
+            if ($j + 4 <= $n_key_long) {
+                $k [0] = $key_long [$j];
+                $k [1] = $key_long [$j + 1];
+                $k [2] = $key_long [$j + 2];
+                $k [3] = $key_long [$j + 3];
+            } else {
+                $k [0] = $key_long [$j % $n_key_long];
+                $k [1] = $key_long [($j + 1) % $n_key_long];
+                $k [2] = $key_long [($j + 2) % $n_key_long];
+                $k [3] = $key_long [($j + 3) % $n_key_long];
+            }
+            $j = ($j + 4) % $n_key_long;
+
+            $this->_decipherLong($enc_data_long [$i], $enc_data_long [$i + 1], $w, $k);
+
+            // append the deciphered longs to the result data (remove padding)
+            if (0 == $i) {
+                $len = $w [0];
+                if (4 <= $len) {
+                    $data .= $this->_long2str($w [1]);
+                } else {
+                    $data .= substr($this->_long2str($w [1]), 0, $len % 4);
+                }
+            } else {
+                $pos = ($i - 1) * 4;
+                if ($pos + 4 <= $len) {
+                    $data .= $this->_long2str($w [0]);
+
+                    if ($pos + 8 <= $len) {
+                        $data .= $this->_long2str($w [1]);
+                    } elseif ($pos + 4 < $len) {
+                        $data .= substr($this->_long2str($w [1]), 0, $len % 4);
+                    }
+                } else {
+                    $data .= substr($this->_long2str($w [0]), 0, $len % 4);
+                }
+            }
+        }
+        return $data;
+    }
+
+    private function _encipherLong($y, $z, &$w, &$k)
+    {
+        $sum = ( integer )0;
+        $delta = 0x9E3779B9;
+        $n = ( integer )$this->n_iter;
+
+        while ($n-- > 0) {
+            //C v0 += ((v1<<4) + k0) ^ (v1 + sum) ^ ((v1>>5) + k1);
+            //C v1 += ((v0<<4) + k2) ^ (v0 + sum) ^ ((v0>>5) + k3);
+            $sum = $this->_add($sum, $delta);
+            $y = $this->_add($y, $this->_add(($z << 4), $this->a) ^ $this->_add($z, $sum) ^ $this->_add($this->_rshift($z, 5), $this->b));
+            $z = $this->_add($z, $this->_add(($y << 4), $this->a) ^ $this->_add($y, $sum) ^ $this->_add($this->_rshift($y, 5), $this->b));
+        }
+
+        $w [0] = $y;
+        $w [1] = $z;
+    }
+
+    private function _decipherLong($y, $z, &$w, &$k)
+    {
+        // sum = delta<<5, in general sum = delta * n
+        $sum = 0xC6EF3720;
+        $delta = 0x9E3779B9;
+        $n = ( integer )$this->n_iter;
+
+        while ($n-- > 0) {
+            //C v1 -= ((v0<<4) + k2) ^ (v0 + sum) ^ ((v0>>5) + k3);
+            //C v0 -= ((v1<<4) + k0) ^ (v1 + sum) ^ ((v1>>5) + k1);
+            $z = $this->_add($z, -($this->_add(($y << 4), $this->a) ^ $this->_add($y, $sum) ^ $this->_add($this->_rshift($y, 5), $this->b)));
+            $y = $this->_add($y, -($this->_add(($z << 4), $this->a) ^ $this->_add($z, $sum) ^ $this->_add($this->_rshift($z, 5), $this->b)));
+            $sum = $this->_add($sum, -$delta);
+        }
+
+        $w [0] = $y;
+        $w [1] = $z;
+    }
+
+    private function _resize(&$data, $size, $nonull = false)
+    {
+        $n = strlen($data);
+        $nmod = $n % $size;
+        if (0 == $nmod)
+            $nmod = $size;
+
+        if ($nmod > 0) {
+            if ($nonull) {
+                for ($i = $n; $i < $n - $nmod + $size; ++$i) {
+                    $data [$i] = $data [$i % $n];
+                }
+            } else {
+                for ($i = $n; $i < $n - $nmod + $size; ++$i) {
+                    $data [$i] = chr(0);
+                }
+            }
+        }
+        return 8-$nmod;
+    }
+
+    private function _hex2bin($str)
+    {
+        $len = strlen($str);
+        return pack('H' . $len, $str);
+    }
+
+    private function _str2long($start, &$data, &$data_long)
+    {
+        $n = strlen($data);
+
+        $tmp = unpack('N*', $data);
+        $j = $start;
+
+        foreach ($tmp as $value)
+            $data_long [$j++] = $value;
+
+        return $j;
+    }
+
+    private function _long2str($l)
+    {
+        return pack('N', $l);
+    }
+
+
+    private function _rshift($integer, $n)
+    {
+        // convert to 32 bits
+        if (0xffffffff < $integer || -0xffffffff > $integer) {
+            $integer = fmod($integer, 0xffffffff + 1);
+        }
+
+        // convert to unsigned integer
+        if (0x7fffffff < $integer) {
+            $integer -= 0xffffffff + 1.0;
+        } elseif (-0x80000000 > $integer) {
+            $integer += 0xffffffff + 1.0;
+        }
+
+        // do right shift
+        if (0 > $integer) {
+            $integer &= 0x7fffffff; // remove sign bit before shift
+            $integer >>= $n; // right shift
+            $integer |= 1 << (31 - $n); // set shifted sign bit
+        } else {
+            $integer >>= $n; // use normal right shift
+        }
+
+        return $integer;
+    }
+
+    private function _add($i1, $i2)
+    {
+        $result = 0.0;
+
+        foreach (func_get_args() as $value) {
+            // remove sign if necessary
+            if (0.0 > $value) {
+                $value -= 1.0 + 0xffffffff;
+            }
+
+            $result += $value;
+        }
+
+        // convert to 32 bits
+        if (0xffffffff < $result || -0xffffffff > $result) {
+            $result = fmod($result, 0xffffffff + 1);
+        }
+
+        // convert to signed integer
+        if (0x7fffffff < $result) {
+            $result -= 0xffffffff + 1.0;
+        } elseif (-0x80000000 > $result) {
+            $result += 0xffffffff + 1.0;
+        }
+
+        return $result;
+    }
+}
+
+?>

+ 75 - 0
data/api/smsapi/yunpian/lib/TplOperator.php

@@ -0,0 +1,75 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/20
+ * Time: 上午10:37
+ */
+require_once 'HttpUtil.php';
+
+class TplOperator
+{
+    public $apikey;
+    public $api_secret;
+    public $yunpian_config;
+
+    public function __construct($apikey = null, $api_secret = null)
+    {
+        $this->yunpian_config = $GLOBALS['YUNPIAN_CONFIG'];
+        if ($api_secret == null)
+            $this->api_secret = $this->yunpian_config['API_SECRET'];
+        else
+            $this->api_secret = $apikey;
+        if ($apikey == null)
+            $this->apikey = $this->yunpian_config['APIKEY'];
+        else
+            $this->apikey = $api_secret;
+    }
+
+    public function encrypt(&$data)
+    {
+
+    }
+    public function get_default($data = array())
+    {
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_GET_DEFAULT_TEMPLATE'], $data);
+    }
+    public function get($data = array())
+    {
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_GET_TEMPLATE'], $data);
+    }
+
+    public function add($data = array())
+    {
+        if (!array_key_exists('tpl_id',$data))
+            return new Result(null,$data,null,$error = 'tpl_id 为空');
+        if (!array_key_exists('tpl_content',$data))
+            return new Result(null,$data,null,$error = 'tpl_content 为空');
+        $data['apikey'] = $this->apikey;
+        return HttpUtil::PostCURL($this->yunpian_config['URI_ADD_TEMPLATE'], $data);
+    }
+
+    public function upd($data = array())
+    {
+        if (!array_key_exists('tpl_id',$data))
+            return new Result(null,$data,null,$error = 'tpl_id 为空');
+        if (!array_key_exists('tpl_content',$data))
+            return new Result(null,$data,null,$error = 'tpl_content 为空');
+        $data['apikey'] = $this->apikey;
+        return HttpUtil::PostCURL($this->yunpian_config['URI_UPD_TEMPLATE'], $data);
+    }
+
+    public function del($data = array())
+    {
+        if (!array_key_exists('tpl_id',$data))
+            return new Result(null,$data,null,$error = 'tpl_id 为空');
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_DEL_TEMPLATE'], $data);
+    }
+
+}

+ 42 - 0
data/api/smsapi/yunpian/lib/UserOperator.php

@@ -0,0 +1,42 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/20
+ * Time: 上午10:11
+ */
+
+//namespace Yunpian\lib;
+
+require_once 'HttpUtil.php';
+class UserOperator
+{
+    public $apikey;
+    public $api_secret;
+    public $yunpian_config;
+    public function __construct($apikey=null,$api_secret=null)
+    {
+        $this->yunpian_config = $GLOBALS['YUNPIAN_CONFIG'];
+        if($api_secret == null)
+            $this->api_secret = $this->yunpian_config['API_SECRET'];
+        else
+            $this->api_secret = $apikey;
+        if($apikey == null)
+            $this->apikey = $this->yunpian_config['APIKEY'];
+        else
+            $this->apikey = $api_secret;
+    }
+    public function encrypt(&$data){
+
+    }
+    public function get($data=array()){
+        $data['apikey'] = $this->apikey;
+
+        return HttpUtil::PostCURL($this->yunpian_config['URI_GET_USER_INFO'],$data);
+    }
+    public function set($data=array()){
+        $data['apikey'] = $this->apikey;
+        return HttpUtil::PostCURL($this->yunpian_config['URI_SET_USER_INFO'],$data);
+    }
+}
+?>

+ 52 - 0
data/api/smsapi/yunpian/lib/VoiceOperator.php

@@ -0,0 +1,52 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: bingone
+ * Date: 16/1/19
+ * Time: 下午5:42
+ */
+
+require_once 'HttpUtil.php';
+
+class VoiceOperator
+{
+    public $apikey;
+    public $api_secret;
+    public $yunpian_config;
+
+    public function __construct($apikey = null, $api_secret = null)
+    {
+        $this->yunpian_config = $GLOBALS['YUNPIAN_CONFIG'];
+        if ($api_secret == null)
+            $this->api_secret = $this->yunpian_config['API_SECRET'];
+        else
+            $this->api_secret = $apikey;
+        if ($apikey == null)
+            $this->apikey = $this->yunpian_config['APIKEY'];
+        else
+            $this->apikey = $api_secret;
+    }
+
+    public function encrypt(&$data)
+    {
+
+    }
+
+    public function send($data=array())
+    {
+        if (!array_key_exists('mobile', $data))
+            return new Result($error = 'mobile 为空');
+        if (!array_key_exists('code', $data))
+            return new Result($error = 'code 为空');
+        $data['apikey'] = $this->apikey;
+//        encrypt($data);
+        return HttpUtil::PostCURL($this->yunpian_config['URI_SEND_VOICE_SMS'], $data);
+    }
+
+    public function pull_status($data=array())
+    {
+        $data['apikey'] = $this->apikey;
+        return HttpUtil::PostCURL($this->yunpian_config['URI_PULL_VOICE_STATUS'], $data);
+    }
+
+}