Commit f4331e2e by 冷斌

支付宝

parent 281b9f89
...@@ -14,26 +14,26 @@ class LiveingController extends AdminbaseController { ...@@ -14,26 +14,26 @@ class LiveingController extends AdminbaseController {
$map['starttime']=array("gt",strtotime($_REQUEST['start_time'])); $map['starttime']=array("gt",strtotime($_REQUEST['start_time']));
$_GET['start_time']=$_REQUEST['start_time']; $_GET['start_time']=$_REQUEST['start_time'];
} }
if($_REQUEST['end_time']!=''){ if($_REQUEST['end_time']!=''){
$map['starttime']=array("lt",strtotime($_REQUEST['end_time'])); $map['starttime']=array("lt",strtotime($_REQUEST['end_time']));
$_GET['end_time']=$_REQUEST['end_time']; $_GET['end_time']=$_REQUEST['end_time'];
} }
if($_REQUEST['start_time']!='' && $_REQUEST['end_time']!='' ){ if($_REQUEST['start_time']!='' && $_REQUEST['end_time']!='' ){
$map['starttime']=array("between",array(strtotime($_REQUEST['start_time']),strtotime($_REQUEST['end_time']))); $map['starttime']=array("between",array(strtotime($_REQUEST['start_time']),strtotime($_REQUEST['end_time'])));
$_GET['start_time']=$_REQUEST['start_time']; $_GET['start_time']=$_REQUEST['start_time'];
$_GET['end_time']=$_REQUEST['end_time']; $_GET['end_time']=$_REQUEST['end_time'];
} }
if($_REQUEST['keyword']!=''){ if($_REQUEST['keyword']!=''){
$map['uid']=$_REQUEST['keyword']; $map['uid']=$_REQUEST['keyword'];
$_GET['keyword']=$_REQUEST['keyword']; $_GET['keyword']=$_REQUEST['keyword'];
} }
$live=M("users_live"); $live=M("users_live");
$Coinrecord=M("users_coinrecord"); $Coinrecord=M("users_coinrecord");
$count=$live->where($map)->count(); $count=$live->where($map)->count();
...@@ -43,6 +43,10 @@ class LiveingController extends AdminbaseController { ...@@ -43,6 +43,10 @@ class LiveingController extends AdminbaseController {
->order("starttime DESC") ->order("starttime DESC")
->limit($page->firstRow . ',' . $page->listRows) ->limit($page->firstRow . ',' . $page->listRows)
->select(); ->select();
var_dump($map);
$redis=connectionRedis(); $redis=connectionRedis();
foreach($lists as $k=>$v){ foreach($lists as $k=>$v){
$userinfo=getUserInfo($v['uid']); $userinfo=getUserInfo($v['uid']);
...@@ -57,64 +61,66 @@ class LiveingController extends AdminbaseController { ...@@ -57,64 +61,66 @@ class LiveingController extends AdminbaseController {
if(!$total_nums){ if(!$total_nums){
$total_nums=0; $total_nums=0;
} }
/* 人均 */ /* 人均 */
$total_average=0; $total_average=0;
if($totalcoin && $total_nums){ if($totalcoin && $total_nums){
$total_average=round($totalcoin/$total_nums,2); $total_average=round($totalcoin/$total_nums,2);
} }
/* 人数 */ /* 人数 */
$nums=$redis->zSize('user_'.$v['stream']); $nums=$redis->zSize('user_'.$v['stream']);
$v['totalcoin']=$totalcoin; $v['totalcoin']=$totalcoin;
$v['total_nums']=$total_nums; $v['total_nums']=$total_nums;
$v['total_average']=$total_average; $v['total_average']=$total_average;
$v['nums']=$nums; $v['nums']=$nums;
if($v['isvideo']==0 && $configpri['cdn_switch']!=5){ if($v['isvideo']==0 && $config['cdn_switch']!=5){
$v['pull']=PrivateKeyA('rtmp',$v['stream'],0); $v['pull']=PrivateKeyA('rtmp',$v['stream'],0);
} }
var_dump($v, $config['cdn_switch']);
die;
$lists[$k]=$v; $lists[$k]=$v;
} }
$this->assign('config', $config); $this->assign('config', $config);
$this->assign('lists', $lists); $this->assign('lists', $lists);
$this->assign('formget', $_GET); $this->assign('formget', $_GET);
$this->assign("page", $page->show('Admin')); $this->assign("page", $page->show('Admin'));
$liveclass=M("live_class")->getfield('id,name'); $liveclass=M("live_class")->getfield('id,name');
$liveclass[0]='默认分类'; $liveclass[0]='默认分类';
$this->assign('liveclass', $liveclass); $this->assign('liveclass', $liveclass);
$this->display(); $this->display();
} }
function del(){ function del(){
$uid=intval($_GET['uid']); $uid=intval($_GET['uid']);
if($uid){ if($uid){
$result=M("users_live")->where("uid={$uid}")->delete(); $result=M("users_live")->where("uid={$uid}")->delete();
if($result){ if($result){
$this->success('删除成功'); $this->success('删除成功');
}else{ }else{
$this->error('删除失败'); $this->error('删除失败');
} }
}else{ }else{
$this->error('数据传入失败!'); $this->error('数据传入失败!');
} }
$this->display(); $this->display();
} }
function add(){ function add(){
$liveclass=M("live_class")->order('orderno asc,id desc')->select(); $liveclass=M("live_class")->order('orderno asc,id desc')->select();
$this->assign('liveclass', $liveclass); $this->assign('liveclass', $liveclass);
$this->display(); $this->display();
} }
function add_post(){ function add_post(){
if(IS_POST){ if(IS_POST){
$nowtime=time(); $nowtime=time();
$uid=(int)$_POST['uid']; $uid=(int)$_POST['uid'];
$pull=urldecode($_POST['pull']); $pull=urldecode($_POST['pull']);
...@@ -122,28 +128,28 @@ class LiveingController extends AdminbaseController { ...@@ -122,28 +128,28 @@ class LiveingController extends AdminbaseController {
$type_val=$_POST['type_val']; $type_val=$_POST['type_val'];
$anyway=$_POST['anyway']; $anyway=$_POST['anyway'];
$liveclassid=I('liveclassid'); $liveclassid=I('liveclassid');
$User=M("users"); $User=M("users");
$live=M("users_live"); $live=M("users_live");
$userinfo=$User->field("ishot,isrecommend")->where("id={$uid}")->find(); $userinfo=$User->field("ishot,isrecommend")->where("id={$uid}")->find();
if(!$userinfo){ if(!$userinfo){
$this->error('用户不存在'); $this->error('用户不存在');
} }
$liveinfo=$live->field('uid,islive')->where("uid={$uid}")->find(); $liveinfo=$live->field('uid,islive')->where("uid={$uid}")->find();
if($liveinfo['islive']==1){ if($liveinfo['islive']==1){
$this->error('该用户正在直播'); $this->error('该用户正在直播');
} }
$title=''; $title='';
$stream=$uid.'_'.$nowtime; $stream=$uid.'_'.$nowtime;
$data=array( $data=array(
"uid"=>$uid, "uid"=>$uid,
"ishot"=>$userinfo['ishot'], "ishot"=>$userinfo['ishot'],
"isrecommend"=>$userinfo['isrecommend'], "isrecommend"=>$userinfo['isrecommend'],
"showid"=>$nowtime, "showid"=>$nowtime,
"starttime"=>$nowtime, "starttime"=>$nowtime,
"title"=>$title, "title"=>$title,
...@@ -160,50 +166,50 @@ class LiveingController extends AdminbaseController { ...@@ -160,50 +166,50 @@ class LiveingController extends AdminbaseController {
"islive"=>1, "islive"=>1,
"anyway"=>$anyway, "anyway"=>$anyway,
"liveclassid"=>$liveclassid, "liveclassid"=>$liveclassid,
); );
if($liveinfo){ if($liveinfo){
$result=$live->where("uid={$uid}")->save($data); $result=$live->where("uid={$uid}")->save($data);
}else{ }else{
$result=$live->add($data); $result=$live->add($data);
} }
if($result!==false){ if($result!==false){
$this->success('添加成功'); $this->success('添加成功');
}else{ }else{
$this->error('添加失败'); $this->error('添加失败');
} }
} }
} }
function edit(){ function edit(){
$uid=intval($_GET['uid']); $uid=intval($_GET['uid']);
if($uid){ if($uid){
$live=M("users_live")->where("uid={$uid}")->find(); $live=M("users_live")->where("uid={$uid}")->find();
$liveclass=M("live_class")->order('orderno asc,id desc')->select(); $liveclass=M("live_class")->order('orderno asc,id desc')->select();
$this->assign('liveclass', $liveclass); $this->assign('liveclass', $liveclass);
$this->assign('live', $live); $this->assign('live', $live);
}else{ }else{
$this->error('数据传入失败!'); $this->error('数据传入失败!');
} }
$this->display(); $this->display();
} }
function edit_post(){ function edit_post(){
if(IS_POST){ if(IS_POST){
$pull=I('pull'); $pull=I('pull');
$live=M("users_live"); $live=M("users_live");
$live->create(); $live->create();
$live->pull=urldecode($pull); $live->pull=urldecode($pull);
$result=$live->save(); $result=$live->save();
if($result!==false){ if($result!==false){
$this->success('修改成功'); $this->success('修改成功');
}else{ }else{
$this->error('修改失败'); $this->error('修改失败');
} }
} }
} }
} }
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