当前位置 : 主页 > 网络编程 > PHP >

play.txt

来源:互联网 收集:自由互联 发布时间:2021-06-28
play.txt public function Play() { $id = input('param.id'); $MemberID = input('param.MemberID');//用户id $MemberDisplayName=input('param.MemberDisplayName');//用户名 $btime=input('param.btime');//开始时间 $etime=input('param.etime')
play.txt
public function Play()
	 {	 $id = input('param.id');
		 $MemberID = input('param.MemberID');//用户id
		 $MemberDisplayName=input('param.MemberDisplayName');//用户名
		 $btime=input('param.btime');//开始时间
		 $etime=input('param.etime');//结束时间
		 if(!$etime){$etime=date("Y-m-d h:i:s",time());}
		 $ip=input('param.ip');
		 $Remark=input('param.Remark');//备注,查询like 黑名单
		 $PrizeType=input('param.PrizeType');//0,20,21,30
		 if($id)
		 {
			$this->Playmenu[0]['text'] = '首页/活动列表';
			$this->Playmenu[0]['url']  = 'index';
			$this->Playmenu[1]['text'] = '活动查看/编辑';
			$this->Playmenu[1]['url']  = '/home/game/edit/id/'.$id;
			$this->Playmenu[2]['text'] = '活动数据';
			$this->Playmenu[2]['url']  = '/home/game/Play/id/'.$id;
			$this->assign('third_menu', $this->Playmenu);
			
			$map['GameID']=$id;//判断并赋值各个查询条件
			if($MemberID){$map['MemberID']  = $MemberID;}
			if($MemberDisplayName){$map['MemberDisplayName']  = ['like','%'.$MemberDisplayName.'%'];}
			if($ip){$map['IP']  = $ip;}
			if($Remark){$map['Remark']  = ['like','%'.$Remark.'%'];}
			if($PrizeType){$map['PrizeType']  = $PrizeType;}
			if(!$btime){$btime=date('y-m-d',time()-2592000 );}//取1个月内的}
			
			$data = Gamemodel::get($id);
			$list = Playmodel::where($map)//生成分页,$map是多条件查询,根据输入值判断
					->whereTime('CreateTime','>',$btime)
					->whereTime('CreateTime','<',$etime)
					->order('ID', 'desc')
					->paginate(13,false,['query' => [//传递分页参数
							'MemberID'=>$MemberID,
							'MemberDisplayName'=>$MemberDisplayName,
							'IP'=>$ip,
							'Remark'=>$Remark,
							'btime'=>$btime,
							'etime'=>$etime,
							'PrizeType'=>$PrizeType]]);
				//dump(Playmodel::getLastSql());//打印最近的sql语句
			$Play = Playmodel::where($map)//循环查询
					->whereTime('CreateTime','>',$btime)
					->whereTime('CreateTime','<',$etime)
					->order('ID', 'desc')
					->select();
					
			$data['num']=COUNT($Play);//计算活动次数
			$isok=0;//为模版上各项统计数据赋值
			$PointsReward=0;
			$Voucher=0;
			$shiwu=0;
			foreach( $Play as $k)//遍历完成诸多数据统计
				{   
					if($k['PrizeType']=21)
					{
						$PointsReward=$PointsReward+$k['PointsReward'];
					}
					if($k['Remark']=='正常抽奖')
					{
						$isok++;
					}
					if($k['PrizeType']=20)
					{
						if($k['VoucherCodeReward']==''){}
						else if($k['VoucherCodeReward']=='不能领取更多了哦,去看看别的券吧~'){}
						else if($k['VoucherCodeReward']=='未生成模板券或模板券无效'){}
						else {$Voucher++;}
					}
					if($k['PrizeType']==30)
					{
						$shiwu++;
					}
				}
			$data['Voucher']=$Voucher;//成功领取优惠券
			$data['shiwu']=$shiwu;//成功送出的实物奖品
			$data['isok']=$isok;//成功参加活动
			$data['PointsReward']=$PointsReward;//送出积分总和
			$data['btime']=strtotime($btime);//开始时间
			$data['etime']=strtotime($etime);//结束时间
			$data['MemberID']=$MemberID;//用户id
			$data['MemberDisplayName']=$MemberDisplayName;//用户名
			$data['ip']=$ip;
			$data['Remark']=$Remark;//备注
			$data['PrizeType']=$PrizeType;//类型
			
			$this->assign('data', $data);
			$this->assign('list', $list);
			return $this->fetch('play');
		 }	 
	 }
上一篇:php微信登录.txt
下一篇:BMap.setting
网友评论