Commit 8eb532b1 by 冷斌

fix bug

parent f404e947
...@@ -1083,30 +1083,36 @@ class Api_Live extends PhalApi_Api { ...@@ -1083,30 +1083,36 @@ class Api_Live extends PhalApi_Api {
// file_put_contents('./LiveConnect.txt',date('Y-m-d H:i:s').' 提交参数信息 pkpull:'.json_encode($pkpull)."\r\n",FILE_APPEND); // file_put_contents('./LiveConnect.txt',date('Y-m-d H:i:s').' 提交参数信息 pkpull:'.json_encode($pkpull)."\r\n",FILE_APPEND);
$pkinfo['pkpull']=$this->getPullWithSign($pkpull); $pkinfo['pkpull']=$this->getPullWithSign($pkpull);
$pk_time_start = $pk_time_end = 0;
$ph_time = DI()->redis->hGet('LivePH_timer', $liveuid); $ph_time = DI()->redis->hGet('LivePH_timer', $liveuid);
$nowtime = time(); $nowtime = time();
if (!$ph_time) { if (!$ph_time) {
//开始惩罚时间 //开始惩罚时间
$ph_time = DI()->redis->hGet('LivePH_timer', $pkuid); $ph_time = DI()->redis->hGet('LivePH_timer', $pkuid);
} }
if ($ph_time && $ph_time > 0 && $ph_time < $nowtime) { if ($ph_time && $ph_time > 0 && $ph_time < $nowtime) {
$chb = 2.5 * 60 - ($nowtime - $ph_time); $chb = 2.5 * 60 - ($nowtime - $ph_time);
$pkinfo['ph_time'] = (string) $chb; //惩罚剩余时间 $pkinfo['ph_time'] = (string) $chb; //惩罚剩余时间
$pk_time_start = $ph_time - 5*60;
$pk_time_end = $ph_time;
} }
$ifpk=DI()->redis -> hGet('LivePK',$liveuid); $pkinfo['ifpk']=DI()->redis -> hGet('LivePK',$liveuid);
if($ifpk){
$pkinfo['ifpk']='1';
$pk_time=DI()->redis -> hGet('LivePK_timer',$liveuid); $pk_time=DI()->redis -> hGet('LivePK_timer',$liveuid);
if(!$pk_time){ if(!$pk_time){
$pk_time=DI()->redis -> hGet('LivePK_timer',$pkuid); $pk_time=DI()->redis -> hGet('LivePK_timer',$pkuid);
} }
// $nowtime=time();
// if($pk_time && $pk_time >0 && $pk_time < $nowtime){
if($pk_time && $pk_time >0){ if($pk_time && $pk_time >0){
$cha=5*60 - ($nowtime - $pk_time); $cha=5*60 - ($nowtime - $pk_time);
$pkinfo['pk_time']= $cha > 0 ? (string)$cha : "0"; $pkinfo['pk_time']= $cha > 0 ? (string)$cha : "0";
$pk_time_start = $pk_time;
$pk_time_end = $pk_time + 5*60; $pk_time_end = $pk_time + 5*60;
$where =" type='expend' and action in ('sendgift','sendbarrage') and addtime BETWEEN {$pk_time} AND {$pk_time_end}"; }
$where =" type='expend' and action in ('sendgift','sendbarrage') and addtime BETWEEN {$pk_time_start} AND {$pk_time_end}";
// $pk_gift_liveuid=DI()->redis -> hGet('LivePK_gift',$liveuid); // $pk_gift_liveuid=DI()->redis -> hGet('LivePK_gift',$liveuid);
$pk_gift_liveuid = $result=DI()->notorm->users_coinrecord->where($where . " and touid = {$liveuid}")->sum('totalcoin2'); $pk_gift_liveuid = $result=DI()->notorm->users_coinrecord->where($where . " and touid = {$liveuid}")->sum('totalcoin2');
if($pk_gift_liveuid){ if($pk_gift_liveuid){
...@@ -1119,10 +1125,12 @@ class Api_Live extends PhalApi_Api { ...@@ -1119,10 +1125,12 @@ class Api_Live extends PhalApi_Api {
if($pk_gift_pkuid){ if($pk_gift_pkuid){
$pkinfo['pk_gift_pkuid']=(string)$pk_gift_pkuid; $pkinfo['pk_gift_pkuid']=(string)$pk_gift_pkuid;
} }
}else{
$pkinfo['ifpk']='0';
}
}
// file_put_contents('./LiveConnect.txt',date('Y-m-d H:i:s').' 提交参数信息 pkinfo:'.json_encode($pkinfo)."\r\n",FILE_APPEND); // file_put_contents('./LiveConnect.txt',date('Y-m-d H:i:s').' 提交参数信息 pkinfo:'.json_encode($pkinfo)."\r\n",FILE_APPEND);
} }
......
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