Commit e856ecc6 by 冷斌

fix bug

parent 1ce2ad81
...@@ -193,8 +193,6 @@ class InviteController extends HomebaseController { ...@@ -193,8 +193,6 @@ class InviteController extends HomebaseController {
} }
$mobile_code = random(6,1); $mobile_code = random(6,1);
var_dump($mobile,$mobile_code,630425);
die;
//密码可以使用明文密码或使用32位MD5加密 //密码可以使用明文密码或使用32位MD5加密
$result = sendCode($mobile,$mobile_code,630425); $result = sendCode($mobile,$mobile_code,630425);
if($result['code']===0){ if($result['code']===0){
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
return $redis; return $redis;
} }
/* 设置缓存 */ /* 设置缓存 */
function setcache($key,$info){ function setcache($key,$info){
$config=getConfigPri(); $config=getConfigPri();
...@@ -22,17 +22,17 @@ ...@@ -22,17 +22,17 @@
} }
$redis=connectionRedis(); $redis=connectionRedis();
$redis->set($key,json_encode($info)); $redis->set($key,json_encode($info));
$redis->setTimeout($key, $config['cache_time']); $redis->setTimeout($key, $config['cache_time']);
return 1; return 1;
} }
/* 设置缓存 可自定义时间*/ /* 设置缓存 可自定义时间*/
function setcaches($key,$info,$time){ function setcaches($key,$info,$time){
$redis=connectionRedis(); $redis=connectionRedis();
$redis->set($key,json_encode($info)); $redis->set($key,json_encode($info));
$redis->setTimeout($key, $time); $redis->setTimeout($key, $time);
return 1; return 1;
} }
/* 获取缓存 */ /* 获取缓存 */
...@@ -44,25 +44,25 @@ ...@@ -44,25 +44,25 @@
if($config['cache_switch']!=1){ if($config['cache_switch']!=1){
$isexist=false; $isexist=false;
} }
return json_decode($isexist,true); return json_decode($isexist,true);
} }
/* 获取缓存 不判断后台设置 */ /* 获取缓存 不判断后台设置 */
function getcaches($key){ function getcaches($key){
$redis=connectionRedis(); $redis=connectionRedis();
$isexist=$redis->Get($key); $isexist=$redis->Get($key);
return json_decode($isexist,true); return json_decode($isexist,true);
} }
/* 删除缓存 */ /* 删除缓存 */
function delcache($key){ function delcache($key){
$redis=connectionRedis(); $redis=connectionRedis();
$isexist=$redis->delete($key); $isexist=$redis->delete($key);
return 1; return 1;
} }
/* 去除NULL 判断空处理 主要针对字符串类型*/ /* 去除NULL 判断空处理 主要针对字符串类型*/
function checkNull($checkstr){ function checkNull($checkstr){
$checkstr=urldecode($checkstr); $checkstr=urldecode($checkstr);
...@@ -74,9 +74,9 @@ ...@@ -74,9 +74,9 @@
}else{ }else{
$str=$checkstr; $str=$checkstr;
} }
return $str; return $str;
} }
/* 去除emoji表情 */ /* 去除emoji表情 */
function filterEmoji($str){ function filterEmoji($str){
$str = preg_replace_callback( $str = preg_replace_callback(
...@@ -97,33 +97,33 @@ ...@@ -97,33 +97,33 @@
$config=json_decode($config,true); $config=json_decode($config,true);
setcaches($key,$config); setcaches($key,$config);
} }
if(is_array($config['live_time_coin'])){ if(is_array($config['live_time_coin'])){
}else if($config['live_time_coin']){ }else if($config['live_time_coin']){
$config['live_time_coin']=preg_split('/,|,/',$config['live_time_coin']); $config['live_time_coin']=preg_split('/,|,/',$config['live_time_coin']);
}else{ }else{
$config['live_time_coin']=array(); $config['live_time_coin']=array();
} }
if(is_array($config['login_type'])){ if(is_array($config['login_type'])){
}else if($config['login_type']){ }else if($config['login_type']){
$config['login_type']=preg_split('/,|,/',$config['login_type']); $config['login_type']=preg_split('/,|,/',$config['login_type']);
}else{ }else{
$config['login_type']=array(); $config['login_type']=array();
} }
if(is_array($config['share_type'])){ if(is_array($config['share_type'])){
}else if($config['share_type']){ }else if($config['share_type']){
$config['share_type']=preg_split('/,|,/',$config['share_type']); $config['share_type']=preg_split('/,|,/',$config['share_type']);
}else{ }else{
$config['share_type']=array(); $config['share_type']=array();
} }
if(is_array($config['live_type'])){ if(is_array($config['live_type'])){
}else if($config['live_type']){ }else if($config['live_type']){
$live_type=preg_split('/,|,/',$config['live_type']); $live_type=preg_split('/,|,/',$config['live_type']);
foreach($live_type as $k=>$v){ foreach($live_type as $k=>$v){
...@@ -133,10 +133,10 @@ ...@@ -133,10 +133,10 @@
}else{ }else{
$config['live_type']=array(); $config['live_type']=array();
} }
return $config; return $config;
} }
/* 获取私密配置 */ /* 获取私密配置 */
function getConfigPri() { function getConfigPri() {
$key='getConfigPri'; $key='getConfigPri';
...@@ -146,9 +146,9 @@ ...@@ -146,9 +146,9 @@
$config=json_decode($config,true); $config=json_decode($config,true);
setcaches($key,$config); setcaches($key,$config);
} }
if(is_array($config['game_switch'])){ if(is_array($config['game_switch'])){
}else if($config['game_switch']){ }else if($config['game_switch']){
$config['game_switch']=preg_split('/,|,/',$config['game_switch']); $config['game_switch']=preg_split('/,|,/',$config['game_switch']);
}else{ }else{
...@@ -162,8 +162,8 @@ ...@@ -162,8 +162,8 @@
function get_host(){ function get_host(){
$config=getConfigPub(); $config=getConfigPub();
return $config['site']; return $config['site'];
} }
/** /**
* 转化数据库保存的文件路径,为可以访问的url * 转化数据库保存的文件路径,为可以访问的url
*/ */
...@@ -176,14 +176,14 @@ ...@@ -176,14 +176,14 @@
}else{ }else{
return $file; return $file;
} }
} }
/* 获取等级 */ /* 获取等级 */
function getLevelList(){ function getLevelList(){
$key='level'; $key='level';
$level=getcaches($key); $level=getcaches($key);
if(!$level){ if(!$level){
$level= M("experlevel")->order("level_up asc")->select(); $level= M("experlevel")->order("level_up asc")->select();
foreach($level as $k=>$v){ foreach($level as $k=>$v){
$v['thumb']=get_upload_path($v['thumb']); $v['thumb']=get_upload_path($v['thumb']);
if($v['colour']){ if($v['colour']){
...@@ -193,14 +193,14 @@ ...@@ -193,14 +193,14 @@
} }
$level[$k]=$v; $level[$k]=$v;
} }
setcaches($key,$level); setcaches($key,$level);
} }
return $level; return $level;
} }
function getLevel($experience){ function getLevel($experience){
$levelid=1; $levelid=1;
$level=getLevelList(); $level=getLevelList();
foreach($level as $k=>$v){ foreach($level as $k=>$v){
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
} }
} }
$levelid = $levelid < $level_a ? $level_a:$levelid; $levelid = $levelid < $level_a ? $level_a:$levelid;
return $levelid; return $levelid;
} }
/* 主播等级 */ /* 主播等级 */
...@@ -225,15 +225,15 @@ ...@@ -225,15 +225,15 @@
$v['thumb']=get_upload_path($v['thumb']); $v['thumb']=get_upload_path($v['thumb']);
$v['thumb_mark']=get_upload_path($v['thumb_mark']); $v['thumb_mark']=get_upload_path($v['thumb_mark']);
} }
setcaches($key,$level); setcaches($key,$level);
} }
return $level; return $level;
} }
function getLevelAnchor($experience){ function getLevelAnchor($experience){
$levelid=1; $levelid=1;
$level=getLevelAnchorList(); $level=getLevelAnchorList();
foreach($level as $k=>$v){ foreach($level as $k=>$v){
if( $v['level_up']>=$experience){ if( $v['level_up']>=$experience){
$levelid=$v['levelid']; $levelid=$v['levelid'];
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
} }
} }
$levelid = $levelid < $level_a ? $level_a:$levelid; $levelid = $levelid < $level_a ? $level_a:$levelid;
return $levelid; return $levelid;
} }
...@@ -254,27 +254,27 @@ ...@@ -254,27 +254,27 @@
return 1; return 1;
}else{ }else{
return 0; return 0;
} }
} }
/*判断是否拉黑*/ /*判断是否拉黑*/
function isBlack($uid,$touid){ function isBlack($uid,$touid){
$isexist=M("users_black")->where("uid=".$uid." and touid=".$touid)->find(); $isexist=M("users_black")->where("uid=".$uid." and touid=".$touid)->find();
if($isexist){ if($isexist){
return 1; return 1;
}else{ }else{
return 0; return 0;
} }
} }
/* 关注人数 */ /* 关注人数 */
function getFollownums($uid) function getFollownums($uid)
{ {
return M("users_attention")->where("uid='{$uid}' ")->count(); return M("users_attention")->where("uid='{$uid}' ")->count();
} }
/* 粉丝人数 */ /* 粉丝人数 */
function getFansnums($uid) function getFansnums($uid)
{ {
return M("users_attention")->where(" touid='{$uid}'")->count(); return M("users_attention")->where(" touid='{$uid}'")->count();
} }
/* 用户基本信息 */ /* 用户基本信息 */
function getUserInfo($uid) { function getUserInfo($uid) {
$info= M("users")->field("id,user_nicename,avatar,avatar_thumb,sex,signature,consumption,votestotal,province,city,birthday,issuper")->where("id='{$uid}'")->find(); $info= M("users")->field("id,user_nicename,avatar,avatar_thumb,sex,signature,consumption,votestotal,province,city,birthday,issuper")->where("id='{$uid}'")->find();
...@@ -287,16 +287,16 @@ ...@@ -287,16 +287,16 @@
$info['vip']=getUserVip($uid); $info['vip']=getUserVip($uid);
$info['liang']=getUserLiang($uid); $info['liang']=getUserLiang($uid);
} }
return $info; return $info;
} }
/*获取收到礼物数量(tsd) 以及送出的礼物数量(tsc) */ /*获取收到礼物数量(tsd) 以及送出的礼物数量(tsc) */
function getgif($uid) function getgif($uid)
{ {
$live=M("users_coinrecord"); $live=M("users_coinrecord");
$count=$live->query('select sum(case when touid='.$uid.' then 1 else 0 end) as tsd,sum(case when uid='.$uid.' then 1 else 0 end) as tsc from cmf_users_coinrecord'); $count=$live->query('select sum(case when touid='.$uid.' then 1 else 0 end) as tsd,sum(case when uid='.$uid.' then 1 else 0 end) as tsc from cmf_users_coinrecord');
return $count; return $count;
} }
/* 用户信息 含有私密信息 */ /* 用户信息 含有私密信息 */
function getUserPrivateInfo($uid) { function getUserPrivateInfo($uid) {
...@@ -308,21 +308,21 @@ ...@@ -308,21 +308,21 @@
$info['level_anchor']=getLevelAnchor($info['votestotal']); $info['level_anchor']=getLevelAnchor($info['votestotal']);
$info['avatar']=get_upload_path($info['avatar']); $info['avatar']=get_upload_path($info['avatar']);
$info['avatar_thumb']=get_upload_path($info['avatar_thumb']); $info['avatar_thumb']=get_upload_path($info['avatar_thumb']);
$info['vip']=getUserVip($uid); $info['vip']=getUserVip($uid);
$info['liang']=getUserLiang($uid); $info['liang']=getUserLiang($uid);
} }
return $info; return $info;
} }
/* 用户信息 含有私密信息 */ /* 用户信息 含有私密信息 */
function getUserToken($uid) { function getUserToken($uid) {
$info= M("users")->field('token')->where("id='{$uid}'")->find(); $info= M("users")->field('token')->where("id='{$uid}'")->find();
return $info['token']; return $info['token'];
} }
/* 房间管理员 */ /* 房间管理员 */
function getIsAdmin($uid,$showid){ function getIsAdmin($uid,$showid){
if($uid==$showid){ if($uid==$showid){
return 50; return 50;
} }
$isuper=isSuper($uid); $isuper=isSuper($uid);
...@@ -332,26 +332,26 @@ ...@@ -332,26 +332,26 @@
$id=M("users_livemanager")->where("uid = '$uid' and liveuid = '$showid'")->find(); $id=M("users_livemanager")->where("uid = '$uid' and liveuid = '$showid'")->find();
if($id) { if($id) {
return 40; return 40;
} }
return 30; return 30;
} }
/*判断token是否过期*/ /*判断token是否过期*/
function checkToken($uid,$token) function checkToken($uid,$token)
{ {
if(!$uid || !$token){ if(!$uid || !$token){
return 700; return 700;
} }
$userinfo=getcaches("token_".$uid); $userinfo=getcaches("token_".$uid);
if(!$userinfo){ if(!$userinfo){
$userinfo=M("users")->field('token,expiretime')->where("id =".$uid." and user_type='2'")->find(); $userinfo=M("users")->field('token,expiretime')->where("id =".$uid." and user_type='2'")->find();
setcaches("token_".$uid,$userinfo); setcaches("token_".$uid,$userinfo);
} }
if($userinfo['token']!=$token || $userinfo['expiretime']<time()){ if($userinfo['token']!=$token || $userinfo['expiretime']<time()){
return 700; return 700;
}else{ }else{
return 0; return 0;
} }
} }
/*前台个人中心判断是否登录*/ /*前台个人中心判断是否登录*/
function LogIn() function LogIn()
...@@ -360,7 +360,7 @@ ...@@ -360,7 +360,7 @@
if($uid<=0) if($uid<=0)
{ {
$url=$_SERVER['HTTP_HOST']; $url=$_SERVER['HTTP_HOST'];
header("Location:http://".$url); header("Location:http://".$url);
exit; exit;
} }
} }
...@@ -369,7 +369,7 @@ ...@@ -369,7 +369,7 @@
$isexist=M("users_super")->where("uid='{$uid}'")->find(); $isexist=M("users_super")->where("uid='{$uid}'")->find();
if($isexist){ if($isexist){
return 1; return 1;
} }
return 0; return 0;
} }
/* 判断账号是被禁用 */ /* 判断账号是被禁用 */
...@@ -380,13 +380,13 @@ ...@@ -380,13 +380,13 @@
} }
return 1; return 1;
} }
/* 过滤关键词 */ /* 过滤关键词 */
function filterField($field){ function filterField($field){
$configpri=getConfigPri(); $configpri=getConfigPri();
$sensitive_field=$configpri['sensitive_field']; $sensitive_field=$configpri['sensitive_field'];
$sensitive=explode(",",$sensitive_field); $sensitive=explode(",",$sensitive_field);
$replace=array(); $replace=array();
$preg=array(); $preg=array();
...@@ -403,10 +403,10 @@ ...@@ -403,10 +403,10 @@
unset($sensitive[$k]); unset($sensitive[$k]);
} }
} }
return preg_replace($preg,$replace,$field); return preg_replace($preg,$replace,$field);
} }
/* 检验手机号 */ /* 检验手机号 */
function checkMobile($mobile){ function checkMobile($mobile){
$ismobile = preg_match("/^1[3|4|5|7|8]\d{9}$/",$mobile); $ismobile = preg_match("/^1[3|4|5|7|8]\d{9}$/",$mobile);
...@@ -416,15 +416,15 @@ ...@@ -416,15 +416,15 @@
return 0; return 0;
} }
} }
/* 多维数组排序 */ /* 多维数组排序 */
function array_column2($input, $columnKey, $indexKey = NULL){ function array_column2($input, $columnKey, $indexKey = NULL){
$columnKeyIsNumber = (is_numeric($columnKey)) ? TRUE : FALSE; $columnKeyIsNumber = (is_numeric($columnKey)) ? TRUE : FALSE;
$indexKeyIsNull = (is_null($indexKey)) ? TRUE : FALSE; $indexKeyIsNull = (is_null($indexKey)) ? TRUE : FALSE;
$indexKeyIsNumber = (is_numeric($indexKey)) ? TRUE : FALSE; $indexKeyIsNumber = (is_numeric($indexKey)) ? TRUE : FALSE;
$result = array(); $result = array();
foreach ((array)$input AS $key => $row){ foreach ((array)$input AS $key => $row){
if ($columnKeyIsNumber){ if ($columnKeyIsNumber){
$tmp = array_slice($row, $columnKey, 1); $tmp = array_slice($row, $columnKey, 1);
$tmp = (is_array($tmp) && !empty($tmp)) ? current($tmp) : NULL; $tmp = (is_array($tmp) && !empty($tmp)) ? current($tmp) : NULL;
...@@ -448,7 +448,7 @@ ...@@ -448,7 +448,7 @@
function isZombie($uid) function isZombie($uid)
{ {
$userinfo=M("users")->field("iszombie")->where("id=".$uid)->find(); $userinfo=M("users")->field("iszombie")->where("id=".$uid)->find();
return $userinfo['iszombie']; return $userinfo['iszombie'];
} }
/* 时间差计算 */ /* 时间差计算 */
function datetime($time){ function datetime($time){
...@@ -463,7 +463,7 @@ ...@@ -463,7 +463,7 @@
/* 时 */ /* 时 */
$h=floor($hz/24); $h=floor($hz/24);
/* 天 */ /* 天 */
if($cha<60){ if($cha<60){
return $cha.'秒前'; return $cha.'秒前';
}else if($iz<60){ }else if($iz<60){
...@@ -476,9 +476,9 @@ ...@@ -476,9 +476,9 @@
return date("Y-m-d",$time); return date("Y-m-d",$time);
} }
} }
/* 时长格式化 */ /* 时长格式化 */
function getSeconds($cha,$type=0){ function getSeconds($cha,$type=0){
$iz=floor($cha/60); $iz=floor($cha/60);
$hz=floor($iz/60); $hz=floor($iz/60);
$dz=floor($hz/24); $dz=floor($hz/24);
...@@ -489,7 +489,7 @@ ...@@ -489,7 +489,7 @@
/* 时 */ /* 时 */
$h=floor($hz/24); $h=floor($hz/24);
/* 天 */ /* 天 */
if($type==1){ if($type==1){
if($s<10){ if($s<10){
$s='0'.$s; $s='0'.$s;
...@@ -501,14 +501,14 @@ ...@@ -501,14 +501,14 @@
if($h<10){ if($h<10){
$h='0'.$h; $h='0'.$h;
} }
if($hz<10){ if($hz<10){
$hz='0'.$hz; $hz='0'.$hz;
} }
return $hz.':'.$i.':'.$s; return $hz.':'.$i.':'.$s;
} }
if($cha<60){ if($cha<60){
return $cha.'秒'; return $cha.'秒';
}else if($iz<60){ }else if($iz<60){
...@@ -518,8 +518,8 @@ ...@@ -518,8 +518,8 @@
}else if($dz<30){ }else if($dz<30){
return $dz.'天'.$h.'小时'.$i.'分钟'.$s.'秒'; return $dz.'天'.$h.'小时'.$i.'分钟'.$s.'秒';
} }
} }
/*判断该用户是否已经认证*/ /*判断该用户是否已经认证*/
function auth($uid) function auth($uid)
{ {
...@@ -549,15 +549,15 @@ ...@@ -549,15 +549,15 @@
} }
return $hash; return $hash;
} }
/* 发送验证码 */ /* 发送验证码 */
function sendCode_huiyi($mobile,$code){ function sendCode_huiyi($mobile,$code){
$rs=array(); $rs=array();
$config = getConfigPri(); $config = getConfigPri();
/* 互亿无线 */ /* 互亿无线 */
$target = "http://106.ihuyi.cn/webservice/sms.php?method=Submit"; $target = "http://106.ihuyi.cn/webservice/sms.php?method=Submit";
$post_data = "account=".$config['ihuyi_account']."&password=".$config['ihuyi_ps']."&mobile=".$mobile."&content=".rawurlencode("您的验证码是:".$code."。请不要把验证码泄露给其他人。"); $post_data = "account=".$config['ihuyi_account']."&password=".$config['ihuyi_ps']."&mobile=".$mobile."&content=".rawurlencode("您的验证码是:".$code."。请不要把验证码泄露给其他人。");
//密码可以使用明文密码或使用32位MD5加密 //密码可以使用明文密码或使用32位MD5加密
$gets = xml_to_array(Post($post_data, $target)); $gets = xml_to_array(Post($post_data, $target));
...@@ -567,10 +567,10 @@ ...@@ -567,10 +567,10 @@
}else{ }else{
$rs['code']=1002; $rs['code']=1002;
$rs['msg']=$gets['SubmitResult']['msg']; $rs['msg']=$gets['SubmitResult']['msg'];
} }
return $rs; return $rs;
} }
function Post($curlPost,$url){ function Post($curlPost,$url){
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
...@@ -583,7 +583,7 @@ ...@@ -583,7 +583,7 @@
curl_close($curl); curl_close($curl);
return $return_str; return $return_str;
} }
function xml_to_array($xml){ function xml_to_array($xml){
$reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/"; $reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/";
if(preg_match_all($reg, $xml, $matches)){ if(preg_match_all($reg, $xml, $matches)){
...@@ -601,22 +601,24 @@ ...@@ -601,22 +601,24 @@
return $arr; return $arr;
} }
/* 发送验证码 */ /* 发送验证码 */
/* 发送验证码 -- 容联云 */ /* 发送验证码 -- 容联云 */
function sendCode($mobile,$code){ function sendCode($mobile,$code){
var_dump(1);
die;
$rs = array('code' => 0, 'msg' => '', 'info' => array()); $rs = array('code' => 0, 'msg' => '', 'info' => array());
$config = getConfigPri(); $config = getConfigPri();
if(!$config['sendcode_switch']){ if(!$config['sendcode_switch']){
$rs['code']=667; $rs['code']=667;
$rs['msg']='123456'; $rs['msg']='123456';
return $rs; return $rs;
} }
require_once SITE_PATH.'../sdk/ronglianyun/CCPRestSDK.php'; require_once SITE_PATH.'../sdk/ronglianyun/CCPRestSDK.php';
//主帐号 //主帐号
$accountSid= $config['ccp_sid']; $accountSid= $config['ccp_sid'];
//主帐号Token //主帐号Token
...@@ -625,25 +627,25 @@ ...@@ -625,25 +627,25 @@
$appId=$config['ccp_appid']; $appId=$config['ccp_appid'];
//请求地址,格式如下,不需要写https:// //请求地址,格式如下,不需要写https://
$serverIP='app.cloopen.com'; $serverIP='app.cloopen.com';
//请求端口 //请求端口
$serverPort='8883'; $serverPort='8883';
//REST版本号 //REST版本号
$softVersion='2013-12-26'; $softVersion='2013-12-26';
$tempId=$config['ccp_tempid']; $tempId=$config['ccp_tempid'];
file_put_contents(SITE_PATH.'../data/sendCode_ccp_'.date('Y-m-d').'.txt',date('Y-m-d H:i:s').' 提交参数信息 post_data: accountSid:'.$accountSid.";accountToken:{$accountToken};appId:{$appId};tempId:{$tempId}\r\n",FILE_APPEND); file_put_contents(SITE_PATH.'../data/sendCode_ccp_'.date('Y-m-d').'.txt',date('Y-m-d H:i:s').' 提交参数信息 post_data: accountSid:'.$accountSid.";accountToken:{$accountToken};appId:{$appId};tempId:{$tempId}\r\n",FILE_APPEND);
$rest = new \REST($serverIP,$serverPort,$softVersion); $rest = new \REST($serverIP,$serverPort,$softVersion);
$rest->setAccount($accountSid,$accountToken); $rest->setAccount($accountSid,$accountToken);
$rest->setAppId($appId); $rest->setAppId($appId);
$datas=[]; $datas=[];
$datas[]=$code; $datas[]=$code;
$result = $rest->sendTemplateSMS($mobile,$datas,$tempId); $result = $rest->sendTemplateSMS($mobile,$datas,$tempId);
file_put_contents(SITE_PATH.'../data/sendCode_ccp_'.date('Y-m-d').'.txt',date('Y-m-d H:i:s').' 提交参数信息 result:'.json_encode($result)."\r\n",FILE_APPEND); file_put_contents(SITE_PATH.'../data/sendCode_ccp_'.date('Y-m-d').'.txt',date('Y-m-d H:i:s').' 提交参数信息 result:'.json_encode($result)."\r\n",FILE_APPEND);
if($result == NULL ) { if($result == NULL ) {
$rs['code']=1002; $rs['code']=1002;
$rs['msg']="获取失败"; $rs['msg']="获取失败";
...@@ -663,7 +665,7 @@ ...@@ -663,7 +665,7 @@
return $rs; return $rs;
} }
/**导出Excel 表格 /**导出Excel 表格
* @param $expTitle 名称 * @param $expTitle 名称
* @param $expCellName 参数 * @param $expCellName 参数
...@@ -700,7 +702,7 @@ ...@@ -700,7 +702,7 @@
$authcode='rCt52pF2cnnKNB3Hkp'; $authcode='rCt52pF2cnnKNB3Hkp';
$pass="###".md5(md5($authcode.$pass)); $pass="###".md5(md5($authcode.$pass));
return $pass; return $pass;
} }
/* 密码检查 */ /* 密码检查 */
function passcheck($user_pass) { function passcheck($user_pass) {
$num = preg_match("/^[a-zA-Z]+$/",$user_pass); $num = preg_match("/^[a-zA-Z]+$/",$user_pass);
...@@ -710,10 +712,10 @@ ...@@ -710,10 +712,10 @@
return 2; return 2;
}else if(!$check){ }else if(!$check){
return 0; return 0;
} }
return 1; return 1;
} }
/** /**
* @desc 获取推拉流地址 * @desc 获取推拉流地址
* @param string $host 协议,如:http、rtmp * @param string $host 协议,如:http、rtmp
...@@ -745,10 +747,10 @@ ...@@ -745,10 +747,10 @@
break; break;
} }
return $url; return $url;
} }
/** /**
* @desc 阿里云直播A类鉴权 * @desc 阿里云直播A类鉴权
* @param string $host 协议,如:http、rtmp * @param string $host 协议,如:http、rtmp
...@@ -770,9 +772,9 @@ ...@@ -770,9 +772,9 @@
$domain=$host.'://'.$pull; $domain=$host.'://'.$pull;
$time=time() + $length_pull; $time=time() + $length_pull;
} }
$filename="/5showcam/".$stream; $filename="/5showcam/".$stream;
if($type==1){ if($type==1){
if($key_push!=''){ if($key_push!=''){
$sstring = $filename."-".$time."-0-0-".$key_push; $sstring = $filename."-".$time."-0-0-".$key_push;
...@@ -797,7 +799,7 @@ ...@@ -797,7 +799,7 @@
$auth_key='?'.$auth_key; $auth_key='?'.$auth_key;
} }
$url=$domain.$filename.$auth_key; $url=$domain.$filename.$auth_key;
if($type==3){ if($type==3){
$url_a=explode('/'.$stream,$url); $url_a=explode('/'.$stream,$url);
$url=array( $url=array(
...@@ -806,10 +808,10 @@ ...@@ -806,10 +808,10 @@
); );
} }
} }
return $url; return $url;
} }
/** /**
* @desc 腾讯云推拉流地址 * @desc 腾讯云推拉流地址
* @param string $host 协议,如:http、rtmp * @param string $host 协议,如:http、rtmp
...@@ -822,19 +824,19 @@ ...@@ -822,19 +824,19 @@
$push_url_key=$configpri['tx_push_key']; $push_url_key=$configpri['tx_push_key'];
$push=$configpri['tx_push']; $push=$configpri['tx_push'];
$pull=$configpri['tx_pull']; $pull=$configpri['tx_pull'];
$stream_a=explode('.',$stream); $stream_a=explode('.',$stream);
$streamKey = $stream_a[0]; $streamKey = $stream_a[0];
$ext = $stream_a[1]; $ext = $stream_a[1];
//$live_code = $bizid . "_" .$streamKey; //$live_code = $bizid . "_" .$streamKey;
$live_code = $streamKey; $live_code = $streamKey;
$now_time = time() + 3*60*60; $now_time = time() + 3*60*60;
$txTime = dechex($now_time); $txTime = dechex($now_time);
$txSecret = md5($push_url_key . $live_code . $txTime); $txSecret = md5($push_url_key . $live_code . $txTime);
$safe_url = "&txSecret=" .$txSecret."&txTime=" .$txTime; $safe_url = "&txSecret=" .$txSecret."&txTime=" .$txTime;
if($type==1){ if($type==1){
//$push_url = "rtmp://" . $bizid . ".livepush2.myqcloud.com/live/" . $live_code . "?bizid=" . $bizid . "&record=flv" .$safe_url; 可录像 //$push_url = "rtmp://" . $bizid . ".livepush2.myqcloud.com/live/" . $live_code . "?bizid=" . $bizid . "&record=flv" .$safe_url; 可录像
...@@ -845,7 +847,7 @@ ...@@ -845,7 +847,7 @@
); );
}else{ }else{
$url = "http://{$pull}/live/" . $live_code . ".".$ext; $url = "http://{$pull}/live/" . $live_code . ".".$ext;
if($type==3){ if($type==3){
$url_a=explode('/'.$live_code,$url); $url_a=explode('/'.$live_code,$url);
$url=array( $url=array(
...@@ -854,7 +856,7 @@ ...@@ -854,7 +856,7 @@
); );
} }
} }
return $url; return $url;
} }
...@@ -907,7 +909,7 @@ ...@@ -907,7 +909,7 @@
); );
} }
} }
return $url; return $url;
} }
/** /**
...@@ -941,7 +943,7 @@ ...@@ -941,7 +943,7 @@
} }
return $url; return $url;
} }
/**网易cdn获取拉流地址**/ /**网易cdn获取拉流地址**/
function PrivateKey_wy($host,$stream,$type) function PrivateKey_wy($host,$stream,$type)
{ {
...@@ -952,7 +954,7 @@ ...@@ -952,7 +954,7 @@
$curTime=time(); $curTime=time();
$var=$appSecret.$nonce.$curTime; $var=$appSecret.$nonce.$curTime;
$checkSum=sha1($appSecret.$nonce.$curTime); $checkSum=sha1($appSecret.$nonce.$curTime);
$header =array( $header =array(
"Content-Type:application/json;charset=utf-8", "Content-Type:application/json;charset=utf-8",
"AppKey:".$appkey, "AppKey:".$appkey,
...@@ -960,7 +962,7 @@ ...@@ -960,7 +962,7 @@
"CurTime:".$curTime, "CurTime:".$curTime,
"CheckSum:".$checkSum, "CheckSum:".$checkSum,
); );
if($type==1){ if($type==1){
$url='https://vcloud.163.com/app/channel/create'; $url='https://vcloud.163.com/app/channel/create';
$paramarr = array( $paramarr = array(
...@@ -974,11 +976,11 @@ ...@@ -974,11 +976,11 @@
); );
} }
$paramarr=json_encode($paramarr); $paramarr=json_encode($paramarr);
$curl=curl_init(); $curl=curl_init();
curl_setopt($curl,CURLOPT_URL, $url); curl_setopt($curl,CURLOPT_URL, $url);
curl_setopt($curl,CURLOPT_HEADER, 0); curl_setopt($curl,CURLOPT_HEADER, 0);
curl_setopt($curl,CURLOPT_HTTPHEADER, $header); curl_setopt($curl,CURLOPT_HTTPHEADER, $header);
curl_setopt($curl,CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0); curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0); curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);
...@@ -989,7 +991,7 @@ ...@@ -989,7 +991,7 @@
$url=json_decode($data,1); $url=json_decode($data,1);
return $url; return $url;
} }
/** /**
* @desc 奥点云推拉流 * @desc 奥点云推拉流
* @param string $host 协议,如:http、rtmp * @param string $host 协议,如:http、rtmp
...@@ -1022,7 +1024,7 @@ ...@@ -1022,7 +1024,7 @@
$filename="/".$configpri['ady_apn']."/".$stream; $filename="/".$configpri['ady_apn']."/".$stream;
$url=$domain.$filename; $url=$domain.$filename;
} }
if($type==3){ if($type==3){
$url_a=explode('/'.$stream,$url); $url_a=explode('/'.$stream,$url);
$url=array( $url=array(
...@@ -1031,10 +1033,10 @@ ...@@ -1031,10 +1033,10 @@
); );
} }
} }
return $url; return $url;
} }
/* 生成邀请码 */ /* 生成邀请码 */
function createCode(){ function createCode(){
$code = 'ABCDEFGHIJKLMNPQRSTUVWXYZ'; $code = 'ABCDEFGHIJKLMNPQRSTUVWXYZ';
...@@ -1059,10 +1061,10 @@ ...@@ -1059,10 +1061,10 @@
return $d; return $d;
} }
} }
createCode(); createCode();
} }
/* 数字格式化 */ /* 数字格式化 */
function NumberFormat($num){ function NumberFormat($num){
if($num<10000){ if($num<10000){
...@@ -1089,7 +1091,7 @@ ...@@ -1089,7 +1091,7 @@
} }
return $num; return $num;
} }
/* 获取用户VIP */ /* 获取用户VIP */
function getUserVip($uid){ function getUserVip($uid){
$rs=array( $rs=array(
...@@ -1100,7 +1102,7 @@ ...@@ -1100,7 +1102,7 @@
if($isexist){ if($isexist){
$rs['type']=$isexist['type']; $rs['type']=$isexist['type'];
} }
return $rs; return $rs;
} }
...@@ -1122,11 +1124,11 @@ ...@@ -1122,11 +1124,11 @@
$rs['swf']=get_upload_path($info['swf']) ; $rs['swf']=get_upload_path($info['swf']) ;
$rs['swftime']=$info['swftime']; $rs['swftime']=$info['swftime'];
$rs['words']=$info['words']; $rs['words']=$info['words'];
} }
} }
return $rs; return $rs;
} }
...@@ -1140,10 +1142,10 @@ ...@@ -1140,10 +1142,10 @@
if($isexist){ if($isexist){
$rs['name']=$isexist['name']; $rs['name']=$isexist['name'];
} }
return $rs; return $rs;
} }
/* 三级分销 */ /* 三级分销 */
function setAgentProfit($uid,$total){ function setAgentProfit($uid,$total){
/* 分销 */ /* 分销 */
...@@ -1220,7 +1222,7 @@ ...@@ -1220,7 +1222,7 @@
M('users_voterecord')->add($insert_votes); M('users_voterecord')->add($insert_votes);
} }
} */ } */
if($isinsert==1){ if($isinsert==1){
$data=array( $data=array(
'uid'=>$uid, 'uid'=>$uid,
...@@ -1237,13 +1239,13 @@ ...@@ -1237,13 +1239,13 @@
} }
} }
return 1; return 1;
} }
/* 家族分成 */ /* 家族分成 */
function setFamilyDivide($liveuid,$total){ function setFamilyDivide($liveuid,$total){
$configpri=getConfigPri(); $configpri=getConfigPri();
$anthor_total=$total; $anthor_total=$total;
/* 家族 */ /* 家族 */
if($configpri['family_switch']==1){ if($configpri['family_switch']==1){
...@@ -1263,10 +1265,10 @@ ...@@ -1263,10 +1265,10 @@
/* 主播 */ /* 主播 */
if( $users_family['divide_family']>=0){ if( $users_family['divide_family']>=0){
$divide_family=$users_family['divide_family']; $divide_family=$users_family['divide_family'];
} }
$family_total=$total * $divide_family * 0.01; $family_total=$total * $divide_family * 0.01;
$anthor_total=$total - $family_total; $anthor_total=$total - $family_total;
$addtime=time(); $addtime=time();
$time=date('Y-m-d',$addtime); $time=date('Y-m-d',$addtime);
...@@ -1296,7 +1298,7 @@ ...@@ -1296,7 +1298,7 @@
return 0; return 0;
} }
$date = date("Ymd"); $date = date("Ymd");
$ip= ip2long($_SERVER["REMOTE_ADDR"]) ; $ip= ip2long($_SERVER["REMOTE_ADDR"]) ;
$IP_limit=M("getcode_limit_ip"); $IP_limit=M("getcode_limit_ip");
$isexist=$IP_limit->field('ip,date,times')->where("ip={$ip}")->find(); $isexist=$IP_limit->field('ip,date,times')->where("ip={$ip}")->find();
if(!$isexist){ if(!$isexist){
...@@ -1317,8 +1319,8 @@ ...@@ -1317,8 +1319,8 @@
$isexist=$IP_limit->where("ip={$ip}")->save(array('date'=> $date ,'times'=>1)); $isexist=$IP_limit->where("ip={$ip}")->save(array('date'=> $date ,'times'=>1));
return 0; return 0;
} }
} }
} }
/* 获取用户守护信息 */ /* 获取用户守护信息 */
function getUserGuard($uid,$liveuid){ function getUserGuard($uid,$liveuid){
...@@ -1332,11 +1334,11 @@ ...@@ -1332,11 +1334,11 @@
$guardinfo=M('guard_users') $guardinfo=M('guard_users')
->field('type,endtime') ->field('type,endtime')
->where("uid = {$uid} and liveuid={$liveuid}") ->where("uid = {$uid} and liveuid={$liveuid}")
->find(); ->find();
setcaches($key,$guardinfo); setcaches($key,$guardinfo);
} }
$nowtime=time(); $nowtime=time();
if($guardinfo && $guardinfo['endtime']>$nowtime){ if($guardinfo && $guardinfo['endtime']>$nowtime){
$rs=array( $rs=array(
'type'=>$guardinfo['type'], 'type'=>$guardinfo['type'],
...@@ -1345,4 +1347,4 @@ ...@@ -1345,4 +1347,4 @@
); );
} }
return $rs; return $rs;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment