海南的七星彩网站系统盘口代码解析
发布于: 2020 年 07 月 12 日
这个是前端时间帮朋友做的一个项目,海南那边的七星彩网站系统盘口开奖算法实现,现在分享出来给大家研究研究,希望可以帮到一些朋友,有问题的可以加我q:3523-657133
class DateController extends HomebaseController { function kj(){ header("Content-type:text/html;charset=utf-8"); @set_time_limit(0); @ini_set("memory_limit", "512M"); $time=$_SERVER['REQUEST_TIME']; //下注类型 $list=M("played")->select(); $playlist=array(); foreach($list as $key=>$one){ $playlist[$one["id"]]=$one; } /*获取用户id*/ $list=M("user")->select(); $userlist2=array(); foreach($list as $key=>$one){ $userlist2[$one["id"]]=$one; } /*获取代理*/ $list=M("agent")->select(); $agentlist=array(); foreach($list as $key=>$one){ $agentlist[$one["id"]]=$one; } $id=I("get.id"); $data=M("data")->find($id); $map["typeid"]=$data["type"]; $map["PeriodsNumber"]=$data["number"]; $map["zt"]=0; /*获取下注批次*/ $bets=M("bets")->where($map)->select(); // dump($bets);exit; /*循环批次获取会员下注信息*/ foreach ($bets as $key => $value) { $bet=array(); $bet["WinLoss"]=0; $bet["ProfitAndLoss"]=0; $bet["BackComm"]=0; $bet["BetAmount"]=0; $bet["zt"]=1; $bet["sftj"]=3; $bet["lotteryno"]=$data["data"]; $mapbet=array(); $mapbet["BetInfoID"]=$value["betinfoid"]; $mapbet["sftm"]=0; //避免加载慢,每5000条执行一次 for ($i=0;$i<$value["count"]/5000;$i++) { $count=M("userbet".$value["uid"])->where($mapbet)->count(); $list=M("userbet".$value["uid"])->where($mapbet)->limit(($i*5000).",5000")->select(); // dump($list);exit; /*获取单个下注码,判断是否中奖*/ foreach ($list as $key2 => $value2) { $count++; $bet["BetAmount"]+=$value2["betamount"]; $bet["BackComm"]+=$value2["backcomm"]; $bet["UpdateDt"]=date("Y-m-d H:i:s",time()); $play=$playlist[$value2["playedid"]]; $rulefun = $play['rulefun']; /*判断中奖情况*/ $is_zj=$this->$rulefun($value2["betnumber"],$data["data"]); /*如果中奖*/ $save["zt"]=1; $jjmoney=0; if ($is_zj) { $jjmoney=$value2["betamount"]*$value2["odds"]; if($value2["zt"]==0) { $usermoney[$value["uid"]]+=$jjmoney; } $save["WinLoss"]=$jjmoney; $bet["WinLoss"]+=$jjmoney; $bet["zjcount1"]+=1; $bet["ProfitAndLoss"]+=$jjmoney-$value2["betamount"]; $tongji[$play['bettypeid']]['ProfitAndLoss']+=$jjmoney-$value2["betamount"]; $tongji[$play['bettypeid']]['BackComm']+=$value2["backcomm"]; $save["ProfitAndLoss"]=$jjmoney-$value2["betamount"]; // dump($save); //$this->ffmoney($value["uid"],$jjmoney,"发放奖金",0); // echo 1; }else{ $bet["ProfitAndLoss"]+=-$value2["betamount"]; $tongji[$play['bettypeid']]['ProfitAndLoss']+=-$value2["betamount"]; $tongji[$play['bettypeid']]['BackComm']+=$value2["backcomm"]; $save["WinLoss"]=0; $save["ProfitAndLoss"]=0-$value2["betamount"]; // dump($save); } /*将中奖信息更新*/ $map2["id"]=$value2["id"]; M("userbet".$value["uid"])->where($map2)->save($save); $save2["betAmount"]+=$value2["betamount"]; $save2["zjCount"]+=$is_zj; $save2["billCount"]+=1; $save2["zjAmount"]+=$save["WinLoss"]; $save2["pjed"]+=$save["WinLoss"]; $userlist[$value["uid"]]+=1; } } $map3["id"]=$value["id"]; M("bets")->where($map3)->save($bet); } $save2["userCount"]=$data["usercount"]+count($userlist); M("data")->where("id=".$id)->save($save2); echo "总计开奖".$count.",用时".($time-time())."秒,奖金放发完毕。"; } //拦货 function lhff($json,$win,$money){ $data=json_decode($json,true); foreach($data as $key => $value){ $this->ffmoney($value["id"],$value["money"]/$money*$win,"拦货","1"); } } function fsff($json){ $data=json_decode($json,true); $zmoney=0; foreach($data as $key => $value){ $this->ffmoney($value["id"],$value["money"],"返水",$value["sfagent"]); $zmoney=$value["money"]+$zmoney; } return $zmoney; } function ffmoney($id,$money,$yuan,$sfagent){ if($sfagent){ $M=M("agent"); } else{ $M=M("user"); } $map["id"]=$id; $user=$M->where($map)->setInc("money",$money); } function ssc1($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[1]==$number[1]){ $result=1; } return $result; } function ssc2($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[2]==$number[2]){ $result=1; } return $result; } function ssc3($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[3]==$number[3]){ $result=1; } return $result; } function ssc4($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[1]==$number[1] && $betlist[3]==$number[3]){ $result=1; } return $result; } function ssc5($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[2]==$number[2] && $betlist[1]==$number[1]){ $result=1; } return $result; } function ssc6($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[2]==$number[2] && $betlist[3]==$number[3]){ $result=1; } return $result; } function ssc7($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[3]==$number[3] && $betlist[4]==$number[4]){ $result=1; } return $result; } function ssc8($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[4]==$number[4]){ $result=1; } return $result; } function ssc9($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[1]==$number[1] && $betlist[2]==$number[2]){ $result=1; } return $result; } function ssc10($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[1]==$number[1] && $betlist[3]==$number[3]){ $result=1; } return $result; } function ssc11($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[2]==$number[2] && $betlist[3]==$number[3]){ $result=1; } return $result; } function ssc12($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[2]==$number[2] && $betlist[1]==$number[1] && $betlist[3]==$number[3]){ $result=1; } return $result; } function ssc13($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[0]==$number[0] && $betlist[1]==$number[1] && $betlist[2]==$number[2] && $betlist[3]==$number[3]){ $result=1; } return $result; } function ssc14($bet,$data){ $result=0; $number=explode(",", $data); unset($number[4]);unset($number[5]);unset($number[6]); $c=array_count_values($number); $betlist=str_split($bet); $c2=array_count_values($betlist); print_r($c); print_r($c2); $count=0; foreach($c2 as $key=>$value){ if(in_array($key,$number)){ if($value<=$c[$key]){ $count=$count+$value; } } } if($count==2){ $result=1; } return $result; } function ssc15($bet,$data){ $result=0; $number=explode(",", $data); unset($number[4]);unset($number[5]);unset($number[6]); $c=array_count_values($number); $betlist=str_split($bet); $c2=array_count_values($betlist); $count=0; foreach($c2 as $key=>$value){ if(in_array($key,$number)){ if($value<=$c[$key]){ $count=$count+$value; } } } if($count>=3){ $result=1; } return $result; } function ssc16($bet,$data){ $result=0; $number=explode(",", $data); unset($number[4]);unset($number[5]);unset($number[6]); $c=array_count_values($number); $betlist=str_split($bet); $c2=array_count_values($betlist); $count=0; foreach($c2 as $key=>$value){ if(in_array($key,$number)){ if($value<=$c[$key]){ $count=$count+$value; } } } if($count==4){ $result=1; } return $result; } function ssc17($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist["0"]==$number["0"]){ $result=1; } return $result; } function ssc18($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist["1"]==$number["1"]){ $result=1; } return $result; } function ssc19($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist["2"]==$number["2"]){ $result=1; } return $result; } function ssc20($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist["3"]==$number["3"]){ $result=1; } return $result; } function ssc21($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist["4"]==$number["4"]){ $result=1; } return $result; } function ssc22($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[1]==$number[1] && $betlist[4]==$number[4]){ $result=1; } return $result; } function ssc23($bet,$data){ $result=0; $number=explode(",", $data); $betlist=str_split($bet); if($betlist[2]==$number[2] && $betlist[4]==$number[4]){ $result=1; } return $result; } function ssc24($bet,$data){ $result=0; $number=explode(",", $data); $he=$number[0]+$number[1]+$number[2]+$number[3]+$number[4]; if($he>=23){ $result=1; } return $result; } function ssc25($bet,$data){ $result=0; $number=explode(",", $data); $he=$number[0]+$number[1]+$number[2]+$number[3]+$number[4]; if($he<=22){ $result=1; } return $result; } function ssc26($bet,$data){ $result=0; $number=explode(",", $data); $he=$number[0]+$number[1]+$number[2]+$number[3]+$number[4]; if($he%2!=0){ $result=1; } return $result; } function ssc27($bet,$data){ $result=0; $number=explode(",", $data); $he=$number[0]+$number[1]+$number[2]+$number[3]+$number[4]; if($he%2==0){ $result=1; } return $result; } function ssc28($bet,$data){ $result=0; $number=explode(",", $data); if($number[0]>$number[4]){ $result=1; } return $result; } function ssc29($bet,$data){ $result=0; $number=explode(",", $data); if($number[0]<$number[4]){ $result=1; } return $result; } function ssc30($bet,$data){ $result=0; $number=explode(",", $data); if($number[0]==$number[4]){ $result=1; } return $result; }}
划线
评论
复制
发布于: 2020 年 07 月 12 日 阅读数: 39
网站,小程序,APP开发定制
关注
编辑个人签名 2020.07.05 加入
编辑个人简介
评论