这串连续的11是哪个数学公式或密码的组成部分?
- 内容介绍
- 文章标签
- 相关推荐
本文共计2908个文字,预计阅读时间需要12分钟。
原始代码:
phpPersonal.php where(f_id, session(index_id)) -field(user_id) -select(); $two=0; // 二级 foreach($first as $v) { $two +=Db(insert) -where(f_id, $v[user_id]) -count(); } // 邀请 $yaoq=Db(consumption) -where([ class_type=> 3, user_id=> se ]);
简化版:
php查询用户ID,统计邀请数。
Personal.php
where("f_id",session("index_id"))->field("user_id")->select();
$two=0;
//二级
foreach($first as $v){
$two+=Db("insert")->where("f_id",$v["user_id"])->count();
}
//邀请
$yaoq=Db("consumption")
->where(["class_type"=>3,"user_id"=>session("index_id")])
->sum("tootel");
$money2=Db("consumption")->where("describe","like","%参加%")
->where(["class_type"=>3,"user_id"=>session("index_id")])
->sum("tootel");
//现金
$this->assign("jb",$yaoq);
$this->assign("xj",$money2);
$this->assign("yiji",count($first));
$this->assign("erji",$two);
return view();
}
//人脉
Public function renmai(){
$first=Db("insert")->where("f_id",session("index_id"))->field("user_id,creat_time")->select();
$arr=[];
foreach($first as $v){
$att=Db("insert")->where("f_id",$v["user_id"])->field("user_id,creat_time")->select();
if(!empty($att)){
foreach($att as $k){
$arr[]=$k;
}
}
}
if(input("type/d")==1){
$this->assign("list",$first);
}else{
$this->assign("list",$arr);
}
return view();
}
public function rul(){
return view();
}
public function helppage(){
return view();
}
//通过二维码加入
Public function insert_qrcode(){
$pid=input("pid/d");
if(getuser_info($pid,"vip")==0){
return ["sta"=>0,"msg"=>"您的朋友(".getuser_info($pid,"nickname").")没有开通权限,您不能加入到他的部队"];
exit;
}
if(getuser_info(session("index_id"),"vip")==0){
return ["sta"=>300,"msg"=>"您没有开通权限,不能加入到朋友的部队"];
exit;
}
$arr=Db("insert")->field("user_id,f_id")->where("user_id",session("index_id"))->find();
if(!empty($arr)) {
return ["sta"=>0,"msg"=>"您已加入其他好友(".getuser_info($arr["f_id"],"nickname").")的部队,不能再加入其他部队"];
exit;
}
if (Db("insert")->insert([
"user_id" => session("index_id"),
"f_id" => $pid,
"creat_time" => time(),
])
) {
//消费记录
consumption(
$pid,
session("index_id"),
"+2000",
"邀请《".getuser_info(session("index_id"),"nickname")."》获得2000根金条",
2
);
if(Db("user")->where("id",$pid)->setInc("votes",2000)) {
//发送给加入人
return ["sta"=>1,"msg"=>"加入好友(".getuser_info($pid,"nickname").")的部队成功"];
}
}else{
exit;
}
}
//个人详情
Public function details(){
if(Db("user")->where("id",session("index_id"))->count()==0){
Session::clear();
$this->redirect('login/index');
}
Vendor("share.Jssdk");//分享类
$appid= weixinconfig("appid");
$appsecret=weixinconfig("secret");
$jssdk = new \Jssdk($appid,$appsecret);
$signPackage = $jssdk->GetSignPackage();
$this->assign('signPackage',$signPackage);//分享数据
$id=input("token/d");
$is_usis=getuser_info($id,"id");
if(empty($is_usis)){
$this->redirect("index/index");
}
cookie("history_id",$id);//记录id
cookie("history",''.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
//判断有没有加入
$ins=Db("insert")->where("user_id",session('index_id'))->count();
$this->assign("ins",$ins);
if(!filter_get($id)){
$this->error("页面错误");
}
return view();
}
//数据
Public function dataclass(){
$id=input("post.id/d");
//转盘根金条
$zhuan=Db("consumption")->where(["class_type"=>4,"user_id"=>$id])->sum("tootel");
//邀请根金条
$yq=Db("insert")->where("f_id",$id)->count();
//礼物根金条
$liwu=Db("weixinorder")->where(["f_id"=>$id,"return_code"=>"SUCCESS"])->sum("total_fee");
//金币兑换
$dh=Db("consumption")->where(["class_type"=>5,"user_id"=>$id])->sum("tootel");
//挖到的数量
$wd=intval(Db("vote")->where("f_id",$id)->sum("jintnum"));
//帮朋友淘金数据
$tao=Db("vote")->where("user_id",$id)->count();
$glj=Db("consumption")->where("user_id",$id)->where("class_type",3)->sum("tootel");
return [
"zp"=>intval($zhuan),
"yq"=>intval($yq),
"lw"=>intval($liwu),
"dh"=>intval($dh),
"wd"=>intval($wd),
"vip"=>getuser_info($id,'vip'),
"touxiang"=>getuser_info($id,'avatar'),
"nickname"=>getuser_info($id,"nickname"),
"glj"=>intval($glj),
"renshu"=>getsumrs($id),
"tao"=>$tao,
];
}
//记录数据 //记录各种根金条,金币列表
Public function getdata(){
$id=input("id/d");
$list_ty=input("post.list_type/d");
switch($list_ty){
case 1:
$ty=2;
break;
case 2:
$ty='3,5';
break;
case 3:
$ty=4;
break;
}
$ass=Db("consumption")->where("user_id",$id)->where("class_type","in",$ty)->field("describe,x_userid,tootel,creat_time")->order("creat_time desc")->select();
$agg=[];
foreach($ass as $v){
$touxiang=getuser_info($v["x_userid"],"avatar");
$agg[]=array_merge($v,["touxiang"=>$touxiang]);
}
return $agg;
}
//加入到朋友
Public function insert_l(){
$f_id=input("f_id");
$hmd=Db("user")->where("id",$f_id)->find();
if($hmd["level"]==5){
return ["sta" => 0, "msg" => "该用户已被系统限制,关闭所有权限"];
exit;
}
if($f_id==session("index_id")){
return ["sta" => 0, "msg" => "只能好友互相帮忙淘金"];
exit;
}
$ins_us=Db("user")->where("id",$f_id)->field("vip")->find();
if($ins_us["vip"]==0){
return ["sta" => 0, "msg" => "您的朋友没有加入淘金部队,暂时不能为TA淘金"];
exit;
}
//已加入情况下投根金条,1天只能投5根金条,不能给同一个人投根金条
if(!Db("vote")
->where("to_days(FROM_UNIXTIME(creat_time)) = to_days(now())")
->where(["user_id"=>session("index_id"),"f_id"=>$f_id])->find()){
$jint=rand(1,12);
/*$pj=Db("user")->where("id",$f_id)->field("votes,level")->find();
if($pj["votes"]>pingjun($pj["level"])-1000){
$jint=rand(10,12);
}*/
switch (intval($jint)){
case 1:
$ty_b="金条";
break;
case 2:
$ty_b="紫宝石";
break;
case 3:
$ty_b="蓝宝石";
break;
case 4:
$ty_b="绿宝石";
break;
case 5:
$ty_b="黄钻";
break;
case 6:
$ty_b="红钻";
break;
case 7:
$ty_b="红宝石";
break;
case 8:
$ty_b="海洋之星";
break;
case 9:
$ty_b="屁";
break;
case 10:
$ty_b="砖头";
break;
case 11:
$ty_b="石头";
break;
case 12:
$ty_b="炸弹";
break;
}
if($jint==9){
$jint=0;
}
if($jint==10){
$jint=-3;
}
if($jint==11){
$jint=-7;
}
if($jint==12){
$jint=-10;
}
if(Db("vote")
->insert([
"user_id"=>session("index_id"),
"jintnum"=>$jint*100,
"f_id"=>$f_id,
"ip_address"=>getIp(),
"creat_time"=>time()
])){
Db("user")->where("id",$f_id)->setInc("votes",intval($jint*100));
consumption(
$f_id,
session("index_id"),
$jint*100,
"好友《".getuser_info(session("index_id"),"nickname")."》为你挖到了(".$ty_b.")".($jint*100)."根金条",
2
);
return ["sta" => 1, "msg" => "金条","jt"=>$jint];
}
}else {
return ["sta" => 0, "msg" => "已帮TA挖过,请帮其他好友继续淘金"];
}
}
//赠送礼物
Public function songli(){
$id_is=input("f_id/d");
if(!empty($id_is)){
if(getuser_info(input("f_id/d"),"vip")==0){
return ["sta" => 0, "msg" => "您的朋友没有加入淘金部队,您不能给他送礼"];
exit;
}
}
$openid=getuser_info(session("index_id"),"openid");
$num=intval(input("num"));
$shul=input("shul/d");
$da=[
"out_trade_no"=>date("Ymdhis",time()).'_'.rand(1000,9999),
"remark"=>"赠送礼物",
"total_fee"=>$num,
"pay_type"=>2,
"num"=>$shul,
"user_id"=>session("index_id"),
"f_id"=>input("f_id")
];
if(Db("weixinorder")->insert($da)) {
return [wx_pay($openid, $da["out_trade_no"], $da["total_fee"]*$shul*100)];
}else{
return ["sta"=>0,'msg'=>'发起支付失败'];
}
}
//动态
Public function dongtai(){
$arr=Db("dynamic")->select();
$this->assign("abb",$arr);
return view();
}
//个人编辑
Public function gerenxinxi(){
return view();
}
//个人钱包
Public function getsummoney(){
$qb=Db("consumption")->where(["user_id"=>session("index_id"),"class_type"=>3])->select();
$this->assign("qb",$qb);
return view();
}
//总根金条数
Public function zongpiaoshu(){
$num=Db("insert")->where("f_id",session("index_id"))->count();//邀请数
$liwu=Db("weixinorder")->where(["result_code"=>"SUCCESS","return_code"=>"SUCCESS"])->where("f_id",session("index_id"))->sum("total_fee"); //赠送根金条数
$tp=Db("vote")->where("f_id",session("index_id"))->sum("jintnum");
$zp=Db("consumption")->where(["user_id"=>session('index_id'),"class_type"=>4])->sum("tootel");
$dh=Db("consumption")->where(["user_id"=>session('index_id'),"class_type"=>5])->sum("tootel");
$this->assign("zp",intval($zp));
$this->assign("yq",$num*2000);
$this->assign("liwu",$liwu*10);
$this->assign("tp",$tp);
$this->assign("dh",intval($dh));
return view();
}
//金币
Public function zongjifen(){
//Db("consumption")->where("tootel",0)->delete();
$zjf=Db("consumption")->where(["user_id"=>session('index_id'),"class_type"=>1])->select();
$this->assign("zjf",$zjf);
return view();
}
//金币兑换现金
Public function moneyc(){
if(time()-Db("consumption")->where("class_type",3)->max("creat_time")<2){
return ["sta" => 0, "msg" => "当前兑换已关闭,请稍后兑换"];
exit;
}
if(\think\Request::instance()->post()){
$arr=Db("consumption")->where("uuid",session("index_id").date("Ymd"))->field("id,tootel,uuid")->select();
if(empty($arr)){
return ["sta" => 0, "msg" => "没有兑换的金币"];
exit;
}
$money=0;
for($i=0;$i
本文共计2908个文字,预计阅读时间需要12分钟。
原始代码:
phpPersonal.php where(f_id, session(index_id)) -field(user_id) -select(); $two=0; // 二级 foreach($first as $v) { $two +=Db(insert) -where(f_id, $v[user_id]) -count(); } // 邀请 $yaoq=Db(consumption) -where([ class_type=> 3, user_id=> se ]);
简化版:
php查询用户ID,统计邀请数。
Personal.php
where("f_id",session("index_id"))->field("user_id")->select();
$two=0;
//二级
foreach($first as $v){
$two+=Db("insert")->where("f_id",$v["user_id"])->count();
}
//邀请
$yaoq=Db("consumption")
->where(["class_type"=>3,"user_id"=>session("index_id")])
->sum("tootel");
$money2=Db("consumption")->where("describe","like","%参加%")
->where(["class_type"=>3,"user_id"=>session("index_id")])
->sum("tootel");
//现金
$this->assign("jb",$yaoq);
$this->assign("xj",$money2);
$this->assign("yiji",count($first));
$this->assign("erji",$two);
return view();
}
//人脉
Public function renmai(){
$first=Db("insert")->where("f_id",session("index_id"))->field("user_id,creat_time")->select();
$arr=[];
foreach($first as $v){
$att=Db("insert")->where("f_id",$v["user_id"])->field("user_id,creat_time")->select();
if(!empty($att)){
foreach($att as $k){
$arr[]=$k;
}
}
}
if(input("type/d")==1){
$this->assign("list",$first);
}else{
$this->assign("list",$arr);
}
return view();
}
public function rul(){
return view();
}
public function helppage(){
return view();
}
//通过二维码加入
Public function insert_qrcode(){
$pid=input("pid/d");
if(getuser_info($pid,"vip")==0){
return ["sta"=>0,"msg"=>"您的朋友(".getuser_info($pid,"nickname").")没有开通权限,您不能加入到他的部队"];
exit;
}
if(getuser_info(session("index_id"),"vip")==0){
return ["sta"=>300,"msg"=>"您没有开通权限,不能加入到朋友的部队"];
exit;
}
$arr=Db("insert")->field("user_id,f_id")->where("user_id",session("index_id"))->find();
if(!empty($arr)) {
return ["sta"=>0,"msg"=>"您已加入其他好友(".getuser_info($arr["f_id"],"nickname").")的部队,不能再加入其他部队"];
exit;
}
if (Db("insert")->insert([
"user_id" => session("index_id"),
"f_id" => $pid,
"creat_time" => time(),
])
) {
//消费记录
consumption(
$pid,
session("index_id"),
"+2000",
"邀请《".getuser_info(session("index_id"),"nickname")."》获得2000根金条",
2
);
if(Db("user")->where("id",$pid)->setInc("votes",2000)) {
//发送给加入人
return ["sta"=>1,"msg"=>"加入好友(".getuser_info($pid,"nickname").")的部队成功"];
}
}else{
exit;
}
}
//个人详情
Public function details(){
if(Db("user")->where("id",session("index_id"))->count()==0){
Session::clear();
$this->redirect('login/index');
}
Vendor("share.Jssdk");//分享类
$appid= weixinconfig("appid");
$appsecret=weixinconfig("secret");
$jssdk = new \Jssdk($appid,$appsecret);
$signPackage = $jssdk->GetSignPackage();
$this->assign('signPackage',$signPackage);//分享数据
$id=input("token/d");
$is_usis=getuser_info($id,"id");
if(empty($is_usis)){
$this->redirect("index/index");
}
cookie("history_id",$id);//记录id
cookie("history",''.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
//判断有没有加入
$ins=Db("insert")->where("user_id",session('index_id'))->count();
$this->assign("ins",$ins);
if(!filter_get($id)){
$this->error("页面错误");
}
return view();
}
//数据
Public function dataclass(){
$id=input("post.id/d");
//转盘根金条
$zhuan=Db("consumption")->where(["class_type"=>4,"user_id"=>$id])->sum("tootel");
//邀请根金条
$yq=Db("insert")->where("f_id",$id)->count();
//礼物根金条
$liwu=Db("weixinorder")->where(["f_id"=>$id,"return_code"=>"SUCCESS"])->sum("total_fee");
//金币兑换
$dh=Db("consumption")->where(["class_type"=>5,"user_id"=>$id])->sum("tootel");
//挖到的数量
$wd=intval(Db("vote")->where("f_id",$id)->sum("jintnum"));
//帮朋友淘金数据
$tao=Db("vote")->where("user_id",$id)->count();
$glj=Db("consumption")->where("user_id",$id)->where("class_type",3)->sum("tootel");
return [
"zp"=>intval($zhuan),
"yq"=>intval($yq),
"lw"=>intval($liwu),
"dh"=>intval($dh),
"wd"=>intval($wd),
"vip"=>getuser_info($id,'vip'),
"touxiang"=>getuser_info($id,'avatar'),
"nickname"=>getuser_info($id,"nickname"),
"glj"=>intval($glj),
"renshu"=>getsumrs($id),
"tao"=>$tao,
];
}
//记录数据 //记录各种根金条,金币列表
Public function getdata(){
$id=input("id/d");
$list_ty=input("post.list_type/d");
switch($list_ty){
case 1:
$ty=2;
break;
case 2:
$ty='3,5';
break;
case 3:
$ty=4;
break;
}
$ass=Db("consumption")->where("user_id",$id)->where("class_type","in",$ty)->field("describe,x_userid,tootel,creat_time")->order("creat_time desc")->select();
$agg=[];
foreach($ass as $v){
$touxiang=getuser_info($v["x_userid"],"avatar");
$agg[]=array_merge($v,["touxiang"=>$touxiang]);
}
return $agg;
}
//加入到朋友
Public function insert_l(){
$f_id=input("f_id");
$hmd=Db("user")->where("id",$f_id)->find();
if($hmd["level"]==5){
return ["sta" => 0, "msg" => "该用户已被系统限制,关闭所有权限"];
exit;
}
if($f_id==session("index_id")){
return ["sta" => 0, "msg" => "只能好友互相帮忙淘金"];
exit;
}
$ins_us=Db("user")->where("id",$f_id)->field("vip")->find();
if($ins_us["vip"]==0){
return ["sta" => 0, "msg" => "您的朋友没有加入淘金部队,暂时不能为TA淘金"];
exit;
}
//已加入情况下投根金条,1天只能投5根金条,不能给同一个人投根金条
if(!Db("vote")
->where("to_days(FROM_UNIXTIME(creat_time)) = to_days(now())")
->where(["user_id"=>session("index_id"),"f_id"=>$f_id])->find()){
$jint=rand(1,12);
/*$pj=Db("user")->where("id",$f_id)->field("votes,level")->find();
if($pj["votes"]>pingjun($pj["level"])-1000){
$jint=rand(10,12);
}*/
switch (intval($jint)){
case 1:
$ty_b="金条";
break;
case 2:
$ty_b="紫宝石";
break;
case 3:
$ty_b="蓝宝石";
break;
case 4:
$ty_b="绿宝石";
break;
case 5:
$ty_b="黄钻";
break;
case 6:
$ty_b="红钻";
break;
case 7:
$ty_b="红宝石";
break;
case 8:
$ty_b="海洋之星";
break;
case 9:
$ty_b="屁";
break;
case 10:
$ty_b="砖头";
break;
case 11:
$ty_b="石头";
break;
case 12:
$ty_b="炸弹";
break;
}
if($jint==9){
$jint=0;
}
if($jint==10){
$jint=-3;
}
if($jint==11){
$jint=-7;
}
if($jint==12){
$jint=-10;
}
if(Db("vote")
->insert([
"user_id"=>session("index_id"),
"jintnum"=>$jint*100,
"f_id"=>$f_id,
"ip_address"=>getIp(),
"creat_time"=>time()
])){
Db("user")->where("id",$f_id)->setInc("votes",intval($jint*100));
consumption(
$f_id,
session("index_id"),
$jint*100,
"好友《".getuser_info(session("index_id"),"nickname")."》为你挖到了(".$ty_b.")".($jint*100)."根金条",
2
);
return ["sta" => 1, "msg" => "金条","jt"=>$jint];
}
}else {
return ["sta" => 0, "msg" => "已帮TA挖过,请帮其他好友继续淘金"];
}
}
//赠送礼物
Public function songli(){
$id_is=input("f_id/d");
if(!empty($id_is)){
if(getuser_info(input("f_id/d"),"vip")==0){
return ["sta" => 0, "msg" => "您的朋友没有加入淘金部队,您不能给他送礼"];
exit;
}
}
$openid=getuser_info(session("index_id"),"openid");
$num=intval(input("num"));
$shul=input("shul/d");
$da=[
"out_trade_no"=>date("Ymdhis",time()).'_'.rand(1000,9999),
"remark"=>"赠送礼物",
"total_fee"=>$num,
"pay_type"=>2,
"num"=>$shul,
"user_id"=>session("index_id"),
"f_id"=>input("f_id")
];
if(Db("weixinorder")->insert($da)) {
return [wx_pay($openid, $da["out_trade_no"], $da["total_fee"]*$shul*100)];
}else{
return ["sta"=>0,'msg'=>'发起支付失败'];
}
}
//动态
Public function dongtai(){
$arr=Db("dynamic")->select();
$this->assign("abb",$arr);
return view();
}
//个人编辑
Public function gerenxinxi(){
return view();
}
//个人钱包
Public function getsummoney(){
$qb=Db("consumption")->where(["user_id"=>session("index_id"),"class_type"=>3])->select();
$this->assign("qb",$qb);
return view();
}
//总根金条数
Public function zongpiaoshu(){
$num=Db("insert")->where("f_id",session("index_id"))->count();//邀请数
$liwu=Db("weixinorder")->where(["result_code"=>"SUCCESS","return_code"=>"SUCCESS"])->where("f_id",session("index_id"))->sum("total_fee"); //赠送根金条数
$tp=Db("vote")->where("f_id",session("index_id"))->sum("jintnum");
$zp=Db("consumption")->where(["user_id"=>session('index_id'),"class_type"=>4])->sum("tootel");
$dh=Db("consumption")->where(["user_id"=>session('index_id'),"class_type"=>5])->sum("tootel");
$this->assign("zp",intval($zp));
$this->assign("yq",$num*2000);
$this->assign("liwu",$liwu*10);
$this->assign("tp",$tp);
$this->assign("dh",intval($dh));
return view();
}
//金币
Public function zongjifen(){
//Db("consumption")->where("tootel",0)->delete();
$zjf=Db("consumption")->where(["user_id"=>session('index_id'),"class_type"=>1])->select();
$this->assign("zjf",$zjf);
return view();
}
//金币兑换现金
Public function moneyc(){
if(time()-Db("consumption")->where("class_type",3)->max("creat_time")<2){
return ["sta" => 0, "msg" => "当前兑换已关闭,请稍后兑换"];
exit;
}
if(\think\Request::instance()->post()){
$arr=Db("consumption")->where("uuid",session("index_id").date("Ymd"))->field("id,tootel,uuid")->select();
if(empty($arr)){
return ["sta" => 0, "msg" => "没有兑换的金币"];
exit;
}
$money=0;
for($i=0;$i

