Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cof_vip
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
houdong
cof_vip
Commits
e0d773de
Commit
e0d773de
authored
May 23, 2023
by
houdong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽奖修改
parent
81651876
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
332 additions
and
215 deletions
+332
-215
lottery.js
Public/Home/js/lottery.js
+12
-9
lottery.js
Public/js/lottery.js
+5
-5
IndexAction.class.php
app/Lib/Action/Vip/IndexAction.class.php
+82
-96
PkTopAction.class.php
app/Lib/Action/Vip/PkTopAction.class.php
+83
-89
PublicAction.class.php
app/Lib/Action/Vip/PublicAction.class.php
+101
-1
jiang.html
app/Tpl/Vip/Index/jiang.html
+20
-4
newPop.html
app/Tpl/Vip/Index/newPop.html
+29
-11
No files found.
Public/Home/js/lottery.js
View file @
e0d773de
...
@@ -67,7 +67,7 @@ $(function() {
...
@@ -67,7 +67,7 @@ $(function() {
//ajax请求中奖接口,本案例注释便于案例正常展示效果,实际中可参考注释的代码
//ajax请求中奖接口,本案例注释便于案例正常展示效果,实际中可参考注释的代码
getLottery
:
function
()
{
getLottery
:
function
()
{
$
.
ajax
({
$
.
ajax
({
url
:
'/P
kTop
/getLucky'
,
url
:
'/P
ublic
/getLucky'
,
type
:
'POST'
,
type
:
'POST'
,
dataType
:
'json'
,
dataType
:
'json'
,
data
:
{
data
:
{
...
@@ -80,7 +80,8 @@ $(function() {
...
@@ -80,7 +80,8 @@ $(function() {
lottery
.
speed
=
100
;
lottery
.
speed
=
100
;
lottery
.
stop
();
//转圈过程不响应click事件,会将click置为false
lottery
.
stop
();
//转圈过程不响应click事件,会将click置为false
lottery
.
click
=
true
;
//一次抽奖完成后,设置click为true,可继续抽奖
lottery
.
click
=
true
;
//一次抽奖完成后,设置click为true,可继续抽奖
lottery
.
prizeName
=
'恭喜您,您抽中的奖品是'
+
data
.
name
;
// lottery.prizeName='恭喜您,您抽中的奖品是'+data.name;
lottery
.
prizeName
=
data
.
name
;
}
else
{
}
else
{
layer
.
open
({
content
:
data
.
info
,
skin
:
'msg'
,
time
:
2
});
layer
.
open
({
content
:
data
.
info
,
skin
:
'msg'
,
time
:
2
});
}
}
...
@@ -92,21 +93,23 @@ $(function() {
...
@@ -92,21 +93,23 @@ $(function() {
};
};
$
(
"#lottery .btn"
).
on
(
'click'
,
function
(
event
)
{
$
(
"#lottery .btn"
).
on
(
'click'
,
function
(
event
)
{
$
.
get
(
"/P
kTop
/checkLucky"
,
{},
function
(
data
)
{
$
.
get
(
"/P
ublic
/checkLucky"
,
{},
function
(
data
)
{
if
(
data
.
status
==
0
)
{
if
(
data
.
status
==
0
)
{
// layer.open({content: data.info,skin: 'msg',time: 2});
if
(
data
.
uid
==
''
){
//
if(data.uid==''){
if
(
mfrom
[
1
]
>
0
){
if
(
mfrom
[
1
]
>
0
){
AppBridge
.
goLogin
();
AppBridge
.
goLogin
();
}
else
{
}
else
{
animPop
(
'#baomingPOP'
);
animPop
(
'#baomingPOP'
);
}
}
}
else
{
// }else{
// layer.open({content: data.info,skin: 'msg',time: 2});
// }
}
else
if
(
data
.
status
==
2
){
layer
.
open
({
content
:
data
.
info
,
skin
:
'msg'
,
time
:
2
});
layer
.
open
({
content
:
data
.
info
,
skin
:
'msg'
,
time
:
2
});
}
}
else
{
}
else
{
event
.
preventDefault
();
event
.
preventDefault
();
lottery
.
init
(
'lottery'
);
lottery
.
init
(
'lottery'
);
if
(
lottery
.
click
)
{
//click控制一次抽奖过程中不能重复点击抽奖按钮,后面的点击不响应
if
(
lottery
.
click
)
{
//click控制一次抽奖过程中不能重复点击抽奖按钮,后面的点击不响应
...
...
Public/js/lottery.js
View file @
e0d773de
...
@@ -67,7 +67,7 @@ $(function() {
...
@@ -67,7 +67,7 @@ $(function() {
//ajax请求中奖接口,本案例注释便于案例正常展示效果,实际中可参考注释的代码
//ajax请求中奖接口,本案例注释便于案例正常展示效果,实际中可参考注释的代码
getLottery
:
function
()
{
getLottery
:
function
()
{
$
.
ajax
({
$
.
ajax
({
url
:
'/
Index
/getLucky'
,
url
:
'/
Public
/getLucky'
,
type
:
'POST'
,
type
:
'POST'
,
dataType
:
'json'
,
dataType
:
'json'
,
data
:
{
data
:
{
...
@@ -92,15 +92,15 @@ $(function() {
...
@@ -92,15 +92,15 @@ $(function() {
};
};
$
(
"#lottery .btn"
).
on
(
'click'
,
function
(
event
)
{
$
(
"#lottery .btn"
).
on
(
'click'
,
function
(
event
)
{
$
.
get
(
"/
Index
/checkLucky"
,
{},
function
(
data
)
{
$
.
get
(
"/
Public
/checkLucky"
,
{},
function
(
data
)
{
//未登录
//未登录
if
(
data
.
status
==
2
)
{
if
(
data
.
status
==
0
)
{
$
(
".mask"
).
show
();
$
(
".mask"
).
show
();
$
(
"#pop1"
).
show
();
$
(
"#pop1"
).
show
();
}
else
if
(
data
.
status
==
0
)
{
}
else
if
(
data
.
status
==
2
)
{
layer
.
msg
(
data
.
info
);
layer
.
msg
(
data
.
info
);
}
else
{
}
else
if
(
data
.
status
==
1
)
{
event
.
preventDefault
();
event
.
preventDefault
();
lottery
.
init
(
'lottery'
);
lottery
.
init
(
'lottery'
);
if
(
lottery
.
click
)
{
//click控制一次抽奖过程中不能重复点击抽奖按钮,后面的点击不响应
if
(
lottery
.
click
)
{
//click控制一次抽奖过程中不能重复点击抽奖按钮,后面的点击不响应
...
...
app/Lib/Action/Vip/IndexAction.class.php
View file @
e0d773de
...
@@ -108,7 +108,7 @@ class IndexAction extends IdentityAction {
...
@@ -108,7 +108,7 @@ class IndexAction extends IdentityAction {
$userId
=
$this
->
user
[
'userID'
];
$userId
=
$this
->
user
[
'userID'
];
$this
->
setValue
(
$userId
);
$this
->
setValue
(
$userId
);
//这个月剩余的抽奖机会
//这个月剩余的抽奖机会
$leftCjNum
=
$this
->
getLeftCjNum
();
$leftCjNum
=
A
(
'Vip/Public'
)
->
getLeftCjNum
();
$this
->
assign
(
'leftCjNum'
,
$leftCjNum
);
$this
->
assign
(
'leftCjNum'
,
$leftCjNum
);
//取微信
//取微信
...
@@ -1129,108 +1129,89 @@ class IndexAction extends IdentityAction {
...
@@ -1129,108 +1129,89 @@ class IndexAction extends IdentityAction {
}
}
//取奖品
//取奖品
public
function
getLucky
()
{
// public function getLucky() {
$userId
=
$this
->
user
[
'userID'
];
// $userId = $this->user['userID'];
if
(
$userId
==
0
){
// if($userId==0){
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'请登录后再操作'
]);
// $this->ajaxReturn(['status' =>0,'info'=>'请登录后再操作']);
}
// }
$prizeList
=
[
// $prizeList = [
'1'
=>
[
'name'
=>
'100元现金奖励'
,
'score'
=>
0
],
// '1'=>['name'=>'100元奖券','score'=>0],'2'=>['name'=>'500元奖券','score'=>0],
'2'
=>
[
'name'
=>
'500元现金奖励'
,
'score'
=>
0
],
// '3'=>['name'=>'300元奖券','score'=>0],'4'=>['name'=>'35元奖券','score'=>100]
'3'
=>
[
'name'
=>
'300元现金奖励'
,
'score'
=>
0
],
// ];
'4'
=>
[
'name'
=>
'35元现金奖励'
,
'score'
=>
100
]
//
];
// $arr =[];
// foreach ($prizeList as $key => $val) {
$arr
=
[];
// $arr[$key] = $val['score'];
foreach
(
$prizeList
as
$key
=>
$val
)
{
// }
$arr
[
$key
]
=
$val
[
'score'
];
//
}
// $prizeId = $this->get_rand($arr);
// $prizeName = $prizeList[$prizeId]['name'];
$prizeId
=
$this
->
get_rand
(
$arr
);
// $insertData=['user_id'=>$userId,'user_name'=>$this->user['userName'],'prize'=>$prizeName,'add_time'=>time(),'group_id'=>$this->GID];
$prizeName
=
$prizeList
[
$prizeId
][
'name'
];
// M('PktopLuckydog')->add($insertData);
$insertData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$this
->
user
[
'userName'
],
'prize'
=>
$prizeName
,
'add_time'
=>
time
(),
'group_id'
=>
$this
->
GID
];
// $prizeName='恭喜,抽中'.$prizeName.',奖励已打入大赛奖金钱包';
M
(
'PktopLuckydog'
)
->
add
(
$insertData
);
// $this->ajaxReturn(['status' =>1,'info'=>'','name'=>$prizeName,'place'=>$prizeId]);
// }
$this
->
ajaxReturn
([
'status'
=>
1
,
'info'
=>
''
,
'name'
=>
$prizeName
,
'place'
=>
$prizeId
]);
}
// //生成一个随机数
// function get_rand($proArr) {
//生成一个随机数
// $result = '';
function
get_rand
(
$proArr
)
{
// //概率数组的总概率精度
$result
=
''
;
// $proSum = array_sum($proArr);
//概率数组的总概率精度
// //概率数组循环
$proSum
=
array_sum
(
$proArr
);
// foreach ($proArr as $key => $proCur) {
//概率数组循环
// $randNum = mt_rand(1, $proSum);
foreach
(
$proArr
as
$key
=>
$proCur
)
{
// if ($randNum <= $proCur) {
$randNum
=
mt_rand
(
1
,
$proSum
);
// $result = $key;
if
(
$randNum
<=
$proCur
)
{
// break;
$result
=
$key
;
// } else {
break
;
// $proSum -= $proCur;
}
else
{
// }
$proSum
-=
$proCur
;
// }
}
//// unset ($proArr);
}
// return $result;
// unset ($proArr);
// }
return
$result
;
}
//检查抽奖资格
//检查抽奖资格
public
function
checkLucky
()
{
// public function checkLucky() {
$userId
=
$this
->
user
[
'userID'
];
// $userId = $this->user['userID'];
if
(
$userId
==
0
){
// if($userId==0){
$this
->
ajaxReturn
([
'status'
=>
2
,
'info'
=>
'请登录后再操作'
]);
// $this->ajaxReturn(['status' =>0,'info'=>'请登录后再操作']);
}
// }
//每个月1--7号可以抽奖
// $oldDog=M('PktopLuckydog')->where(['user_id'=>$userId,'group_id'=>$this->GID])->order('add_time desc')->find();
if
(
date
(
'd'
)
>
7
){
//
// $this->ajaxReturn(['status' =>0,'info'=>'每月1日至7日才能抽奖']);
// if(!empty($oldDog)){
}
// $this->ajaxReturn(['status' =>2,'info'=>'您已经抽过奖了']);
//每人每个月只能抽一次奖
// }
$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')){
// $kaihuStatus=M('PktopKaihu')->where(['user_id'=>$userId])->find();
// $this->ajaxReturn(['status' =>0,'info'=>'您当月已经抽奖']);
// if(empty($kaihuStatus)){
//// $this->ajaxReturn(['status' =>0,'info'=>'您还未开户,不能抽奖,请点击链接开户']);
// $this->ajaxReturn(['status' =>2,'info'=>'请联系管理员获取抽奖机会']);
// }
//
// $this->ajaxReturn(['status' =>1,'info'=>'']);
// }
// }
if
(
!
empty
(
$oldDog
)){
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'您已经抽过奖了'
]);
}
//检查是否开户
$kaihuStatus
=
M
(
'PktopKaihu'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
if
(
empty
(
$kaihuStatus
)){
// $this->ajaxReturn(['status' =>0,'info'=>'您还未开户,不能抽奖,请点击链接开户']);
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'请联系管理员获取抽奖次数'
]);
}
$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'
=>
''
]);
}
//这个月剩余的抽奖机会数量
//这个月剩余的抽奖机会数量
public
function
getLeftCjNum
()
{
// public function getLeftCjNum() {
//
$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
;
}
$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')){
// return 0;
// return 0;
// }
// }
$tj
=!
empty
(
$oldDog
);
// $where=['user_id'=>$userId,'group_id'=>$this->GID];
if
(
$tj
){
// $oldDog=M()->db(10, C('DB_CONFIG_DEMO'))->table('cofool_pktop_luckydog')->where($where)->order('add_time desc')->find();
return
0
;
//// if(!empty($oldDog)&&date('Y-m',$oldDog['add_time'])==date('Y-m')){
}
//// return 0;
// $suffix = D('Userinfo')->getTable($this->GID);
//// }
// $table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo';
// $tj=!empty($oldDog);
// $lastmonthup = M($table, " ", C('DB_CONFIG_MNCG3'))->where(['uid'=>$this->GID.'X'.$userId])->getField('lastmonthup');
// if($tj){
// if($lastmonthup<=0){
// return 0;
// return 0;
// }
// }
return
1
;
//
}
// return 1;
// }
//官方有奖赛列表页
//官方有奖赛列表页
// public function moreDs(){
// public function moreDs(){
...
@@ -1407,9 +1388,14 @@ class IndexAction extends IdentityAction {
...
@@ -1407,9 +1388,14 @@ class IndexAction extends IdentityAction {
foreach
(
$items
as
$key
=>&
$value
){
foreach
(
$items
as
$key
=>&
$value
){
$value
[
"item_time"
]
=
date
(
'Y.m.d'
,
$value
[
'item_time'
]);
$value
[
"item_time"
]
=
date
(
'Y.m.d'
,
$value
[
'item_time'
]);
if
(
$value
[
'item_money'
]
>
0
){
if
(
$value
[
'item_money'
]
>
0
){
if
(
$value
[
'note'
]){
$value
[
'gName'
]
=
$value
[
'note'
];
}
else
{
$group
=
D
(
'Group'
)
->
getGroup
(
$value
[
'group_id'
]);
$group
=
D
(
'Group'
)
->
getGroup
(
$value
[
'group_id'
]);
// var_dump($group);exit;
$value
[
'gName'
]
=
$group
[
'name'
];
$value
[
'gName'
]
=
$group
[
'name'
];
}
$itemList1
[]
=
$value
;
$itemList1
[]
=
$value
;
}
else
{
}
else
{
$value
[
'item_money'
]
=
abs
(
$value
[
'item_money'
]);
$value
[
'item_money'
]
=
abs
(
$value
[
'item_money'
]);
...
...
app/Lib/Action/Vip/PkTopAction.class.php
View file @
e0d773de
...
@@ -225,7 +225,7 @@ class PkTopAction extends IdentityAction{
...
@@ -225,7 +225,7 @@ class PkTopAction extends IdentityAction{
$luckydogs
=
M
(
'PktopLuckydog'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
limit
(
10
)
->
select
();
$luckydogs
=
M
(
'PktopLuckydog'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
limit
(
10
)
->
select
();
$this
->
assign
(
'luckydogs'
,
$luckydogs
);
$this
->
assign
(
'luckydogs'
,
$luckydogs
);
//这个月剩余的抽奖机会
//这个月剩余的抽奖机会
$leftCjNum
=
$this
->
getLeftCjNum
();
$leftCjNum
=
A
(
'Public'
)
->
getLeftCjNum
();
$this
->
assign
(
'leftCjNum'
,
$leftCjNum
);
$this
->
assign
(
'leftCjNum'
,
$leftCjNum
);
//大赛状态
//大赛状态
$gInfo
[
'gStatus'
]
=
is_end
(
$groupInfo
[
'endTime'
])
?
'3'
:
(
$groupInfo
[
'startTime'
]
>
time
()
?
'1'
:
'2'
);
$gInfo
[
'gStatus'
]
=
is_end
(
$groupInfo
[
'endTime'
])
?
'3'
:
(
$groupInfo
[
'startTime'
]
>
time
()
?
'1'
:
'2'
);
...
@@ -1119,98 +1119,92 @@ class PkTopAction extends IdentityAction{
...
@@ -1119,98 +1119,92 @@ class PkTopAction extends IdentityAction{
return
$zongupData
;
return
$zongupData
;
}
}
//检查抽奖资格
// //检查抽奖资格
public
function
checkLucky
()
{
// public function checkLucky() {
$userId
=
$this
->
user
[
'userID'
];
// $userId = $this->user['userID'];
if
(
$userId
==
0
){
// if($userId==0){
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'请登录后再操作'
,
'uid'
=>
''
]);
// $this->ajaxReturn(['status' =>0,'info'=>'请登录后再操作','uid'=>'']);
}
// }
//每个月1--7号可以抽奖
// //每人每个月只能抽一次奖,改成只能抽一次奖
if
(
date
(
'd'
)
>
7
){
// $oldDog=M('PktopLuckydog')->where(['user_id'=>$userId,'group_id'=>$this->GID])->order('add_time desc')->find();
// $this->ajaxReturn(['status' =>0,'info'=>'每月1日至7日才能抽奖']);
//
}
// if(!empty($oldDog)){
//每人每个月只能抽一次奖,改成只能抽一次奖
// $this->ajaxReturn(['status' =>2,'info'=>'您已经抽过奖了','uid'=>$userId]);
$oldDog
=
M
(
'PktopLuckydog'
)
->
where
([
'user_id'
=>
$userId
,
'group_id'
=>
$this
->
GID
])
->
order
(
'add_time desc'
)
->
find
();
// }
//
if
(
!
empty
(
$oldDog
)){
// //检查是否开户
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'您已经抽过奖了'
,
'uid'
=>
$userId
]);
// $kaihuStatus=M('PktopKaihu')->where(['user_id'=>$userId])->find();
}
// if(empty($kaihuStatus)){
//// $this->ajaxReturn(['status' =>0,'info'=>'您还未开户,不能抽奖,请点击链接开户']);
//检查是否开户
// $this->ajaxReturn(['status' =>2,'info'=>'请联系管理员获取抽奖机会','uid'=>$userId]);
$kaihuStatus
=
M
(
'PktopKaihu'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
//
if
(
empty
(
$kaihuStatus
)){
// }
// $this->ajaxReturn(['status' =>0,'info'=>'您还未开户,不能抽奖,请点击链接开户']);
//
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'请联系管理员获取抽奖次数'
,
'uid'
=>
$userId
]);
// $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'
];
// $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'
=>
0
],
// '1'=>['name'=>'100元奖券','score'=>0],'2'=>['name'=>'500元奖券','score'=>0],
'2'
=>
[
'name'
=>
'500元现金奖励'
,
'score'
=>
0
],
// '3'=>['name'=>'300元奖券','score'=>0],'4'=>['name'=>'35元奖券','score'=>100]
'3'
=>
[
'name'
=>
'300元现金奖励'
,
'score'
=>
0
],
// ];
'4'
=>
[
'name'
=>
'35元现金奖励'
,
'score'
=>
100
]
//
];
// $arr =[];
// foreach ($prizeList as $key => $val) {
$arr
=
[];
// $arr[$key] = $val['score'];
foreach
(
$prizeList
as
$key
=>
$val
)
{
// }
$arr
[
$key
]
=
$val
[
'score'
];
//
}
// $prizeId = $this->get_rand($arr);
// $prizeName = $prizeList[$prizeId]['name'];
$prizeId
=
$this
->
get_rand
(
$arr
);
// $insertData=['user_id'=>$userId,'user_name'=>$userName,'prize'=>$prizeName,'add_time'=>time(),'group_id'=>$this->GID];
$prizeName
=
$prizeList
[
$prizeId
][
'name'
];
// M('PktopLuckydog')->add($insertData);
$insertData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'prize'
=>
$prizeName
,
'add_time'
=>
time
(),
'group_id'
=>
$this
->
GID
];
// $prizeName='恭喜,抽中'.$prizeName.',奖励已打入大赛奖金钱包';
M
(
'PktopLuckydog'
)
->
add
(
$insertData
);
// $this->ajaxReturn(['status' =>1,'info'=>'','name'=>$prizeName,'place'=>$prizeId]);
// }
$this
->
ajaxReturn
([
'status'
=>
1
,
'info'
=>
''
,
'name'
=>
$prizeName
,
'place'
=>
$prizeId
]);
}
//生成一个随机数
//生成一个随机数
function
get_rand
(
$proArr
)
{
// function get_rand($proArr) {
$result
=
''
;
// $result = '';
//概率数组的总概率精度
// //概率数组的总概率精度
$proSum
=
array_sum
(
$proArr
);
// $proSum = array_sum($proArr);
//概率数组循环
// //概率数组循环
foreach
(
$proArr
as
$key
=>
$proCur
)
{
// foreach ($proArr as $key => $proCur) {
$randNum
=
mt_rand
(
1
,
$proSum
);
// $randNum = mt_rand(1, $proSum);
if
(
$randNum
<=
$proCur
)
{
// if ($randNum <= $proCur) {
$result
=
$key
;
// $result = $key;
break
;
// break;
}
else
{
// } else {
$proSum
-=
$proCur
;
// $proSum -= $proCur;
}
// }
}
// }
// unset ($proArr);
//// unset ($proArr);
return
$result
;
// return $result;
}
// }
//这个月剩余的抽奖机会数量
public
function
getLeftCjNum
()
{
$userId
=
$this
->
user
[
'userID'
];
$kaihuStatus
=
M
()
->
db
(
1
,
C
(
'DB_CONFIG_DEMO'
))
->
table
(
'cofool_pktop_kaihu'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
if
(
empty
(
$kaihuStatus
)){
// //这个月剩余的抽奖机会数量
return
0
;
// public function getLeftCjNum() {
}
// $userId = $this->user['userID'];
// $where=['user_id'=>$userId];
//
$where
=
[
'user_id'
=>
$userId
,
'group_id'
=>
$this
->
GID
];
// $kaihuStatus=M()->db(1,C('DB_CONFIG_DEMO'))->table('cofool_pktop_kaihu')->where(['user_id'=>$userId])->find();
$oldDog
=
M
()
->
db
(
1
,
C
(
'DB_CONFIG_DEMO'
))
->
table
(
'cofool_pktop_luckydog'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
find
();
//
$tj
=!
empty
(
$oldDog
);
// if(empty($kaihuStatus)){
if
(
$tj
){
// return 0;
return
0
;
// }
}
//// $where=['user_id'=>$userId];
return
1
;
// $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);
// if($tj){
// return 0;
// }
// return 1;
// }
...
@@ -1377,7 +1371,7 @@ class PkTopAction extends IdentityAction{
...
@@ -1377,7 +1371,7 @@ class PkTopAction extends IdentityAction{
public
function
choujiang
()
{
public
function
choujiang
()
{
//这个月剩余的抽奖机会
//这个月剩余的抽奖机会
$leftCjNum
=
$this
->
getLeftCjNum
();
$leftCjNum
=
A
(
'Vip/Public'
)
->
getLeftCjNum
();
$this
->
assign
(
'leftCjNum'
,
$leftCjNum
);
$this
->
assign
(
'leftCjNum'
,
$leftCjNum
);
$this
->
display
();
$this
->
display
();
}
}
...
...
app/Lib/Action/Vip/PublicAction.class.php
View file @
e0d773de
<?php
<?php
session
(
C
(
'SESSION_OPTIONS'
));
session
(
C
(
'SESSION_OPTIONS'
));
//通用方法功能类
//通用方法功能类
class
PublicAction
extends
Action
{
class
PublicAction
extends
Identity
Action
{
//验证码
//验证码
public
function
verify
(){
public
function
verify
(){
...
@@ -116,5 +116,105 @@ class PublicAction extends Action {
...
@@ -116,5 +116,105 @@ class PublicAction extends Action {
$this
->
ajaxReturn
([
'status'
=>
1
,
'info'
=>
'短信发送异常,请联系客服人员'
]);
$this
->
ajaxReturn
([
'status'
=>
1
,
'info'
=>
'短信发送异常,请联系客服人员'
]);
}
}
//检查抽奖资格
public
function
checkLucky
()
{
$userId
=
$this
->
user
[
'userID'
];
if
(
$userId
==
0
){
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'请登录后再操作'
,
'uid'
=>
''
]);
}
//每人每个月只能抽一次奖,改成只能抽一次奖
$oldDog
=
M
(
'PktopLuckydog'
)
->
where
([
'user_id'
=>
$userId
,
'group_id'
=>
PRIZE_GROUP_2021
])
->
order
(
'add_time desc'
)
->
find
();
if
(
!
empty
(
$oldDog
)){
$this
->
ajaxReturn
([
'status'
=>
2
,
'info'
=>
'您已经抽过奖了'
,
'uid'
=>
$userId
]);
}
//检查是否开户
$kaihuStatus
=
M
(
'PktopKaihu'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
if
(
empty
(
$kaihuStatus
)){
// $this->ajaxReturn(['status' =>0,'info'=>'您还未开户,不能抽奖,请点击链接开户']);
$this
->
ajaxReturn
([
'status'
=>
2
,
'info'
=>
'请联系管理员获取抽奖机会'
,
'uid'
=>
$userId
]);
}
$this
->
ajaxReturn
([
'status'
=>
1
,
'info'
=>
''
,
'uid'
=>
$userId
]);
}
//取奖品
public
function
getLucky
()
{
$userId
=
$this
->
user
[
'userID'
];
$userName
=
$this
->
user
[
'userName'
];
if
(
$userId
==
0
){
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'请登录后再操作'
]);
}
$prizeList
=
[
'1'
=>
[
'name'
=>
'100元奖券'
,
'score'
=>
0
],
'2'
=>
[
'name'
=>
'500元奖券'
,
'score'
=>
0
],
'3'
=>
[
'name'
=>
'300元奖券'
,
'score'
=>
0
],
'4'
=>
[
'name'
=>
'35元奖券'
,
'score'
=>
100
]
];
$arr
=
[];
foreach
(
$prizeList
as
$key
=>
$val
)
{
$arr
[
$key
]
=
$val
[
'score'
];
}
$prizeId
=
$this
->
get_rand
(
$arr
);
$prizeName
=
$prizeList
[
$prizeId
][
'name'
];
$insertData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'prize'
=>
$prizeName
,
'add_time'
=>
time
(),
'group_id'
=>
PRIZE_GROUP_2021
];
M
(
'PktopLuckydog'
)
->
add
(
$insertData
);
//加入流水表
$addMoney
=
35
;
require_once
'./uc_client_php/client.php'
;
$result
=
uc_get_user
([
'userId'
=>
$userId
,
'type'
=>
3
]);
$mobile
=
$result
[
'data'
][
'mobile'
];
$addData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'mobile'
=>
$mobile
,
'item_money'
=>
$addMoney
,
'item_time'
=>
time
(),
'group_id'
=>
PRIZE_GROUP_2021
,
'status'
=>
1
,
'note'
=>
'全民分赛场抽奖'
];
M
(
'WalletItem'
)
->
add
(
$addData
);
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$userId
])
->
setInc
(
'money'
,
$addMoney
);
$prizeName
=
'恭喜,抽中'
.
$prizeName
.
',奖励已打入大赛奖金钱包'
;
$this
->
ajaxReturn
([
'status'
=>
1
,
'info'
=>
''
,
'name'
=>
$prizeName
,
'place'
=>
$prizeId
]);
}
//这个月剩余的抽奖机会数量
public
function
getLeftCjNum
()
{
$userId
=
$this
->
user
[
'userID'
];
$kaihuStatus
=
M
()
->
db
(
1
,
C
(
'DB_CONFIG_DEMO'
))
->
table
(
'cofool_pktop_kaihu'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
if
(
empty
(
$kaihuStatus
)){
return
0
;
}
// $where=['user_id'=>$userId];
$where
=
[
'user_id'
=>
$userId
,
'group_id'
=>
PRIZE_GROUP_2021
];
$oldDog
=
M
()
->
db
(
1
,
C
(
'DB_CONFIG_DEMO'
))
->
table
(
'cofool_pktop_luckydog'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
find
();
$tj
=!
empty
(
$oldDog
);
if
(
$tj
){
return
0
;
}
return
1
;
}
//生成一个随机数
function
get_rand
(
$proArr
)
{
$result
=
''
;
//概率数组的总概率精度
$proSum
=
array_sum
(
$proArr
);
//概率数组循环
foreach
(
$proArr
as
$key
=>
$proCur
)
{
$randNum
=
mt_rand
(
1
,
$proSum
);
if
(
$randNum
<=
$proCur
)
{
$result
=
$key
;
break
;
}
else
{
$proSum
-=
$proCur
;
}
}
// unset ($proArr);
return
$result
;
}
}
}
?>
?>
\ No newline at end of file
app/Tpl/Vip/Index/jiang.html
View file @
e0d773de
...
@@ -106,7 +106,7 @@
...
@@ -106,7 +106,7 @@
</div>
</div>
<div
class=
"item-cont-l"
>
<div
class=
"item-cont-l"
>
<p
class=
"t"
>
全民炼股赛-券商专场
</p>
<p
class=
"s"
>
每月评奖,前3名或盈利2%以上瓜分
<br>
<p
class=
"t"
>
全民炼股赛-券商专场
</p>
<p
class=
"s"
>
每月评奖,前3名或盈利2%以上瓜分
<br>
<a
href=
"javascript:;"
class=
"gf
"
>
瓜分10万>
</a>
<a
href=
"javascript:;"
class=
"gf
goLucky"
url=
'{:WWW_URL}/Zjds/lucky'
>
瓜分10万>
</a>
<!-- 比赛时间:{$dsStatus.zjStartTime} ~ {$dsStatus.zjEndTime}-->
<!-- 比赛时间:{$dsStatus.zjStartTime} ~ {$dsStatus.zjEndTime}-->
</p>
</p>
</div>
</div>
...
@@ -129,7 +129,7 @@
...
@@ -129,7 +129,7 @@
</div>
</div>
<div
class=
"item-cont-l"
>
<div
class=
"item-cont-l"
>
<p
class=
"t"
>
全民分赛场
</p>
<p
class=
"s"
>
每周评奖,正盈利+即可瓜分
<br>
<p
class=
"t"
>
全民分赛场
</p>
<p
class=
"s"
>
每周评奖,正盈利+即可瓜分
<br>
<a
href=
"javascript:;"
class=
"gf
"
>
瓜分10万>
</a>
<a
href=
"javascript:;"
class=
"gf
goLucky"
url=
"/Index/lucky"
>
瓜分10万>
</a>
<!-- 比赛时间:{$dsStatus.qmStartTime} ~ {$dsStatus.qmEndTime}-->
<!-- 比赛时间:{$dsStatus.qmStartTime} ~ {$dsStatus.qmEndTime}-->
</p>
</p>
</div>
</div>
...
@@ -152,7 +152,7 @@
...
@@ -152,7 +152,7 @@
</div>
</div>
<div
class=
"item-cont-l"
>
<div
class=
"item-cont-l"
>
<p
class=
"t"
>
股市小白训练赛
</p>
<p
class=
"s"
>
赠视频课程、学习交流圈,正盈利即可瓜分奖学金
<br>
<p
class=
"t"
>
股市小白训练赛
</p>
<p
class=
"s"
>
赠视频课程、学习交流圈,正盈利即可瓜分奖学金
<br>
<a
href=
"javascript:;"
class=
"gf
"
>
进入交流圈/课程>
</a>
<a
href=
"javascript:;"
class=
"gf
popTip"
flag=
"Niubai"
>
进入交流圈/课程>
</a>
<!-- 比赛时间:{$dsStatus.nbStartTime} ~ {$dsStatus.nbEndTime}-->
<!-- 比赛时间:{$dsStatus.nbStartTime} ~ {$dsStatus.nbEndTime}-->
</p>
</p>
</div>
</div>
...
@@ -171,7 +171,7 @@
...
@@ -171,7 +171,7 @@
</div>
</div>
<div
class=
"item-cont-l"
>
<div
class=
"item-cont-l"
>
<p
class=
"t"
>
狙击黑马股训练赛
</p><p
class=
"s"
>
赠炒股工具、学习交流圈、视频课程,正盈利即可瓜分奖学金
<br>
<p
class=
"t"
>
狙击黑马股训练赛
</p><p
class=
"s"
>
赠炒股工具、学习交流圈、视频课程,正盈利即可瓜分奖学金
<br>
<a
href=
"javascript:;"
class=
"gf"
>
进入交流圈/课程>
</a>
<a
href=
"javascript:;"
class=
"gf
popTip"
flag=
"Strong
"
>
进入交流圈/课程>
</a>
<!-- 比赛时间:{$dsStatus.hmStartTime} ~ {$dsStatus.hmEndTime}-->
<!-- 比赛时间:{$dsStatus.hmStartTime} ~ {$dsStatus.hmEndTime}-->
</p>
</p>
</div>
</div>
...
@@ -290,6 +290,22 @@
...
@@ -290,6 +290,22 @@
</body>
</body>
<script>
<script>
$
(
function
(){
$
(
function
(){
//跳转到抽奖页面
$
(
'.goLucky'
).
click
(
function
()
{
window
.
event
.
stopPropagation
();
var
url
=
$
(
this
).
attr
(
'url'
);
location
.
href
=
url
;
});
//点击 进入交流圈/课程 出现弹窗
$
(
'.popTip'
).
click
(
function
()
{
window
.
event
.
stopPropagation
();
$
(
".mask"
).
show
();
$
(
"#popQuanTip"
).
show
();
$
(
".goXet"
).
attr
(
'flag'
,
$
(
this
).
attr
(
'flag'
));
});
//提现按钮
//提现按钮
$
(
'.withdraw-btn'
).
click
(
function
()
{
$
(
'.withdraw-btn'
).
click
(
function
()
{
var
tj
=
'{$user.userID}'
==
''
;
var
tj
=
'{$user.userID}'
==
''
;
...
...
app/Tpl/Vip/Index/newPop.html
View file @
e0d773de
...
@@ -48,8 +48,8 @@
...
@@ -48,8 +48,8 @@
<p
class=
"main-msg-i1"
style=
""
>
温馨提示
</p>
<p
class=
"main-msg-i1"
style=
""
>
温馨提示
</p>
<p
class=
"main-msg-i1 red"
style=
""
>
报名后请联系老师开通学习圈,
<br>
领取课程
</p>
<p
class=
"main-msg-i1 red"
style=
""
>
报名后请联系老师开通学习圈,
<br>
领取课程
</p>
<p
class=
"main-code-btn"
>
<p
class=
"main-code-btn"
>
<button
class=
"tip-btn"
>
我已开通
</button>
<button
class=
"tip-btn
goXet"
flag=
"
"
>
我已开通
</button>
<button
class=
"tip-btn red"
>
加老师微信开通
</button>
<button
class=
"tip-btn red
popWx
"
>
加老师微信开通
</button>
</p>
</p>
</div>
</div>
<span
class=
"t-pop-close"
><img
src=
"__PUBLIC__/Home/images/g2020/trade-close.png"
alt=
""
></span>
<span
class=
"t-pop-close"
><img
src=
"__PUBLIC__/Home/images/g2020/trade-close.png"
alt=
""
></span>
...
@@ -63,17 +63,28 @@
...
@@ -63,17 +63,28 @@
</div>
</div>
<span
class=
"t-pop-close"
><img
src=
"__PUBLIC__/Home/images/g2020/trade-close.png"
alt=
""
></span>
<span
class=
"t-pop-close"
><img
src=
"__PUBLIC__/Home/images/g2020/trade-close.png"
alt=
""
></span>
</div>
</div>
<div
class=
"camp-apply-pop pops"
style=
"display: none;"
id=
"popQuanCode"
>
<div
class=
"camp-apply-pop pops"
style=
"display: none;"
id=
"popXiaoet"
>
<div
class=
"pop-main"
>
<div
class=
"pop-main"
>
<p
class=
"main-msg-i1"
style=
""
>
微信扫一扫
</p>
<p
class=
"main-msg-i1"
style=
""
>
微信扫一扫
</p>
<p
class=
"main-msg-i1 red"
style=
""
>
进入学习交流圈
</p>
<p
class=
"main-msg-i1 red"
style=
""
>
进入学习交流圈
</p>
<p
class=
"main-code"
style=
""
><img
src=
"__PUBLIC__/Home/images/2023ewm/xiaoet.jpg"
/></p>
<p
class=
"main-code"
style=
""
id=
"xiao1"
><img
src=
"__PUBLIC__/Home/images/2023ewm/xiaoet.jpg"
/></p>
<p
class=
"main-code"
style=
""
id=
"xiao2"
><img
src=
"__PUBLIC__/Home/images/2023ewm/xiaoet_hm.jpg"
/></p>
</div>
</div>
<span
class=
"t-pop-close"
><img
src=
"__PUBLIC__/Home/images/g2020/trade-close.png"
alt=
""
></span>
<span
class=
"t-pop-close"
><img
src=
"__PUBLIC__/Home/images/g2020/trade-close.png"
alt=
""
></span>
</div>
</div>
<script>
<script>
$
(
function
()
{
$
(
function
()
{
$
(
".goXet"
).
click
(
function
(){
goXet
(
$
(
this
).
attr
(
'flag'
));
});
//添加老师微信
$
(
".popWx"
).
click
(
function
(){
$
(
"#popQuanTip"
).
hide
();
$
(
'#popKaitong'
).
show
();
});
//发送验证码
//发送验证码
$
(
"#sendSmsCode"
).
click
(
function
()
{
$
(
"#sendSmsCode"
).
click
(
function
()
{
var
mobile
=
$
(
"#mobile"
).
val
();
var
mobile
=
$
(
"#mobile"
).
val
();
...
@@ -123,13 +134,6 @@
...
@@ -123,13 +134,6 @@
});
});
});
});
var
clipboard
=
new
Clipboard
(
'.copyBtn'
);
var
clipboard
=
new
Clipboard
(
'.copyBtn'
);
clipboard
.
on
(
'success'
,
function
(
e
)
{
layer
.
msg
(
'复制成功'
,
1
,
1
);});
clipboard
.
on
(
'success'
,
function
(
e
)
{
layer
.
msg
(
'复制成功'
,
1
,
1
);});
clipboard
.
on
(
'error'
,
function
(
e
)
{
layer
.
msg
(
'复制失败,请长按复制'
);});
clipboard
.
on
(
'error'
,
function
(
e
)
{
layer
.
msg
(
'复制失败,请长按复制'
);});
...
@@ -149,5 +153,19 @@
...
@@ -149,5 +153,19 @@
}
}
}
}
function
goXet
(
flag
=
''
){
if
(
flag
==
'Niubai'
){
$
(
'#xiao1'
).
show
();
$
(
'#xiao2'
).
hide
();
}
else
{
$
(
'#xiao1'
).
hide
();
$
(
'#xiao2'
).
show
();
}
$
(
"#popQuanTip"
).
hide
();
$
(
"#popXiaoet"
).
show
();
}
</script>
</script>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment