七星彩网站源码
这个程序也是目前相对比较完整的一个项目,支持电脑版,和手机版,手机版是响应式的,网站采用了php+mysql开发实现的,也是目前比较主流的开发模式。
申明:这个项目代码,只是提供学习使用,不得用于其他用途,谢谢配合
前端时间帮朋友做了一个这样的程序,是湛江和海南那边的下单投注卖码的程序系统,经过差不多一个多月的时间,终于把这个项目完整的开发出来,接下来我给大家介绍一下,这些算法是怎么实现的和原理,希望可以帮到大家的学习,不要用来做其他事就可以。
手机版:
这个是快选
class fastchoosecontroller extends homebasecontroller {
protected $user_model;
public function __construct() {
parent::__construct();
$this->check_login();
$this->user_model = m("user");//打款凭证
}
public function index() {
$this->display();
}
public function setfastbeatitem(){
header("content-type: application/json");
if($this->user['lock']==1){
m("user")->where(array("id"=>$this->user["id"]))->save(array('lock'=>0));
$this->ejson("操作太快,稍等下再来下注吧");
}
if($this->user['user_status']==2){
$this->ejson('禁止下注');
}
m("user")->where(array("id"=>$this->user["id"]))->save(array('lock'=>1));
/* $_post['amount']=1;
$_post['amountcount']=4000;
$_post['bzxx']='三字定';
$_post['data']='{"b2":[],"b3":[],"b4":[],"b5":[],"b6":[],"b7":[],"b9":["111x"],"b10":[],"b11":[],"b12":[],"b13":[],"b14":[],"b15":[],"b16":[],"b17":[],"b18":[]}';*/
$zmmtime=time();
ob_start();
@set_time_limit(0);
@ini_set("memory_limit", "512m");
$type=m('type')->where(array('id'=>'1'))->find();
$now=getnow('1',1);
$data['drawdt']=$now['drawdt'];
$data['opendt']=$now['opendt'];
if(time()<=strtotime($data['opendt'])){
$this->ejson("下注失败");
}
//获取上级帐户分批管理
for($i=$this->user["parent"];$i>0;$i){
$agent=m('agent')->find($i);
$agentlist[$i]=$agent;
$agentts[$i]=json_decode($agent["commission"],true);
$ff[]=$i;
$caopan[$i]=json_decode($agent["caopansetting"],true);
$i=$agent["parent"];
}
$commissionodds=json_decode($agent['commissionodds'],true);
$periodsnumber=$now["hm"];
$commission=json_decode($this->user["commission"],true);
$sjcommission=json_decode($this->user["sjcommission"],true);
$betnumber=json_decode($_post["data"],true);
$ky_money=$this->user['money']-$this->user['yymoney'];
if($ky_money<$_post["amountcount"]){
$this->ejson("信用额度不足");
}
$money=0;
$data=array();
$bet=array();
$betxx=array();
$betlist=array();
$bet2=array();
$bet2xx=array();
$bet2list=array();
$betinfoid=time();
if($this->user["periodsnumber"]==$periodsnumber){
$xxx=file_get_contents("storexx/".md5($this->user["id"])."text");
$storexx=json_decode($xxx,true);
}
else{
$storexx=array();
}
$playlist=array();
$count=0;
$bet["backcomm"]=0;
$bet["count"]=0;
//查询数据库本期该类型已经下了多少钱的
$bet666['periodsnumber'] = $periodsnumber;
$bet666['betnumber']=$value;
$bet666['sftm']=0;
$sum666=m('userbet'.$this->user['id'])->where($bet666)->sum('betamount');
if($maxcount<($typemoney[$value]+$sum666+0) || $maxbet<$_post["amount"]+$storexx[$result['number']]+0){
$typemoney[$played["id"]]=$typemoney[$played["id"]]-$_post["amount"];
$bet2["betnumber"]=$value;
$bet2list[]=$bet2;
$isstopnum=55;
if(count($bet2list)==20){
m("bet2")->addall($bet2list);
$bet2list=array();
}
}
else{
unset($xiatiao);
//start
$bet4['betnumber']=$bet3['betnumber']=$value;
$bet4['bettypeid']=$bet3['bettypeid']=$i;
if(empty($bet3s[$value])){
$bet3['betamount']=$_post["amount"];
$save1['betamount']='0';
$max_money=$_post["amount"];
}else{
$bet3['betamount']=$max_money=$save1['betamount']=$bet3s[$value]['betamount']+$_post["amount"];
}
//判断当前金额在哪个级别
foreach ($commissionodds[$bet3['bettypeid']] as $kco => $vco) {
if(isset($vco)){
if($vco['is_use']==1&&$vco['startamount']<=$max_money&&$max_money<$vco['amountup']){
$odds1=getodds2($vco['maxlimitsiglebet'],$bet4['betnumber']);
$xiatiao=getodds1($played,$bet4['betnumber'])-$odds1;
}
}
}
$xiatiao=isset($xiatiao)?$xiatiao:0;
$odds=getodds($played,$this->user,$value);
$odds=$odds-$xiatiao;
if($bet3['bettypeid']!=16&&$bet3['bettypeid']!=15&&$bet3['bettypeid']!=14){
if(isset($bet3s[$value])){
$odds=$odds-$bet3s[$value]['xiatiao'];
}
$bet3[odds]=$xiatiao;
$bet3['id']=isset($bet3s[$value])?$bet3s[$value]['id']:0;
$bet5[]=$bet3;
}
//end
$bet["backcomm"]=$bet["backcomm"]+$backcomm;
$money=$money+$_post["amount"];
$storexx[$value]=$storexx[$value]+$_post["amount"]+0;
$add=array();
$add["odds"]=$odds;
$add["betnumber"]=$value;
$add["playedid"]=$bet["playedid"];
$add["betinfoid"]=$bet["betinfoid"];
$add["betamount"]=$_post["amount"];
$add["backcomm"]=$backcomm;
$add["profitandloss"]=$bet["profitandloss"];
$add["periodsnumber"]=$periodsnumber;
$add["betdt"]=$bet["betdt"];
$tongji[$played["bettypeid"]]["betamount"]+=$_post["amount"];
$tongji[$played["bettypeid"]]["zjiang"]=0;
//$tongji[$played["bettypeid"]]["backcomm"]+=$add["backcomm"];
$tongji[$played["bettypeid"]]["profitandloss"]=0;
$tongji[$played["bettypeid"]]["count"]+=1;
//计算反水 占成
$pratio=$this->user['ratio'];;
$pratios=100;
$mfsxx=array();
$mlhxx=array();
$ymoney=0;
$is_fs=0;
$agent['parent']=$this->user['parent'];
$commission1=json_decode($this->user['commission'],true);
for($ii=$agent['parent'];$ii>0;$ii){
$agent=$agentlist[$ii];
$sjcommission1=$commission1;
$commission1=json_decode($agent["commission"],true);
$fszc=$sjcommission1[$i]['commission']-$commission1[$i]['commission'];
$fsmoney=$fszc*($add['betamount']-$ymoney);
if($commission1[$i]['maxlimitstore']==0&&$agent['agentlevel']!==1){
$pratio=0;
}
$lhmoney=$pratio*$add['betamount']/100;
if($lhmoney<=0){
$lhmoney=0;
}
if($lhmoney+$ymoney>$add['betamount']){
$lhmoney=$add['betamount']-$ymoney;
}
//拦货 占成金额大于拦货金额的情况下拦货 $zlhmoney[$ii][$add['playedid']]
if(($add['betamount']*$pratio/100)>$commission1[$i]['maxlimitstore']){
if($zlhmoney[$ii][$add['betnumber']]+$lhmoney>$commission1[$i]['maxlimitstore']){
$lhmoney=$commission1[$i]['maxlimitstore']-$zlhmoney[$ii][$add['betnumber']];
}
}
//判断是谁回收 1代表大股东 0代表公司
if($agent['agentlevel']==2&&$agent['is_fs']==1){
$is_fs=1;
}
if($is_fs==0){
if($agent['agentlevel']==1){
$lhmoney=$add["betamount"]-$ymoney;
}
}else{
//还要去掉公司占成
if($agent['agentlevel']==2){
$lhmoney=$add["betamount"]-$ymoney-($agent['pratio']*$add['betamount']/100);
}
}
$ymoney+=$lhmoney;
//$agentmoney[$i]+=$lhmoney;
$mlhxx[$ii]['money']=$lhmoney;
$mlhxx[$ii]['win']=0;
$lhxx[$ii]['money']+=$lhmoney;
$lhxx[$ii]['win']=0;
$tongji[$played["bettypeid"]]['lhxx'][$ii]['money']=0;
$tongji[$played["bettypeid"]]['lhxx'][$ii]['win']=0;
$zlhmoney[$ii][$add['betnumber']]+=$lhmoney;
if($fsmoney>0){
$mfsxx[$ii]=$fsmoney;
$fsxx[$ii]+=$fsmoney;
$tongji[$played["bettypeid"]]['fsxx'][$ii]=0;
//$agentmoney[$ii]+=$fsmoney;
}
$bet4['agentid']=$ii;
if(empty($bet9s[$ii][$value])){
$bet4['lhmoney']=$lhmoney;
$bet4['betamount']=$add['betamount'];
}else{
$bet4['id']=$bet9s[$ii][$value]['id'];
$bet4['lhmoney']=$lhmoney+$bet9s[$ii][$value]['lhmoney'];
$bet4['betamount']=$add['betamount']+$bet9s[$ii][$value]['betamount'];
}
$bet6[]=$bet4;
if($bet4['lhmoney']>$caopan[$ii][$bet3['bettypeid']]&&isset($caopan[$ii][$bet3['bettypeid']])){
$bet991['money']=$bet4['lhmoney']-$caopan[$ii][$bet3['bettypeid']];
$bet991['bettypeid']=$bet4['bettypeid'];
$bet991['betnumber']=$bet4['betnumber'];
$bet991['agentid']=$bet4['agentid'];
$bet991['periodsnumber']=$bet4['periodsnumber'];
if(!empty($bet99s[$ii][$value])){
$bet991['id']=$bet99s[$ii][$value]['id'];
}
$bet7[]=$bet991;
}
$ii=$agent["parent"];
$pratio=$agent['pratio'];
$pratios=$pratios-$pratio;
if($agent['agentlevel']==1){
$agent["parent"]=0;
}
if($ymoney==$add['betamount']){
$ii=0;
}
}
$add['lhxx']=json_encode($mlhxx);
$add['fsxx']=json_encode($mfsxx);
以上是这个快选这样的功能内容,下一章我这边讲都是,快驿功能,后面还有......
有什么不明白的,关于这个算法了解的,可以交流,我扣3053723033
上一篇: AI怎么绘制螺旋状的线条图形?
下一篇: Fireworks工作区基础知识概述