Commit 87b4b7e5 authored by houdong's avatar houdong

抽奖几率修改

parent 413768f1
...@@ -1135,10 +1135,10 @@ class IndexAction extends IdentityAction { ...@@ -1135,10 +1135,10 @@ class IndexAction extends IdentityAction {
$this->ajaxReturn(['status' =>0,'info'=>'请登录后再操作']); $this->ajaxReturn(['status' =>0,'info'=>'请登录后再操作']);
} }
$prizeList = [ $prizeList = [
'1' => ['name' => '100元现金奖励', 'score' => 100], '1' => ['name' => '100元现金奖励', 'score' => 0],
'2' => ['name' => '500元现金奖励', 'score' => 5], '2' => ['name' => '500元现金奖励', 'score' => 0],
'3' => ['name' => '300元现金奖励', 'score' => 10], '3' => ['name' => '300元现金奖励', 'score' => 0],
'4' => ['name' => '35元现金奖励', 'score' => 885] '4' => ['name' => '35元现金奖励', 'score' => 100]
]; ];
$arr =[]; $arr =[];
...@@ -1148,7 +1148,7 @@ class IndexAction extends IdentityAction { ...@@ -1148,7 +1148,7 @@ class IndexAction extends IdentityAction {
$prizeId = $this->get_rand($arr); $prizeId = $this->get_rand($arr);
$prizeName = $prizeList[$prizeId]['name']; $prizeName = $prizeList[$prizeId]['name'];
$insertData=['user_id'=>$userId,'user_name'=>$this->user['userName'],'prize'=>$prizeName,'add_time'=>time()]; $insertData=['user_id'=>$userId,'user_name'=>$this->user['userName'],'prize'=>$prizeName,'add_time'=>time(),'group_id'=>$this->GID];
M('PktopLuckydog')->add($insertData); M('PktopLuckydog')->add($insertData);
$this->ajaxReturn(['status' =>1,'info'=>'','name'=>$prizeName,'place'=>$prizeId]); $this->ajaxReturn(['status' =>1,'info'=>'','name'=>$prizeName,'place'=>$prizeId]);
...@@ -1184,7 +1184,7 @@ class IndexAction extends IdentityAction { ...@@ -1184,7 +1184,7 @@ class IndexAction extends IdentityAction {
// $this->ajaxReturn(['status' =>0,'info'=>'每月1日至7日才能抽奖']); // $this->ajaxReturn(['status' =>0,'info'=>'每月1日至7日才能抽奖']);
} }
//每人每个月只能抽一次奖 //每人每个月只能抽一次奖
$oldDog=M('PktopLuckydog')->where(['user_id'=>$userId])->order('add_time desc')->find(); $oldDog=M('PktopLuckydog')->where(['user_id'=>$userId,'group_id'=>$this->GID])->order('add_time desc')->find();
// if(!empty($oldDog)&&date('Y-m',$oldDog['add_time'])==date('Y-m')){ // if(!empty($oldDog)&&date('Y-m',$oldDog['add_time'])==date('Y-m')){
// $this->ajaxReturn(['status' =>0,'info'=>'您当月已经抽奖']); // $this->ajaxReturn(['status' =>0,'info'=>'您当月已经抽奖']);
// } // }
...@@ -1208,16 +1208,14 @@ class IndexAction extends IdentityAction { ...@@ -1208,16 +1208,14 @@ class IndexAction extends IdentityAction {
//这个月剩余的抽奖机会数量 //这个月剩余的抽奖机会数量
public function getLeftCjNum() { public function getLeftCjNum() {
// if(date('d')>7){
// return 0;
// }
$userId = $this->user['userID'];
$userId = $this->user['userID'];
$kaihuStatus=M()->db(10, C('DB_CONFIG_DEMO'))->table('cofool_pktop_kaihu')->where(['user_id'=>$userId])->find(); $kaihuStatus=M()->db(10, C('DB_CONFIG_DEMO'))->table('cofool_pktop_kaihu')->where(['user_id'=>$userId])->find();
if(empty($kaihuStatus)){ if(empty($kaihuStatus)){
return 0; return 0;
} }
$oldDog=M()->db(10, C('DB_CONFIG_DEMO'))->table('cofool_pktop_luckydog')->where(['user_id'=>$userId])->order('add_time desc')->find(); $where=['user_id'=>$userId,'group_id'=>$this->GID];
$oldDog=M()->db(10, C('DB_CONFIG_DEMO'))->table('cofool_pktop_luckydog')->where($where)->order('add_time desc')->find();
// if(!empty($oldDog)&&date('Y-m',$oldDog['add_time'])==date('Y-m')){ // if(!empty($oldDog)&&date('Y-m',$oldDog['add_time'])==date('Y-m')){
// return 0; // return 0;
// } // }
...@@ -1235,15 +1233,15 @@ class IndexAction extends IdentityAction { ...@@ -1235,15 +1233,15 @@ class IndexAction extends IdentityAction {
} }
//官方有奖赛列表页 //官方有奖赛列表页
public function moreDs(){ // public function moreDs(){
$userId=$this->user['userID']; // $userId=$this->user['userID'];
$this->setValue($userId); // $this->setValue($userId);
$this->assign('gid',$this->GID); // $this->assign('gid',$this->GID);
$gList=D('Niu')->getMoreDs($userId,'www'); // $gList=D('Niu')->getMoreDs($userId,'www');
$this->assign('gList',$gList); // $this->assign('gList',$gList);
$this->dianjiLog(); // $this->dianjiLog();
$this->display(); // $this->display();
} // }
public function dianjiLog(){ public function dianjiLog(){
$gid=$this->GID; $gid=$this->GID;
......
...@@ -182,34 +182,6 @@ class PkTopAction extends IdentityAction{ ...@@ -182,34 +182,6 @@ class PkTopAction extends IdentityAction{
// var_dump(DB_USER);exit; // var_dump(DB_USER);exit;
$this->assign('finalList', $finalList['finalList']); $this->assign('finalList', $finalList['finalList']);
//获奖名单,取前18名,暂不需要决赛名单
// $suffix = D('Userinfo')->getTable(FINALS_GROUP);
// $table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo';
// $where=array('sex'=>FINALS_GROUP,'new_phb'=>array('gt',0),'zt'=>1,'monthzzl'=>['gt',150]);
// $finalWinList = M($table, " ", C('DB_CONFIG_MNCG3'))->where($where)->order('zongup desc')->limit(18)->select();
//取昵称
// $userids = array();
// foreach ($finalWinList as $key => $f) {
// $userIDs = explode("X", $f['uid']);
// $userids[] = $userIDs[1];
// }
// $nick_name_arry =getUser($userids,'nick');
// foreach ($finalWinList as $key => &$w) {
// $userIDs = explode("X", $w['uid']);
// $w['user_id'] = $userIDs[1];
//// $nick_name = $nick_name_arry[$userIDs[1]];
// $w['username'] = $nick_name?$nick_name:$w['username'];
// }
// $top123[]=array_shift($finalWinList);
// $top123[]=array_shift($finalWinList);
// $top123[]=array_shift($finalWinList);
// $this->assign('top123',$top123);
// $this->assign('finalWinList',$finalWinList);
// $share=array('groupId'=>$groupId,'groupStatus'=>$groupStatus,'viewPage'=>2, // $share=array('groupId'=>$groupId,'groupStatus'=>$groupStatus,'viewPage'=>2,
// 'close_tips'=>'','userID'=>'XXXXXX','zhuangtai'=>$this->STATUS_TXT[$groupStatus]); // 'close_tips'=>'','userID'=>'XXXXXX','zhuangtai'=>$this->STATUS_TXT[$groupStatus]);
$share = array('groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus, $share = array('groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus,
...@@ -1158,10 +1130,8 @@ class PkTopAction extends IdentityAction{ ...@@ -1158,10 +1130,8 @@ class PkTopAction extends IdentityAction{
// $this->ajaxReturn(['status' =>0,'info'=>'每月1日至7日才能抽奖']); // $this->ajaxReturn(['status' =>0,'info'=>'每月1日至7日才能抽奖']);
} }
//每人每个月只能抽一次奖,改成只能抽一次奖 //每人每个月只能抽一次奖,改成只能抽一次奖
$oldDog=M('PktopLuckydog')->where(['user_id'=>$userId])->order('add_time desc')->find(); $oldDog=M('PktopLuckydog')->where(['user_id'=>$userId,'group_id'=>$this->GID])->order('add_time desc')->find();
// if(!empty($oldDog)&&date('Y-m',$oldDog['add_time'])==date('Y-m')){
// $this->ajaxReturn(['status' =>0,'info'=>'您当月已经抽奖']);
// }
if(!empty($oldDog)){ if(!empty($oldDog)){
$this->ajaxReturn(['status' =>0,'info'=>'您已经抽过奖了','uid'=>$userId]); $this->ajaxReturn(['status' =>0,'info'=>'您已经抽过奖了','uid'=>$userId]);
} }
...@@ -1173,26 +1143,22 @@ class PkTopAction extends IdentityAction{ ...@@ -1173,26 +1143,22 @@ class PkTopAction extends IdentityAction{
$this->ajaxReturn(['status' =>0,'info'=>'请联系管理员获取抽奖次数','uid'=>$userId]); $this->ajaxReturn(['status' =>0,'info'=>'请联系管理员获取抽奖次数','uid'=>$userId]);
} }
$suffix = D('Userinfo')->getTable($this->GID);
$table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo';
$lastmonthup = M($table, " ", C('DB_CONFIG_MNCG3'))->where(['uid'=>$this->GID.'X'.$userId])->getField('lastmonthup');
if($lastmonthup<=0){
// $this->ajaxReturn(['status' =>0,'info'=>'上月收益必须大于0才能抽奖']);
}
$this->ajaxReturn(['status' =>1,'info'=>'','uid'=>$userId]); $this->ajaxReturn(['status' =>1,'info'=>'','uid'=>$userId]);
} }
//取奖品 //取奖品
public function getLucky() { public function getLucky() {
$userId = $this->user['userID']; $userId = $this->user['userID'];
$userName = $this->user['userName'];
if($userId==0){ if($userId==0){
$this->ajaxReturn(['status' =>0,'info'=>'请登录后再操作']); $this->ajaxReturn(['status' =>0,'info'=>'请登录后再操作']);
} }
$prizeList = [ $prizeList = [
'1' => ['name' => '100元现金奖励', 'score' => 100], '1' => ['name' => '100元现金奖励', 'score' => 0],
'2' => ['name' => '500元现金奖励', 'score' => 5], '2' => ['name' => '500元现金奖励', 'score' => 0],
'3' => ['name' => '300元现金奖励', 'score' => 10], '3' => ['name' => '300元现金奖励', 'score' => 0],
'4' => ['name' => '35元现金奖励', 'score' => 885] '4' => ['name' => '35元现金奖励', 'score' => 100]
]; ];
$arr =[]; $arr =[];
...@@ -1202,7 +1168,7 @@ class PkTopAction extends IdentityAction{ ...@@ -1202,7 +1168,7 @@ class PkTopAction extends IdentityAction{
$prizeId = $this->get_rand($arr); $prizeId = $this->get_rand($arr);
$prizeName = $prizeList[$prizeId]['name']; $prizeName = $prizeList[$prizeId]['name'];
$insertData=['user_id'=>$userId,'user_name'=>$this->user['userName'],'prize'=>$prizeName,'add_time'=>time()]; $insertData=['user_id'=>$userId,'user_name'=>$userName,'prize'=>$prizeName,'add_time'=>time(),'group_id'=>$this->GID];
M('PktopLuckydog')->add($insertData); M('PktopLuckydog')->add($insertData);
$this->ajaxReturn(['status' =>1,'info'=>'','name'=>$prizeName,'place'=>$prizeId]); $this->ajaxReturn(['status' =>1,'info'=>'','name'=>$prizeName,'place'=>$prizeId]);
...@@ -1229,30 +1195,20 @@ class PkTopAction extends IdentityAction{ ...@@ -1229,30 +1195,20 @@ class PkTopAction extends IdentityAction{
//这个月剩余的抽奖机会数量 //这个月剩余的抽奖机会数量
public function getLeftCjNum() { public function getLeftCjNum() {
// if(date('d')>7){
// return 0;
// }
$userId = $this->user['userID']; $userId = $this->user['userID'];
$kaihuStatus=M()->db(1,C('DB_CONFIG_DEMO'))->table('cofool_pktop_kaihu')->where(['user_id'=>$userId])->find(); $kaihuStatus=M()->db(1,C('DB_CONFIG_DEMO'))->table('cofool_pktop_kaihu')->where(['user_id'=>$userId])->find();
if($userId==4098647){
// var_dump(M('PktopKaihu')->getLastSql());exit;
}
if(empty($kaihuStatus)){ if(empty($kaihuStatus)){
return 0; return 0;
} }
$oldDog=M()->db(1,C('DB_CONFIG_DEMO'))->table('cofool_pktop_luckydog')->where(['user_id'=>$userId])->order('add_time desc')->find(); // $where=['user_id'=>$userId];
// $tj=!empty($oldDog)&&date('Y-m',$oldDog['add_time'])==date('Y-m'); $where=['user_id'=>$userId,'group_id'=>$this->GID];
$oldDog=M()->db(1,C('DB_CONFIG_DEMO'))->table('cofool_pktop_luckydog')->where($where)->order('add_time desc')->find();
$tj=!empty($oldDog); $tj=!empty($oldDog);
if($tj){ if($tj){
return 0; return 0;
} }
// $suffix = D('Userinfo')->getTable($this->GID);
// $table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo';
// $lastmonthup = M($table, " ", C('DB_CONFIG_MNCG3'))->where(['uid'=>$this->GID.'X'.$userId])->getField('lastmonthup');
// if($lastmonthup<=0){
// return 0;
// }
return 1; return 1;
} }
......
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