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
5f11fdb3
Commit
5f11fdb3
authored
Jul 05, 2023
by
houdong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
邀请功能
parent
9c13ab9e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
726 additions
and
687 deletions
+726
-687
IndexAction.class.php
app/Lib/Action/Vip/IndexAction.class.php
+118
-119
PkTopAction.class.php
app/Lib/Action/Vip/PkTopAction.class.php
+563
-565
UserModel.class.php
app/Lib/Model/UserModel.class.php
+42
-0
jiang.html
app/Tpl/Vip/Index/jiang.html
+3
-3
userList_____.html
app/Tpl/Vip/Index/userList_____.html
+0
-0
indexOld____.html
app/Tpl/Vip/PkTop/indexOld____.html
+0
-0
No files found.
app/Lib/Action/Vip/IndexAction.class.php
View file @
5f11fdb3
...
...
@@ -466,16 +466,19 @@ class IndexAction extends IdentityAction {
//钱包
$userId
=
$ucData
[
'user_id'
];
$wallet
=
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
if
(
empty
(
$wallet
)){
M
(
'Wallet'
)
->
add
([
'user_id'
=>
$userId
,
'user_name'
=>
$ucData
[
'user_name'
],
'add_time'
=>
time
(),
'money'
=>
1.88
]);
}
else
{
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$userId
])
->
setInc
(
'money'
,
1.88
);
}
// $wallet=M('Wallet')->where(['user_id'=>$userId])->find();
// if(empty($wallet)){
// M('Wallet')->add(['user_id'=>$userId,'user_name'=>$ucData['user_name'],'add_time'=>time(),'money'=>1.88]);
// }else{
// M('Wallet')->where(['user_id'=>$userId])->setInc('money',1.88);
// }
//
// $addData=['user_id'=>$userId,'user_name'=>$ucData['user_name'],'mobile'=>$mobile,
// 'item_money'=>1.88,'item_time'=>time(),'group_id'=>$groupId,'status'=>1,'note'=>'【全民分赛场】报名成功'];
// M('WalletItem')->add($addData);
$addData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$ucData
[
'user_name'
],
'mobile'
=>
$mobile
,
'item_money'
=>
1.88
,
'item_time'
=>
time
(),
'group_id'
=>
$groupId
,
'status'
=>
1
,
'note'
=>
'【全民分赛场】报名成功'
];
M
(
'WalletItem'
)
->
add
(
$addData
);
D
(
'User'
)
->
addMoney
(
$userId
,
$ucData
[
'user_name'
],
$ucData
[
'mobile'
]);
D
(
'User'
)
->
addInvite
(
$userId
,
$ucData
[
'user_name'
]);
//用户未加入大赛或已加入,但不在cofool_allex_user表,需要添加
if
(
$joinRes
[
'status'
]
==
0
||
$joinRes
[
'joinStatus'
]
==
1
){
...
...
@@ -558,33 +561,33 @@ class IndexAction extends IdentityAction {
return
false
;
}
}
public
function
formatTop10
(){
//月赛前10名用户的挑战情况
$month
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
));
$top10
=
M
(
'PktopUserphb'
)
->
where
(
array
(
'month'
=>
$month
))
->
order
(
'month desc,monthup desc'
)
->
limit
(
10
)
->
select
();
$top10UserId
=
array
();
foreach
(
$top10
as
$k
=>
&
$v
)
{
$top10UserId
[]
=
$v
[
'user_id'
];
$v
[
'userUrl'
]
=
tradeDetailLink
(
$this
->
GID
,
3
,
$v
[
'user_id'
]);
}
//取被挑战者的挑战人员
// $enemyNum=M('PkData')->where(array('pk_end_time'=>array('egt',date('Y-m-d'))))->group('passive_id')->getField('passive_id,count(*) num',true);
$enemy
=
M
(
'PkData'
)
->
where
(
array
(
'passive_id'
=>
array
(
'in'
,
$top10UserId
)))
->
select
();
$enemyId
=
array
();
foreach
(
$enemy
as
$k
=>
$v1
)
{
$enemyId
[
$v1
[
'passive_id'
]][]
=
$v1
[
'active_id'
];
}
foreach
(
$top10
as
$k
=>
&
$v2
)
{
$v2
[
'enemyNum'
]
=
count
(
$enemyId
[
$v2
[
'user_id'
]]);
// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
//敌人头像列表
$v2
[
'enemy'
]
=
$enemyId
[
$v2
[
'user_id'
]];
// $v['head_img'] = getPortraitPath($value['user_id'], 'small', true);
}
return
$top10
;
}
//
public function formatTop10(){
//
//月赛前10名用户的挑战情况
//
$month=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
//
$top10=M('PktopUserphb')->where(array('month'=>$month))->order('month desc,monthup desc')->limit(10)->select();
//
$top10UserId=array();
//
foreach ($top10 as $k => &$v) {
//
$top10UserId[]=$v['user_id'];
//
$v['userUrl'] = tradeDetailLink($this->GID,3,$v['user_id']);
//
}
//
//取被挑战者的挑战人员
//
//
$enemyNum=M('PkData')->where(array('pk_end_time'=>array('egt',date('Y-m-d'))))->group('passive_id')->getField('passive_id,count(*) num',true);
//
$enemy=M('PkData')->where(array('passive_id'=>array('in',$top10UserId)))->select();
//
$enemyId=array();
//
foreach ($enemy as $k => $v1) {
//
$enemyId[$v1['passive_id']][]=$v1['active_id'];
//
//
}
//
foreach ($top10 as $k => &$v2) {
//
$v2['enemyNum']=count($enemyId[$v2['user_id']]);
//
//
$v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
//
//敌人头像列表
//
$v2['enemy']=$enemyId[$v2['user_id']];
//
//
$v['head_img'] = getPortraitPath($value['user_id'], 'small', true);
//
//
}
//
return $top10;
//
}
//我的挑战列表
// public function myPkList(){
// $userId = I('userId', '');
...
...
@@ -681,7 +684,7 @@ class IndexAction extends IdentityAction {
$lastMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
));
$monthUsers
=
M
(
'PktopUserphb'
)
->
where
(
array
(
'month'
=>
$month
))
->
order
(
'monthup desc'
)
->
select
();
$myPkUserId
=
$this
->
getMyPkUserId
(
$userId
);
//
$myPkUserId=$this->getMyPkUserId($userId);
$userIds
=
[];
foreach
(
$monthUsers
as
$key
=>
$value
)
{
...
...
@@ -767,74 +770,70 @@ class IndexAction extends IdentityAction {
}
//用户列表,包括最新挑战榜,人气挑战榜等页面
public
function
userList
(){
$userId
=
$this
->
user
[
'userID'
];
$type
=
I
(
'type'
,
'new'
);
$p
=
I
(
'p'
,
1
);
$pageSize
=
10
;
$lastMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
));
$lastMonthInt
=
intval
(
date
(
'm'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
)));
if
(
$type
==
'new'
){
$userList
=
$this
->
formatTop10
();
$count
=
10
;
}
if
(
$type
==
'hot'
){
//所有月份的去掉where(array('month'=>$lastMonth))
$passiveIds
=
M
(
'PkData'
)
->
group
(
'passive_id'
)
->
order
(
'count(*) desc'
)
->
getField
(
'passive_id'
,
true
);
$where
=
array
(
'user_id'
=>
array
(
'in'
,
$passiveIds
));
$userList
=
M
(
'PktopUserphb'
)
->
where
(
$where
)
->
order
(
'field(user_id,'
.
implode
(
','
,
$passiveIds
)
.
')'
)
->
page
(
$p
.
','
.
$pageSize
)
->
select
();
$count
=
M
(
'PktopUserphb'
)
->
where
(
$where
)
->
count
();
}
if
(
$type
==
'all'
){
$month
=
I
(
'month'
,
$lastMonth
);
$where
=
array
(
'month'
=>
$month
);
$userList
=
M
(
'PktopUserphb'
)
->
where
(
$where
)
->
order
(
'monthup desc'
)
->
page
(
$p
.
','
.
$pageSize
)
->
select
();
$selectMonth
=
array
();
foreach
(
$this
->
MONTH
as
$k
=>
$value
)
{
$nowMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)));
if
(
$k
<
$nowMonth
){
$selectMonth
[
$k
]
=
$value
;
}
}
// $type='lastMonth';
$count
=
M
(
'PktopUserphb'
)
->
where
(
$where
)
->
count
();
}
$myPkUserId
=
$this
->
getMyPkUserId
(
$userId
);
$userIds
=
array
();
foreach
(
$userList
as
$k
=>
&
$v
)
{
$v
[
'pkStatus'
]
=
in_array
(
$v
[
'user_id'
],
$myPkUserId
)
?
1
:
0
;
$v
[
'userUrl'
]
=
tradeDetailLink
(
$this
->
GID
,
3
,
$v
[
'user_id'
]);
$userIds
[]
=
$v
[
'user_id'
];
}
// $enemyIds=$this->getEnemy($userIds);
// foreach ($userList as $k => &$v4) {
// $v4['enemyNum']=count($enemyIds[$v4['user_id']]);
// $v4['enemy']=$enemyIds[$v4['user_id']];
// public function userList(){
//
// $userId=$this->user['userID'];
// $type = I('type', 'new');
// $p=I('p',1);
// $pageSize = 10;
// $lastMonth=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
// $lastMonthInt=intval(date('m',strtotime(date('Y-m-01') . "-1 month")));
//
// if($type=='new'){
// $userList=$this->formatTop10();
// $count=10;
// }
// var_dump($userList);exit;
$pkTime
=
date
(
'n月j日'
,
strtotime
(
'next Monday'
))
.
'-'
.
date
(
'n月j日'
,
strtotime
(
'next Monday'
)
+
4
*
3600
*
24
);
$this
->
assign
(
array
(
'type'
=>
$type
,
'userList'
=>
$userList
,
'selectMonth'
=>
$selectMonth
,
'lastMonthInt'
=>
$lastMonthInt
,
'pkTime'
=>
$pkTime
));
if
(
$count
){
import
(
"ORG.Util.Page"
);
$page
=
new
Page
(
$count
,
$pageSize
,
''
,
'index/userList/type/'
.
$type
.
'/p'
);
$this
->
assign
(
'_page'
,
$page
->
show
());
}
$this
->
setValue
(
$userId
);
$this
->
display
();
}
// if($type=='hot'){
// //所有月份的去掉where(array('month'=>$lastMonth))
// $passiveIds=M('PkData')->group('passive_id')->order('count(*) desc')->getField('passive_id',true);
// $where=array('user_id'=>array('in',$passiveIds));
//
// $userList=M('PktopUserphb')->where($where)->order('field(user_id,'.implode(',',$passiveIds).')')->page($p.','.$pageSize)->select();
// $count = M('PktopUserphb')->where($where)->count();
// }
// if($type=='all'){
// $month = I('month',$lastMonth);
// $where=array('month'=>$month);
// $userList=M('PktopUserphb')->where($where)->order('monthup desc')->page($p.','.$pageSize)->select();
// $selectMonth=array();
// foreach ($this->MONTH as $k => $value) {
// $nowMonth=date('Y-m',strtotime(date('Y-m-01')));
// if($k<$nowMonth){
// $selectMonth[$k]=$value;
// }
// }
//// $type='lastMonth';
// $count = M('PktopUserphb')->where($where)->count();
// }
//
// $myPkUserId=$this->getMyPkUserId($userId);
// $userIds=array();
// foreach ($userList as $k => &$v) {
// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
// $v['userUrl'] = tradeDetailLink($this->GID,3,$v['user_id']);
// $userIds[]=$v['user_id'];
// }
//// $enemyIds=$this->getEnemy($userIds);
//// foreach ($userList as $k => &$v4) {
//// $v4['enemyNum']=count($enemyIds[$v4['user_id']]);
//// $v4['enemy']=$enemyIds[$v4['user_id']];
//// }
//
//
//// var_dump($userList);exit;
// $pkTime=date('n月j日',strtotime('next Monday')).'-'.date('n月j日',strtotime('next Monday')+4*3600*24);
// $this->assign(array('type'=>$type,'userList'=>$userList,'selectMonth'=>$selectMonth,'lastMonthInt'=>$lastMonthInt
// ,'pkTime'=>$pkTime));
//
//
// if($count){
// import("ORG.Util.Page");
// $page = new Page($count,$pageSize,'','index/userList/type/'.$type.'/p');
// $this->assign('_page', $page->show());
// }
// $this->setValue($userId);
// $this->display();
// }
// private function formatPassUsers($data,$num=7) {
// $result=array();
...
...
@@ -886,21 +885,21 @@ class IndexAction extends IdentityAction {
// }
//我的未结束的挑战
private
function
getMyPkUserId
(
$userId
){
$where
=
array
(
'pk_end_time'
=>
array
(
'egt'
,
date
(
'Y-m-d'
)),
'_complex'
=>
array
(
'active_id'
=>
$userId
,
'passive_id'
=>
$userId
,
'_logic'
=>
'or'
));
$myPks
=
M
(
'PkData'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
select
();
$myPkUserId
=
array
();
foreach
(
$myPks
as
$k
=>
$value
)
{
//取我主动挑战的人
if
(
$value
[
'active_id'
]
==
$userId
){
$myPkUserId
[]
=
$value
[
'passive_id'
];
}
}
return
$myPkUserId
;
}
//
private function getMyPkUserId($userId){
//
$where=array('pk_end_time'=>array('egt',date('Y-m-d')),
//
'_complex'=>array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or'));
//
//
$myPks=M('PkData')->where($where)->order('add_time desc')->select();
//
//
$myPkUserId=array();
//
foreach ($myPks as $k => $value) {
//
//取我主动挑战的人
//
if($value['active_id']==$userId){
//
$myPkUserId[]=$value['passive_id'];
//
}
//
}
//
return $myPkUserId;
//
}
public
function
check_user_login_redirect
()
{
...
...
app/Lib/Action/Vip/PkTopAction.class.php
View file @
5f11fdb3
...
...
@@ -51,330 +51,328 @@ class PkTopAction extends IdentityAction{
}
//首页
public
function
indexOld
()
{
//首页的排行榜等切换
if
(
!
I
(
'viewPage'
)){
header
(
'location:'
.
M_URL
.
'/Match/jiang'
);
exit
;
}
$userIdParam
=
I
(
'user_id'
,
''
,
intval
);
$isapp
=
I
(
'isapp'
);
if
(
$isapp
)
{
$userId
=
substr
(
$isapp
,
strpos
(
$isapp
,
'='
)
+
1
);
if
(
$userId
)
{
$userIdParam
=
$userId
;
}
}
$key
=
I
(
'key'
,
''
);
$key2
=
I
(
'key2'
,
''
);
if
(
$userIdParam
==
''
)
{
if
(
$this
->
user
[
'userID'
]
==
''
)
{
//有了第二次请求,不再请求第三次
if
(
$key2
==
''
)
{
$this
->
assign
(
'refresh'
,
1
);
$this
->
assign
(
'viewPage'
,
I
(
'viewPage'
,
'1'
));
}
}
else
{
$userId
=
$this
->
user
[
'userID'
];
}
}
else
{
//第二次请求
if
(
md5
(
$userIdParam
.
'abcd4321'
)
==
$key2
||
md5
(
'user_id='
.
$userIdParam
.
'abcd4321'
)
==
$key
)
{
$userId
=
$userIdParam
;
}
}
//echo $userId;exit;
//app从过来可能没有userName
if
(
$userId
&&
$this
->
user
[
'userName'
]
==
''
)
{
$this
->
setUcLogin
(
$userId
);
}
// $gid = I('gid', 0, intval);
// $gid = $gid ? $gid : $this->GID;
$gid
=
$this
->
GID
;
$groupId
=
I
(
'groupId'
,
$gid
);
// var_dump($groupId);exit;
$groupInfo
=
M
(
'Group'
)
->
field
(
'group_id,web_id,category,name,startTime,endTime,member_quantity'
)
->
where
([
'group_id'
=>
$groupId
])
->
find
();
$groupStatus
=
$this
->
getGroupStatus
(
$groupInfo
);
$member_quantity
=
$groupInfo
[
'member_quantity'
];
//用到
$ids
=
D
(
'Group'
)
->
getGroupCache
(
$userId
);
if
(
in_array
(
$groupId
,
$ids
))
{
$this
->
assign
(
'joinStatus'
,
1
);
}
//滚动消息,1pk付款,2发起pk,3pk胜利,4pk失败,5胜利退钱,6失败钱归passive,7买重置卡
$msg1
=
M
(
'PktopNews'
)
->
where
([
'type'
=>
[
'in'
,
'2'
]])
->
order
(
'add_time desc'
)
->
limit
(
5
)
->
select
();
$msg2
=
M
(
'PktopNews'
)
->
where
([
'type'
=>
[
'in'
,
'3'
]])
->
order
(
'add_time desc'
)
->
limit
(
5
)
->
select
();
$msg
=
empty
(
$msg2
)
?
$msg1
:
array_merge
(
$msg2
,
$msg1
);
//pk通关榜,1挑战者胜利,2被挑战者胜利
$allPassUsers
=
M
(
'PktopData'
)
->
field
(
'distinct active_id,active_name'
)
->
where
([
'pk_status'
=>
1
])
->
order
(
'add_time desc'
)
->
select
();
$passUsers
=
$this
->
formatPassUsers
(
$allPassUsers
);
//我的未结束的挑战
$where
=
[
'pk_end_time'
=>
[
'egt'
,
date
(
'Y-m-d'
)],
'_complex'
=>
[
'active_id'
=>
$userId
,
'passive_id'
=>
$userId
,
'_logic'
=>
'or'
]];
$myPks
=
M
(
'PktopData'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
select
();
if
(
!
empty
(
$myPks
))
{
$myPk
=
$myPks
[
0
];
$myPk
[
'pk_begin_time'
]
=
date
(
'm月d日'
,
strtotime
(
$myPk
[
'pk_begin_time'
]));
$myPk
[
'pk_end_time'
]
=
date
(
'm月d日'
,
strtotime
(
$myPk
[
'pk_end_time'
]));
}
$myPkUserId
=
[];
foreach
(
$myPks
as
$k
=>
$value
)
{
//取我主动挑战的人
if
(
$value
[
'active_id'
]
==
$userId
)
{
$myPkUserId
[]
=
$value
[
'passive_id'
];
}
}
//最新挑战榜,每个月top10,不需要了
// $top10=$this->formatTop10();
// foreach ($top10 as $k => &$v) {
// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
// public function indexOld() {
// //首页的排行榜等切换
// if(!I('viewPage')){
// header('location:'.M_URL.'/Match/jiang');
// exit;
//
// }
//
// $userIdParam = I('user_id', '', intval);
// $isapp = I('isapp');
// if ($isapp) {
// $userId = substr($isapp, strpos($isapp, '=') + 1);
// if ($userId) {
// $userIdParam = $userId;
// }
//我的所有的挑战数,不需要了
// $myAllPkCount=M('PktopData')->where(array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or'))->count();
$lastMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
));
$lastMonthInt
=
intval
(
date
(
'm'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
)));
$mingrentang
=
$this
->
getMingrentangData
(
$myPkUserId
);
$rankNow
=
$this
->
rankNow
(
'local'
);
//弹窗里面的pk时间段
$pkTime
=
date
(
'n月j日'
,
strtotime
(
'next Monday'
))
.
'-'
.
date
(
'n月j日'
,
strtotime
(
'next Monday'
)
+
4
*
3600
*
24
);
$gonggao
=
$this
->
getGonggao
();
//获奖心得
$where
=
[
'think'
=>
[
'exp'
,
'is not null and think != ""'
]];
$thinks
=
M
(
'PktopUserphb'
)
->
where
(
$where
)
->
order
(
'month desc'
)
->
limit
(
10
)
->
select
();
//刷新页面后获取弹出的消息
//没有pk,不需要弹窗了
// $popData = $this->getPopData($userId);
$popData
=
null
;
//第一个页面显示的数据,公告,心得等
$firstPageData
=
[
'popType'
=>
$popData
[
'popType'
],
'popPkUserName'
=>
$popData
[
'popPkUserName'
],
'thinks'
=>
$thinks
,
'gonggao'
=>
$gonggao
];
$return
=
[
'msg'
=>
$msg
,
'myPk'
=>
$myPk
,
'myPkCount'
=>
count
(
$myPks
),
'passUsers'
=>
$passUsers
,
'passUserCount'
=>
count
(
$allPassUsers
)
+
5
,
'top10'
=>
$top10
,
'pkTime'
=>
$pkTime
,
'lastMonthInt'
=>
$lastMonthInt
,
'myAllPkCount'
=>
$myAllPkCount
];
$this
->
assign
(
$firstPageData
);
$this
->
assign
(
$mingrentang
);
$this
->
assign
(
$rankNow
);
$this
->
assign
(
$return
);
//总决赛列表
$_GET
[
'order'
]
=
'zongup'
;
$finalList
=
$this
->
rankNow
(
'local'
,
$this
->
GID
);
// var_dump(DB_USER);exit;
$this
->
assign
(
'finalList'
,
$finalList
[
'finalList'
]);
// $share=array('groupId'=>$groupId,'groupStatus'=>$groupStatus,'viewPage'=>2,
// 'close_tips'=>'','userID'=>'XXXXXX','zhuangtai'=>$this->STATUS_TXT[$groupStatus]);
$share
=
array
(
'groupId'
=>
$groupId
,
'groupStatus'
=>
$groupStatus
,
'viewPage'
=>
2
,
'statusInt'
=>
$groupStatus
,
'close_tips'
=>
''
,
'userID'
=>
$userId
,
'zhuangtai'
=>
$this
->
STATUS_TXT
[
$groupStatus
]);
$groupInfo
=
array_merge
(
$groupInfo
,
$share
);
$this
->
assign
(
'groupInfo'
,
json_encode
(
$groupInfo
));
$this
->
setShare
(
$userId
,
I
(
'cfrom'
));
//朋友圈,微信群,好友分享,分享后自己的id,作为邀请人的id,pc扫码后没有from参数
$inviterId
=
I
(
'inviterId'
,
''
);
if
(
in_array
(
I
(
'from'
),
array
(
'timeline'
,
'groupmessage'
,
'singlemessage'
)))
{
if
(
$inviterId
==
''
)
{
$inviterId
=
I
(
'user_id'
,
''
,
intval
);
if
(
$inviterId
==
''
)
{
$isapp
=
I
(
'isapp'
,
''
);
$inviterId
=
substr
(
$isapp
,
strpos
(
$isapp
,
'='
)
+
1
);
}
}
}
$this
->
assign
(
'inviterId'
,
$inviterId
);
//记录页面访问来源,cfrom可能是cofoolwx
// if(I('cfrom')){
// $referer=I('cfrom');
// }else{
// $referer=$_SERVER['HTTP_REFERER']?$_SERVER['HTTP_REFERER']:I('from','');
// }
if
(
I
(
'cfrom'
))
{
$referer
=
I
(
'cfrom'
);
}
elseif
(
I
(
'hFrom'
))
{
$referer
=
I
(
'hFrom'
);
}
elseif
(
I
(
'from'
))
{
$referer
=
I
(
'from'
);
}
else
{
$referer
=
$_SERVER
[
'HTTP_REFERER'
];
}
//获奖人员
$luckydogs
=
M
(
'PktopLuckydog'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
limit
(
10
)
->
select
();
$this
->
assign
(
'luckydogs'
,
$luckydogs
);
//这个月剩余的抽奖机会
$leftCjNum
=
A
(
'Public'
)
->
getLeftCjNum
();
$this
->
assign
(
'leftCjNum'
,
$leftCjNum
);
//大赛状态
$gInfo
[
'gStatus'
]
=
is_end
(
$groupInfo
[
'endTime'
])
?
'3'
:
(
$groupInfo
[
'startTime'
]
>
time
()
?
'1'
:
'2'
);
$this
->
assign
(
'gInfo'
,
$gInfo
);
$this
->
assign
(
'referer'
,
$referer
);
$this
->
assign
(
'member_quantity'
,
$member_quantity
);
$this
->
assign
(
'p'
,
1
);
//取微信
$weixin
=
M
(
'GroupInfo'
)
->
where
([
'group_id'
=>
$groupId
])
->
getField
(
'wechat'
);
$this
->
assign
(
'weixin'
,
$weixin
);
$this
->
assign
(
'weixinUrl'
,
'https://eturl.cn/Rhq2wA?is_head=1'
);
$ua
=
strtolower
(
$_SERVER
[
'HTTP_USER_AGENT'
]);
$hideShiPan
=
0
;
// $tj=strpos($ua, 'oppo')||strpos($ua, 'huawei_jt')||strpos($ua, 'xiaomi');
$tj
=
strpos
(
$ua
,
'vivo'
);
if
(
$tj
){
$hideShiPan
=
1
;
}
if
(
I
(
'channel'
)
==
'tencent_new_simplify'
&&
I
(
'version'
)
<
'A3.7.9R'
){
$hideShiPan
=
1
;
}
$this
->
assign
(
'hideShiPan'
,
$hideShiPan
);
//更多大赛
$gList
=
D
(
'Niu'
)
->
getMoreDs
(
$userId
);
$this
->
assign
(
'gList'
,
$gList
);
$this
->
assign
(
'gid'
,
$gid
);
$this
->
display
();
}
// $key = I('key', '');
// $key2 = I('key2', '');
//
// if ($userIdParam == '') {
// if ($this->user['userID'] == '') {
// //有了第二次请求,不再请求第三次
// if ($key2 == '') {
// $this->assign('refresh', 1);
// $this->assign('viewPage', I('viewPage', '1'));
// }
// } else {
// $userId = $this->user['userID'];
// }
// } else {
// //第二次请求
// if (md5($userIdParam . 'abcd4321') == $key2 || md5('user_id=' . $userIdParam .'abcd4321') == $key) {
// $userId = $userIdParam;
// }
// }
////echo $userId;exit;
// //app从过来可能没有userName
// if ($userId && $this->user['userName'] == '') {
// $this->setUcLogin($userId);
// }
//
//
//// $gid = I('gid', 0, intval);
//// $gid = $gid ? $gid : $this->GID;
//
// $gid = $this->GID;
// $groupId = I('groupId', $gid);
//
//
//// var_dump($groupId);exit;
//
// $groupInfo = M('Group')->field('group_id,web_id,category,name,startTime,endTime,member_quantity')->where(['group_id' => $groupId])->find();
// $groupStatus = $this->getGroupStatus($groupInfo);
// $member_quantity = $groupInfo['member_quantity'];
// //用到
// $ids = D('Group')->getGroupCache($userId);
// if (in_array($groupId, $ids)) {
// $this->assign('joinStatus', 1);
// }
//
// //滚动消息,1pk付款,2发起pk,3pk胜利,4pk失败,5胜利退钱,6失败钱归passive,7买重置卡
// $msg1 = M('PktopNews')->where(['type' => ['in', '2']])->order('add_time desc')->limit(5)->select();
// $msg2 = M('PktopNews')->where(['type' => ['in', '3']])->order('add_time desc')->limit(5)->select();
// $msg = empty($msg2) ? $msg1 : array_merge($msg2, $msg1);
//
// //pk通关榜,1挑战者胜利,2被挑战者胜利
// $allPassUsers = M('PktopData')->field('distinct active_id,active_name')->where(['pk_status' => 1])->order('add_time desc')->select();
//
// $passUsers = $this->formatPassUsers($allPassUsers);
// //我的未结束的挑战
// $where = ['pk_end_time' => ['egt', date('Y-m-d')], '_complex' => ['active_id' => $userId, 'passive_id' => $userId, '_logic' => 'or']];
//
// $myPks = M('PktopData')->where($where)->order('add_time desc')->select();
// if (!empty($myPks)) {
// $myPk = $myPks[0];
// $myPk['pk_begin_time'] = date('m月d日', strtotime($myPk['pk_begin_time']));
// $myPk['pk_end_time'] = date('m月d日', strtotime($myPk['pk_end_time']));
// }
// $myPkUserId = [];
// foreach ($myPks as $k => $value) {
// //取我主动挑战的人
// if ($value['active_id'] == $userId) {
// $myPkUserId[] = $value['passive_id'];
// }
// }
//
// //最新挑战榜,每个月top10,不需要了
//// $top10=$this->formatTop10();
//// foreach ($top10 as $k => &$v) {
//// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
//// }
// //我的所有的挑战数,不需要了
//// $myAllPkCount=M('PktopData')->where(array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or'))->count();
//
// $lastMonth = date('Y-m', strtotime(date('Y-m-01') . "-1 month"));
// $lastMonthInt = intval(date('m', strtotime(date('Y-m-01') . "-1 month")));
//
// $mingrentang = $this->getMingrentangData($myPkUserId);
// $rankNow = $this->rankNow('local');
//
// //弹窗里面的pk时间段
// $pkTime = date('n月j日', strtotime('next Monday')) . '-' . date('n月j日', strtotime('next Monday') + 4 * 3600 * 24);
//
// $gonggao = $this->getGonggao();
//
// //获奖心得
// $where = ['think' => ['exp', 'is not null and think != ""']];
// $thinks = M('PktopUserphb')->where($where)->order('month desc')->limit(10)->select();
//
// //刷新页面后获取弹出的消息
// //没有pk,不需要弹窗了
//// $popData = $this->getPopData($userId);
// $popData=null;
// //第一个页面显示的数据,公告,心得等
// $firstPageData = ['popType' => $popData['popType'], 'popPkUserName' => $popData['popPkUserName'], 'thinks' => $thinks, 'gonggao' => $gonggao];
//
// $return = ['msg' => $msg, 'myPk' => $myPk, 'myPkCount' => count($myPks), 'passUsers' => $passUsers,
// 'passUserCount' => count($allPassUsers) + 5, 'top10' => $top10, 'pkTime' => $pkTime,
// 'lastMonthInt' => $lastMonthInt, 'myAllPkCount' => $myAllPkCount];
//
// $this->assign($firstPageData);
// $this->assign($mingrentang);
// $this->assign($rankNow);
// $this->assign($return);
//
// //总决赛列表
// $_GET['order'] = 'zongup';
// $finalList = $this->rankNow('local', $this->GID);
//// var_dump(DB_USER);exit;
// $this->assign('finalList', $finalList['finalList']);
//
//// $share=array('groupId'=>$groupId,'groupStatus'=>$groupStatus,'viewPage'=>2,
//// 'close_tips'=>'','userID'=>'XXXXXX','zhuangtai'=>$this->STATUS_TXT[$groupStatus]);
// $share = array('groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus,
// 'close_tips' => '', 'userID' => $userId, 'zhuangtai' => $this->STATUS_TXT[$groupStatus]);
//
// $groupInfo = array_merge($groupInfo, $share);
//
// $this->assign('groupInfo', json_encode($groupInfo));
//
// $this->setShare($userId, I('cfrom'));
//
// //朋友圈,微信群,好友分享,分享后自己的id,作为邀请人的id,pc扫码后没有from参数
// $inviterId = I('inviterId', '');
// if (in_array(I('from'), array('timeline', 'groupmessage', 'singlemessage'))) {
// if ($inviterId == '') {
// $inviterId = I('user_id', '', intval);
// if ($inviterId == '') {
// $isapp = I('isapp', '');
// $inviterId = substr($isapp, strpos($isapp, '=') + 1);
// }
// }
// }
// $this->assign('inviterId', $inviterId);
//
// //记录页面访问来源,cfrom可能是cofoolwx
//// if(I('cfrom')){
//// $referer=I('cfrom');
//// }else{
//// $referer=$_SERVER['HTTP_REFERER']?$_SERVER['HTTP_REFERER']:I('from','');
//// }
// if (I('cfrom')) {
// $referer = I('cfrom');
// } elseif (I('hFrom')) {
// $referer = I('hFrom');
// } elseif (I('from')) {
// $referer = I('from');
// } else {
// $referer = $_SERVER['HTTP_REFERER'];
// }
// //获奖人员
// $luckydogs = M('PktopLuckydog')->where($where)->order('add_time desc')->limit(10)->select();
// $this->assign('luckydogs', $luckydogs);
// //这个月剩余的抽奖机会
// $leftCjNum = A('Public')->getLeftCjNum();
// $this->assign('leftCjNum', $leftCjNum);
// //大赛状态
// $gInfo['gStatus'] = is_end($groupInfo['endTime']) ? '3' : ($groupInfo['startTime'] > time() ? '1' : '2');
// $this->assign('gInfo', $gInfo);
//
// $this->assign('referer', $referer);
// $this->assign('member_quantity', $member_quantity);
// $this->assign('p', 1);
// //取微信
// $weixin = M('GroupInfo')->where(['group_id' => $groupId])->getField('wechat');
// $this->assign('weixin', $weixin);
// $this->assign('weixinUrl', 'https://eturl.cn/Rhq2wA?is_head=1');
//
//
// $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
// $hideShiPan=0;
//// $tj=strpos($ua, 'oppo')||strpos($ua, 'huawei_jt')||strpos($ua, 'xiaomi');
// $tj=strpos($ua, 'vivo');
// if($tj){
// $hideShiPan=1;
// }
// if(I('channel')=='tencent_new_simplify'&&I('version')<'A3.7.9R'){
// $hideShiPan=1;
// }
// $this->assign('hideShiPan',$hideShiPan);
//
// //更多大赛
// $gList=D('Niu')->getMoreDs($userId);
// $this->assign('gList',$gList);
// $this->assign('gid',$gid);
// $this->display();
// }
//大赛排行榜的当前排行页面
public
function
rankNow
(
$caller
=
''
,
$gid
=
0
){
$gid
=
$gid
?
$gid
:
$this
->
GID
;
$order
=
I
(
'order'
,
'lastmonthup'
);
$p
=
I
(
'p'
,
1
);
// $pageSize=10;
$pageSize
=
$gid
==
$this
->
GID
?
10
:
200
;
//分表归档
$suffix
=
D
(
'Userinfo'
)
->
getTable
(
$gid
);
$table
=
$suffix
?
'mncg_archive.userinfo'
.
$suffix
:
'mncg.userinfo'
;
$where
=
array
(
'sex'
=>
$gid
,
'new_phb'
=>
array
(
'gt'
,
0
),
'zt'
=>
1
);
//测试时不用缓存->cache(true,cacheTime())
$userNowList
=
M
(
$table
,
" "
,
C
(
'DB_CONFIG_MNCG3'
))
->
where
(
$where
)
->
order
(
$order
.
' desc'
)
->
page
(
$p
.
','
.
$pageSize
)
->
select
();
// var_dump($gid);exit;
$userids
=
array
();
$usertranids
=
[];
foreach
(
$userNowList
as
$key
=>
&
$rankV
)
{
$userIDs
=
explode
(
"X"
,
$rankV
[
'uid'
]);
$rankV
[
'user_id'
]
=
$userIDs
[
1
];
// $rankV['userUrl'] = tradeDetailLink($this->GID,3,$userIDs[1]);
$userids
[]
=
$userIDs
[
1
];
$usertranids
[]
=
$rankV
[
'uid'
];
}
$nick_name_arry
=
getUser
(
$userids
,
'nick'
);
////
$robot_user
=
[];
if
(
!
empty
(
$usertranids
)){
$robot_user
=
D
(
'Robot'
)
->
groupRobotTranUserList
(
$usertranids
);
}
foreach
(
$userNowList
as
$key
=>
&
$value
)
{
$nick_name
=
$nick_name_arry
[
$value
[
'user_id'
]];
//$value['user_name'] = $nick_name?$nick_name:$value['username'];
$value
[
'user_name'
]
=
$nick_name
;
$robot_flag_show
=
D
(
'Robot'
)
->
robot_flag_show
(
$value
[
'user_id'
]);
$value
[
'robot_user'
]
=
in_array
(
$value
[
'user_id'
],
$robot_user
)
&&
$robot_flag_show
==
1
?
1
:
0
;
$value
[
'robot_url'
]
=
in_array
(
$value
[
'user_id'
],
$robot_user
)
&&
$robot_flag_show
==
1
?
M_URL
.
'/Robot'
:
''
;
}
//总数目
$totalCount
=
M
(
$table
,
" "
,
C
(
'DB_CONFIG_MNCG3'
))
->
where
(
$where
)
->
count
();
if
(
$caller
==
'local'
){
if
(
$gid
==
$this
->
GID
){
$return
[
'userList'
]
=
$userNowList
;
$return
[
'order'
]
=
$order
;
$return
[
'totalCount'
]
=
$totalCount
;
$return
[
'pages'
]
=
ceil
(
$totalCount
/
$pageSize
);
}
else
{
$return
[
'finalList'
]
=
$userNowList
;
$return
[
'order'
]
=
$order
;
// public function rankNow($caller='',$gid=0){
// $gid=$gid?$gid:$this->GID;
// $order=I('order','lastmonthup');
// $p=I('p', 1);
//// $pageSize=10;
// $pageSize=$gid==$this->GID?10:200;
// //分表归档
// $suffix = D('Userinfo')->getTable($gid);
// $table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo';
// $where=array('sex'=>$gid,'new_phb'=>array('gt',0),'zt'=>1);
// //测试时不用缓存->cache(true,cacheTime())
// $userNowList = M($table, " ", C('DB_CONFIG_MNCG3'))->where($where)->order($order.' desc')->page($p.','.$pageSize)->select();
//// var_dump($gid);exit;
// $userids = array();
// $usertranids = [];
// foreach ($userNowList as $key => &$rankV) {
// $userIDs = explode("X", $rankV['uid']);
// $rankV['user_id'] = $userIDs[1];
//// $rankV['userUrl'] = tradeDetailLink($this->GID,3,$userIDs[1]);
// $userids[] = $userIDs[1];
// $usertranids[] = $rankV['uid'];
// }
//
// $nick_name_arry =getUser($userids,'nick');////
// $robot_user = [];
// if(!empty($usertranids)){
// $robot_user = D('Robot')->groupRobotTranUserList($usertranids);
// }
// foreach ($userNowList as $key => &$value) {
// $nick_name = $nick_name_arry[$value['user_id']];
// //$value['user_name'] = $nick_name?$nick_name:$value['username'];
// $value['user_name'] = $nick_name;
//
// $robot_flag_show = D('Robot')->robot_flag_show($value['user_id']);
// $value['robot_user'] = in_array($value['user_id'],$robot_user) && $robot_flag_show == 1 ? 1 : 0;
// $value['robot_url'] = in_array($value['user_id'],$robot_user) && $robot_flag_show == 1 ? M_URL.'/Robot' : '';
//
// }
// //总数目
// $totalCount = M($table, " ", C('DB_CONFIG_MNCG3'))->where($where)->count();
// if($caller=='local'){
// if($gid==$this->GID){
// $return['userList']=$userNowList;
// $return['order']=$order;
// $return['totalCount']=$totalCount;
// $return['pages']=$totalCount/10;
}
return
$return
;
}
else
{
$this
->
assign
(
array
(
'order'
=>
$order
,
'userList'
=>
$userNowList
,
'p'
=>
$p
));
if
(
$gid
==
$this
->
GID
){
$content
=
$this
->
fetch
(
'itemNow'
);
}
else
{
$content
=
$this
->
fetch
(
'finalList'
);
}
$content
=
$this
->
fetch
(
'itemNow'
);
$this
->
ajaxReturn
(
array
(
'status'
=>
1
,
'count'
=>
$totalCount
,
'data'
=>
$content
));
}
}
public
function
getMingrentangData
(
$myPkUserId
){
$lastMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
));
//名人堂的月份下拉框
$selectMonth1
=
$selectMonth2
=
array
();
foreach
(
$this
->
MONTH
as
$k
=>
$value
)
{
$nowMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)));
// if($k<$nowMonth){
$selectMonth1
[
$k
]
=
$selectMonth2
[
$k
]
=
$value
;
// }
//月排行榜显示当前的月份
// if($k==$nowMonth){
// $selectMonth2[$k]=$value;
// }
}
$mingrentang
=
array
(
'selectMonth1'
=>
$selectMonth1
,
'selectMonth2'
=>
$selectMonth2
,
'selectMonthStart1'
=>
current
(
$selectMonth1
),
'selectMonthStart2'
=>
current
(
$selectMonth2
));
$nowTop10UserIds
=
array
();
//名人堂的月排行榜,默认显示当前月的前10名
$monthUsers
=
M
(
'PktopUserphb'
)
->
where
(
array
(
'month'
=>
date
(
'Y-m'
)))
->
order
(
'monthup desc'
)
->
select
();
foreach
(
$monthUsers
as
$k
=>
&
$v4
)
{
$v4
[
'pkStatus'
]
=
in_array
(
$v4
[
'user_id'
],
$myPkUserId
)
?
1
:
0
;
$nowTop10UserIds
[]
=
$v4
[
'user_id'
];
}
$enemyIds
=
$this
->
getEnemy
(
$nowTop10UserIds
);
$zongupData
=
$this
->
getZongup
();
foreach
(
$monthUsers
as
$k
=>
&
$v4
)
{
$v4
[
'enemyNum'
]
=
count
(
$enemyIds
[
$v4
[
'user_id'
]]);
$v4
[
'enemy'
]
=
$enemyIds
[
$v4
[
'user_id'
]];
$v4
[
'zongup'
]
=
$zongupData
[
$v4
[
'user_id'
]];
}
//名人堂数据的决赛名单,只包括pk胜利者,现在用不到
// $finalUsers=M('PktopUser')->where(array('month'=>$lastMonth,'active_money'=>array('gt',0)))->order('monthup desc')->select();
// $mingrentang['finalUsers']=$finalUsers;
$mingrentang
[
'userList'
]
=
$monthUsers
;
$mingrentang
[
'type'
]
=
'nowMonth'
;
return
$mingrentang
;
}
// $return['pages']=ceil($totalCount/$pageSize);
// }else{
// $return['finalList']=$userNowList;
// $return['order']=$order;
//// $return['totalCount']=$totalCount;
//// $return['pages']=$totalCount/10;
// }
//
// return $return;
// }else{
// $this->assign(array('order'=>$order,'userList'=>$userNowList,'p'=>$p));
// if($gid==$this->GID){
// $content = $this->fetch('itemNow');
// }else{
// $content = $this->fetch('finalList');
// }
// $content = $this->fetch('itemNow');
// $this->ajaxReturn(array(
// 'status' => 1,'count' =>$totalCount,'data' => $content ));
// }
// }
// public function getMingrentangData($myPkUserId){
// $lastMonth=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
// //名人堂的月份下拉框
// $selectMonth1=$selectMonth2=array();
// foreach ($this->MONTH as $k => $value) {
// $nowMonth=date('Y-m',strtotime(date('Y-m-01')));
//
//// if($k<$nowMonth){
// $selectMonth1[$k]=$selectMonth2[$k]=$value;
//// }
//
// //月排行榜显示当前的月份
//// if($k==$nowMonth){
//// $selectMonth2[$k]=$value;
//// }
// }
// $mingrentang=array('selectMonth1'=>$selectMonth1,'selectMonth2'=>$selectMonth2,
// 'selectMonthStart1'=>current($selectMonth1),'selectMonthStart2'=>current($selectMonth2));
//
// $nowTop10UserIds=array();
// //名人堂的月排行榜,默认显示当前月的前10名
// $monthUsers=M('PktopUserphb')->where(array('month'=>date('Y-m')))->order('monthup desc')->select();
// foreach ($monthUsers as $k => &$v4) {
// $v4['pkStatus']=in_array($v4['user_id'],$myPkUserId)?1:0;
// $nowTop10UserIds[]=$v4['user_id'];
// }
// $enemyIds=$this->getEnemy($nowTop10UserIds);
//
// $zongupData=$this->getZongup();
// foreach ($monthUsers as $k => &$v4) {
// $v4['enemyNum']=count($enemyIds[$v4['user_id']]);
// $v4['enemy']=$enemyIds[$v4['user_id']];
// $v4['zongup']=$zongupData[$v4['user_id']];
// }
//
// //名人堂数据的决赛名单,只包括pk胜利者,现在用不到
//// $finalUsers=M('PktopUser')->where(array('month'=>$lastMonth,'active_money'=>array('gt',0)))->order('monthup desc')->select();
//// $mingrentang['finalUsers']=$finalUsers;
//
// $mingrentang['userList']=$monthUsers;
// $mingrentang['type']='nowMonth';
// return $mingrentang;
// }
//加入炼股赛
public
function
join
(){
...
...
@@ -394,9 +392,6 @@ class PkTopAction extends IdentityAction{
if
(
!
$smsCode
)
{
$this
->
ajaxReturn
([
'status'
=>
0
,
'info'
=>
'请输入手机验证码!'
]);
}
// if (S('tel:'. $mobile . ':'.$code_type) != $smsCode) {
// $this->ajaxReturn(array('status' => 0, 'info' => '对不起!手机验证码错误或已过期!'));
// }
$param
=
[
'mobile'
=>
$mobile
,
'code'
=>
$smsCode
,
'type'
=>
$code_type
];
if
(
D
(
'Sms'
)
->
checkCode
(
$param
)){
...
...
@@ -474,38 +469,34 @@ class PkTopAction extends IdentityAction{
//月赛前10名用户的挑战情况
private
function
formatTop10
(){
$month
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
));
$top10
=
M
(
'PktopUserphb'
)
->
where
(
array
(
'month'
=>
$month
))
->
order
(
'month desc,monthup desc'
)
->
limit
(
10
)
->
select
();
$top10UserIds
=
array
();
foreach
(
$top10
as
$k
=>
$v
)
{
$top10UserIds
[]
=
$v
[
'user_id'
];
}
$enemyIds
=
$this
->
getEnemy
(
$top10UserIds
);
foreach
(
$top10
as
$k
=>
&
$v
)
{
$v
[
'enemyNum'
]
=
count
(
$enemyIds
[
$v
[
'user_id'
]]);
// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
//敌人头像列表
$v
[
'enemy'
]
=
$enemyIds
[
$v
[
'user_id'
]];
}
// var_dump($top10);exit;
return
$top10
;
}
// private function formatTop10(){
// $month=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
// $top10=M('PktopUserphb')->where(array('month'=>$month))->order('month desc,monthup desc')->limit(10)->select();
// $top10UserIds=array();
// foreach ($top10 as $k => $v) {
// $top10UserIds[]=$v['user_id'];
// }
//
// $enemyIds=$this->getEnemy($top10UserIds);
// foreach ($top10 as $k => &$v) {
// $v['enemyNum']=count($enemyIds[$v['user_id']]);
//// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
// //敌人头像列表
// $v['enemy']=$enemyIds[$v['user_id']];
// }
//// var_dump($top10);exit;
// return $top10;
// }
public
function
getEnemy
(
$passiveIds
)
{
//取被挑战者的挑战人员array('pk_end_time'=>array('egt',date('Y-m-d')),'passive_id'=>array('in',$passiveIds))
$enemy
=
M
(
'PktopData'
)
->
where
(
array
(
'passive_id'
=>
array
(
'in'
,
$passiveIds
)))
->
select
();
$enemyIds
=
array
();
foreach
(
$enemy
as
$k
=>
$v
)
{
$enemyIds
[
$v
[
'passive_id'
]][]
=
$v
[
'active_id'
];
}
return
$enemyIds
;
}
//
public function getEnemy($passiveIds) {
//
//取被挑战者的挑战人员array('pk_end_time'=>array('egt',date('Y-m-d')),'passive_id'=>array('in',$passiveIds))
//
$enemy=M('PktopData')->where(array('passive_id'=>array('in',$passiveIds)))->select();
//
$enemyIds=array();
//
foreach ($enemy as $k => $v) {
//
$enemyIds[$v['passive_id']][]=$v['active_id'];
//
}
//
return $enemyIds;
//
}
public
function
sendMessage
()
{
$mobile
=
I
(
'mobile'
);
...
...
@@ -632,15 +623,18 @@ class PkTopAction extends IdentityAction{
D
(
'Sms'
)
->
send
([
'mobile'
=>
$mobile
,
'content'
=>
$bmContent
,
'type'
=>
46
],
true
,
true
);
//钱包
$wallet
=
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
if
(
empty
(
$wallet
)){
M
(
'Wallet'
)
->
add
([
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'add_time'
=>
time
(),
'money'
=>
1.88
]);
}
else
{
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$userId
])
->
setInc
(
'money'
,
1.88
);
}
$addData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'mobile'
=>
$mobile
,
'item_money'
=>
1.88
,
'item_time'
=>
time
(),
'group_id'
=>
$groupId
,
'status'
=>
1
,
'note'
=>
'【全民分赛场】报名成功'
];
M
(
'WalletItem'
)
->
add
(
$addData
);
// $wallet=M('Wallet')->where(['user_id'=>$userId])->find();
// if(empty($wallet)){
// M('Wallet')->add(['user_id'=>$userId,'user_name'=>$userName,'add_time'=>time(),'money'=>1.88]);
// }else{
// M('Wallet')->where(['user_id'=>$userId])->setInc('money',1.88);
// }
// $addData=['user_id'=>$userId,'user_name'=>$userName,'mobile'=>$mobile,
// 'item_money'=>1.88,'item_time'=>time(),'group_id'=>$groupId,'status'=>1,'note'=>'【全民分赛场】报名成功'];
// M('WalletItem')->add($addData);
D
(
'User'
)
->
addMoney
(
$userId
,
$userName
,
$mobile
);
D
(
'User'
)
->
addInvite
(
$userId
,
$userName
);
return
[
'status'
=>
1
,
'info'
=>
'参赛成功'
,
'debug'
=>
$userId
];
...
...
@@ -649,48 +643,48 @@ class PkTopAction extends IdentityAction{
//我的邀请列表
public
function
myInvite
(){
$userId
=
$this
->
user
[
'userID'
];
$cfrom
=
I
(
'cfrom'
,
''
);
$key
=
I
(
'key'
,
''
);
if
(
$cfrom
==
'pcInvitation'
){
$userIdParam
=
I
(
'user_id'
,
''
,
intval
);
// echo md5('user_id='.$userIdParam.'abcd4321');exit;
if
(
md5
(
'user_id='
.
$userIdParam
.
C
(
'login_user_id_salt'
))
==
$key
){
$this
->
setUcLogin
(
$userIdParam
);
$userId
=
$userIdParam
;
}
else
{
//校验不对
$userId
=-
1
;
}
}
// $userId=4825940;
$guests
=
M
(
'PktopUser'
)
->
where
(
array
(
'inviter_id'
=>
$userId
))
->
getField
(
'user_id,user_id,user_name'
,
true
);
$mncgData
=
M
(
"userinfo"
,
" "
,
C
(
'DB_CONFIG_MNCG3'
))
->
field
(
'uid,lastmonthup'
)
->
where
(
array
(
'sex'
=>
$this
->
GID
,
'new_phb'
=>
array
(
'gt'
,
0
)))
->
order
(
'lastmonthup desc,regdate asc'
)
->
cache
(
true
,
300
)
->
select
();
foreach
(
$mncgData
as
$k
=>
$value
)
{
$guestId
=
str_replace
(
$this
->
GID
.
'X'
,
''
,
$value
[
'uid'
]);
//有交易数据
if
(
!
empty
(
$guests
[
$guestId
])){
$guests
[
$guestId
][
'order'
]
=
$k
+
1
;
$guests
[
$guestId
][
'lastmonthup'
]
=
$value
[
'lastmonthup'
];
}
}
//var_dump($mncgData);exit;
$shareInfo
=
$this
->
setShare
(
$userId
,
$cfrom
);
$return
=
array
(
'guests'
=>
$guests
,
'guestNum'
=>
count
(
$guests
));
//点分享按钮时调用app的分享
$appParam
[
'url'
]
=
$shareInfo
[
'shareUrl'
];
$appParam
[
'name'
]
=
$shareInfo
[
'shareTitle'
];
$appParam
[
'introduction'
]
=
$shareInfo
[
'shareContent'
];
;
$this
->
assign
(
'appParam'
,
json_encode
(
$appParam
));
$this
->
assign
(
$return
);
$this
->
display
();
}
//
public function myInvite(){
//
$userId = $this->user['userID'];
//
$cfrom=I('cfrom', '');
//
$key=I('key', '');
//
if($cfrom=='pcInvitation'){
//
$userIdParam=I('user_id', '',intval);
//
//
echo md5('user_id='.$userIdParam.'abcd4321');exit;
//
if(md5('user_id='.$userIdParam.C('login_user_id_salt'))==$key){
//
$this->setUcLogin($userIdParam);
//
$userId=$userIdParam;
//
}else{
//
//校验不对
//
$userId=-1;
//
}
//
}
//
//
$userId=4825940;
//
$guests=M('PktopUser')->where(array('inviter_id'=>$userId))->getField('user_id,user_id,user_name',true);
//
$mncgData = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->field('uid,lastmonthup')->where(array('sex'=>$this->GID,'new_phb'=>array('gt',0)))
//
->order('lastmonthup desc,regdate asc')->cache(true,300)->select();
//
foreach ($mncgData as $k => $value) {
//
$guestId=str_replace($this->GID.'X','',$value['uid']);
//
//有交易数据
//
if(!empty($guests[$guestId])){
//
$guests[$guestId]['order']=$k+1;
//
$guests[$guestId]['lastmonthup']=$value['lastmonthup'];
//
}
//
}
//
//
var_dump($mncgData);exit;
//
$shareInfo=$this->setShare($userId,$cfrom);
//
//
$return=array('guests'=>$guests,'guestNum'=>count($guests));
//
//
//点分享按钮时调用app的分享
//
$appParam['url'] = $shareInfo['shareUrl'];
//
$appParam['name'] = $shareInfo['shareTitle'];
//
$appParam['introduction'] = $shareInfo['shareContent'];
//
;
//
$this->assign('appParam',json_encode($appParam));
//
$this->assign($return);
//
//
$this->display();
//
}
//取大赛的状态
private
function
getGroupStatus
(
$groupInfo
){
...
...
@@ -708,126 +702,126 @@ class PkTopAction extends IdentityAction{
}
//我的未结束的挑战
private
function
getMyPkUserId
(
$userId
){
$where
=
array
(
'pk_end_time'
=>
array
(
'egt'
,
date
(
'Y-m-d'
)),
'_complex'
=>
array
(
'active_id'
=>
$userId
,
'passive_id'
=>
$userId
,
'_logic'
=>
'or'
));
$myPks
=
M
(
'PktopData'
)
->
where
(
$where
)
->
order
(
'add_time desc'
)
->
select
();
$myPkUserId
=
array
();
foreach
(
$myPks
as
$k
=>
$value
)
{
//取我主动挑战的人
if
(
$value
[
'active_id'
]
==
$userId
){
$myPkUserId
[]
=
$value
[
'passive_id'
];
}
}
return
$myPkUserId
;
}
//
private function getMyPkUserId($userId){
//
$where=array('pk_end_time'=>array('egt',date('Y-m-d')),
//
'_complex'=>array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or'));
//
//
$myPks=M('PktopData')->where($where)->order('add_time desc')->select();
//
//
$myPkUserId=array();
//
foreach ($myPks as $k => $value) {
//
//取我主动挑战的人
//
if($value['active_id']==$userId){
//
$myPkUserId[]=$value['passive_id'];
//
}
//
}
//
return $myPkUserId;
//
}
//点首页名人堂的年度精英赛和月排行榜的下拉框月份请求后台
public
function
getMonthData
(){
$type
=
I
(
'type'
,
''
);
$month
=
I
(
'month'
,
''
);
//年度精英赛,month字段有值,证明可以参加年度的精英赛
if
(
$type
==
'final'
){
$top10UserIds
=
array
();
//对应月份的前10名
$monthUsers
=
M
(
'PktopUserphb'
)
->
where
(
array
(
'month'
=>
$month
))
->
order
(
'monthup desc'
)
->
select
();
foreach
(
$monthUsers
as
$k
=>
&
$v4
)
{
$top10UserIds
[]
=
$v4
[
'user_id'
];
}
$finalUsers
=
M
(
'PktopUser'
)
->
where
(
array
(
'month'
=>
$month
,
'active_money'
=>
array
(
'gt'
,
0
)))
->
order
(
'monthup desc'
)
->
select
();
foreach
(
$finalUsers
as
$k
=>
&
$v3
)
{
$v3
[
'isTop10'
]
=
in_array
(
$v3
[
'user_id'
],
$top10UserIds
)
?
1
:
0
;
}
$count
=
count
(
$finalUsers
);
$this
->
assign
(
'finalUsers'
,
$finalUsers
);
$content
=
$this
->
fetch
(
'itemPass'
);
}
if
(
$type
==
'month'
||
$type
==
'all'
){
$userId
=
$this
->
user
[
'userID'
];
//月排行榜的旧月份和上个月份的页面显示不一样,改成显示一样
$nowMonth
=
date
(
'Y-m'
);
$monthUsers
=
M
(
'PktopUserphb'
)
->
where
([
'month'
=>
$month
])
->
order
(
'monthup desc'
)
->
select
();
$myPkUserId
=
$this
->
getMyPkUserId
(
$userId
);
$monthIds
=
array
();
foreach
(
$monthUsers
as
$k
=>
&
$v
)
{
$v
[
'pkStatus'
]
=
in_array
(
$v
[
'user_id'
],
$myPkUserId
)
?
1
:
0
;
$monthIds
[]
=
$v
[
'user_id'
];
}
$enemyIds
=
$this
->
getEnemy
(
$monthIds
);
$nickList
=
getUser
(
$monthIds
,
'nick'
);
////
foreach
(
$monthUsers
as
$k
=>
&
$v4
)
{
$v4
[
'enemyNum'
]
=
count
(
$enemyIds
[
$v4
[
'user_id'
]]);
$v4
[
'enemy'
]
=
$enemyIds
[
$v4
[
'user_id'
]];
$nick
=
$nickList
[
$v4
[
'user_id'
]];
////
$v4
[
'user_name'
]
=
$nick
;
//?$nick:$v4['user_name'];////
}
$count
=
count
(
$monthUsers
);
if
(
$month
==
$nowMonth
){
$type
=
'nowMonth'
;
}
$this
->
assign
(
array
(
'type'
=>
$type
,
'userList'
=>
$monthUsers
));
$content
=
$this
->
fetch
(
'item2'
);
}
$this
->
ajaxReturn
(
array
(
'status'
=>
1
,
'count'
=>
$count
,
'type'
=>
$type
,
'data'
=>
$content
));
}
//
public function getMonthData(){
//
$type = I('type', '');
//
$month = I('month', '');
//
//年度精英赛,month字段有值,证明可以参加年度的精英赛
//
if($type=='final'){
//
$top10UserIds=array();
//
//对应月份的前10名
//
$monthUsers=M('PktopUserphb')->where(array('month'=>$month))->order('monthup desc')->select();
//
foreach ($monthUsers as $k => &$v4) {
//
$top10UserIds[]=$v4['user_id'];
//
}
//
//
$finalUsers=M('PktopUser')->where(array('month'=>$month,'active_money'=>array('gt',0)))->order('monthup desc')->select();
//
foreach ($finalUsers as $k => &$v3) {
//
$v3['isTop10']=in_array($v3['user_id'],$top10UserIds)?1:0;
//
}
//
$count=count($finalUsers);
//
$this->assign('finalUsers',$finalUsers);
//
$content = $this->fetch('itemPass');
//
}
//
if($type=='month'||$type=='all'){
//
$userId=$this->user['userID'];
//
//月排行榜的旧月份和上个月份的页面显示不一样,改成显示一样
//
$nowMonth=date('Y-m');
//
$monthUsers=M('PktopUserphb')->where(['month'=>$month])->order('monthup desc')->select();
//
$myPkUserId=$this->getMyPkUserId($userId);
//
$monthIds=array();
//
foreach ($monthUsers as $k => &$v) {
//
$v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
//
$monthIds[]=$v['user_id'];
//
}
//
//
$enemyIds=$this->getEnemy($monthIds);
//
//
$nickList =getUser($monthIds,'nick');////
//
//
foreach ($monthUsers as $k => &$v4) {
//
$v4['enemyNum']=count($enemyIds[$v4['user_id']]);
//
$v4['enemy']=$enemyIds[$v4['user_id']];
//
//
$nick = $nickList[$v4['user_id']];////
//
$v4['user_name'] = $nick;//?$nick:$v4['user_name'];////
//
}
//
//
$count=count($monthUsers);
//
if($month==$nowMonth){
//
$type='nowMonth';
//
}
//
$this->assign(array('type'=>$type,'userList'=>$monthUsers));
//
$content = $this->fetch('item2');
//
}
//
//
$this->ajaxReturn(array(
//
'status' => 1,'count' =>$count,'type' =>$type,'data' => $content
//
));
//
}
//用户列表,包括最新挑战榜,人气挑战榜等页面
public
function
userList
(){
$userId
=
$this
->
user
[
'userID'
];
$type
=
I
(
'type'
,
'new'
);
$lastMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)
.
"-1 month"
));
if
(
$type
==
'new'
){
$userList
=
$this
->
formatTop10
();
}
if
(
$type
==
'hot'
){
//所有月份的
$passiveIds
=
M
(
'PktopData'
)
->
group
(
'passive_id'
)
->
order
(
'count(*) desc'
)
->
getField
(
'passive_id'
,
true
);
$userList
=
M
(
'PktopUserphb'
)
->
where
(
array
(
'user_id'
=>
array
(
'in'
,
$passiveIds
)))
->
order
(
'field(user_id,'
.
implode
(
','
,
$passiveIds
)
.
')'
)
->
select
();
}
if
(
$type
==
'all'
){
$month
=
I
(
'month'
,
$lastMonth
,
intval
);
$userList
=
M
(
'PktopUserphb'
)
->
where
(
array
(
'month'
=>
$month
))
->
order
(
'monthup desc'
)
->
select
();
$selectMonth
=
array
();
foreach
(
$this
->
MONTH
as
$k
=>
$value
)
{
$nowMonth
=
date
(
'Y-m'
,
strtotime
(
date
(
'Y-m-01'
)));
if
(
$k
<
$nowMonth
){
$selectMonth
[
$k
]
=
$value
;
}
}
// $type='lastMonth';
}
$myPkUserId
=
$this
->
getMyPkUserId
(
$userId
);
$userIds
=
array
();
foreach
(
$userList
as
$k
=>
&
$v
)
{
$v
[
'pkStatus'
]
=
in_array
(
$v
[
'user_id'
],
$myPkUserId
)
?
1
:
0
;
$userIds
[]
=
$v
[
'user_id'
];
}
$enemyIds
=
$this
->
getEnemy
(
$userIds
);
foreach
(
$userList
as
$k
=>
&
$v4
)
{
$v4
[
'enemyNum'
]
=
count
(
$enemyIds
[
$v4
[
'user_id'
]]);
$v4
[
'enemy'
]
=
$enemyIds
[
$v4
[
'user_id'
]];
$v4
[
'user_name'
]
=
$v4
[
'user_id'
];
}
// var_dump($userList);exit;
$pkTime
=
date
(
'n月j日'
,
strtotime
(
'next Monday'
))
.
'-'
.
date
(
'n月j日'
,
strtotime
(
'next Monday'
)
+
4
*
3600
*
24
);
$this
->
assign
(
array
(
'type'
=>
$type
,
'userList'
=>
$userList
,
'selectMonth'
=>
$selectMonth
,
'lastMonth'
=>
$lastMonth
,
'pkTime'
=>
$pkTime
));
$this
->
display
();
}
//
public function userList(){
//
$userId=$this->user['userID'];
//
$type = I('type', 'new');
//
//
$lastMonth=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
//
//
if($type=='new'){
//
$userList=$this->formatTop10();
//
}
//
if($type=='hot'){
//
//所有月份的
//
$passiveIds=M('PktopData')->group('passive_id')->order('count(*) desc')->getField('passive_id',true);
//
$userList=M('PktopUserphb')->where(array('user_id'=>array('in',$passiveIds)))->order('field(user_id,'.implode(',',$passiveIds).')')->select();
//
}
//
if($type=='all'){
//
$month = I('month',$lastMonth,intval);
//
$userList=M('PktopUserphb')->where(array('month'=>$month))->order('monthup desc')->select();
//
$selectMonth=array();
//
foreach ($this->MONTH as $k => $value) {
//
$nowMonth=date('Y-m',strtotime(date('Y-m-01')));
//
if($k<$nowMonth){
//
$selectMonth[$k]=$value;
//
}
//
}
//
//
$type='lastMonth';
//
}
//
$myPkUserId=$this->getMyPkUserId($userId);
//
$userIds=array();
//
foreach ($userList as $k => &$v) {
//
$v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
//
$userIds[]=$v['user_id'];
//
}
//
$enemyIds=$this->getEnemy($userIds);
//
foreach ($userList as $k => &$v4) {
//
$v4['enemyNum']=count($enemyIds[$v4['user_id']]);
//
$v4['enemy']=$enemyIds[$v4['user_id']];
//
$v4['user_name']=$v4['user_id'];
//
}
//
//
//
var_dump($userList);exit;
//
$pkTime=date('n月j日',strtotime('next Monday')).'-'.date('n月j日',strtotime('next Monday')+4*3600*24);
//
$this->assign(array('type'=>$type,'userList'=>$userList,'selectMonth'=>$selectMonth,'lastMonth'=>$lastMonth
//
,'pkTime'=>$pkTime));
//
$this->display();
//
}
public
function
login
()
{
$userId
=
I
(
'user_id'
,
''
,
intval
);
...
...
@@ -893,54 +887,55 @@ class PkTopAction extends IdentityAction{
return
$appShareInfo
;
}
//提现页面
public
function
withdraw
()
{
$userID
=
$this
->
user
[
'userID'
];
$userName
=
$this
->
user
[
'userName'
];
if
(
!
$userID
)
{
header
(
"Location:/Passport/login/type/1.html?refer=/Pktop/withdraw"
);
}
//flag1提现,2挑战金记录
$flag
=
I
(
'flag'
,
0
,
intval
);
if
(
$flag
==
2
){
//1pk付款,2发起pk,3pk胜利,4pk失败,5胜利退钱,6失败钱归passive,7买重置卡
$moneyList
=
M
(
'PktopNews'
)
->
where
([
'user_id'
=>
$userID
,
'type'
=>
[
'in'
,
'1,5,6,8'
]])
->
order
(
'add_time desc'
)
->
select
();
$this
->
assign
(
array
(
'flag'
=>
2
,
'moneyList'
=>
$moneyList
));
$this
->
display
();
exit
;
}
if
(
$flag
==
1
){
$user
=
M
(
'PktopUser'
)
->
where
(
array
(
'user_id'
=>
$userID
))
->
find
();
if
(
IS_GET
)
{
$cashout_log
=
M
(
'pktop_cashout_log'
)
->
where
([
'user_id'
=>
$userID
])
->
order
(
'id desc'
)
->
find
();
$money
=
$user
[
'active_money'
]
+
$user
[
'passive_money'
]
-
$user
[
'already_withdraw_money'
];
$this
->
assign
(
array
(
'flag'
=>
1
,
'money'
=>
$money
,
'cashout_log'
=>
$cashout_log
));
$this
->
display
(
'/Pktop/withdraw'
);
exit
;
}
else
{
//插入流水表
$alipayAccount
=
I
(
'alipayAccount'
);
$money
=
I
(
'money'
,
''
,
'float'
);
$data
=
[
'user_id'
=>
$userID
,
'user_name'
=>
$userName
,
'Alipay'
=>
$alipayAccount
,
'apply_cashout'
=>
$money
,
'time_cashout'
=>
time
()];
$id
=
M
(
'PktopCashoutLog'
)
->
add
(
$data
);
if
(
$id
)
{
$this
->
ajaxReturn
(
array
(
'status'
=>
1
,
'info'
=>
''
));
}
else
{
$this
->
ajaxReturn
(
array
(
'status'
=>
3
,
'info'
=>
'数据有误,请联系客服人员'
));
}
}
}
}
//提现页面
// public function withdraw() {
// $userID = $this->user['userID'];
// $userName = $this->user['userName'];
// if (!$userID) {
// header("Location:/Passport/login/type/1.html?refer=/Pktop/withdraw");
// }
//
// //flag1提现,2挑战金记录
// $flag=I('flag',0,intval);
// if($flag==2){
// //1pk付款,2发起pk,3pk胜利,4pk失败,5胜利退钱,6失败钱归passive,7买重置卡
// $moneyList = M('PktopNews')->where(['user_id' => $userID,'type'=>['in','1,5,6,8']])->order('add_time desc')->select();
// $this->assign(array('flag'=>2,'moneyList'=>$moneyList));
// $this->display();
// exit;
// }
//
// if($flag==1){
// $user = M('PktopUser')->where(array('user_id' => $userID))->find();
// if (IS_GET) {
// $cashout_log = M('pktop_cashout_log')->where(['user_id' => $userID])->order('id desc')->find();
// $money=$user['active_money']+$user['passive_money']-$user['already_withdraw_money'];
// $this->assign(array('flag'=>1,'money'=>$money,'cashout_log'=>$cashout_log));
// $this->display('/Pktop/withdraw');
// exit;
// }else{
// //插入流水表
// $alipayAccount = I('alipayAccount');
// $money = I('money', '', 'float');
// $data = ['user_id' => $userID, 'user_name' => $userName, 'Alipay' => $alipayAccount,
// 'apply_cashout' => $money, 'time_cashout' => time()];
//
// $id = M('PktopCashoutLog')->add($data);
// if ($id) {
// $this->ajaxReturn(array(
// 'status' => 1,
// 'info' => ''
// ));
// } else {
// $this->ajaxReturn(array(
// 'status' => 3,
// 'info' => '数据有误,请联系客服人员'
// ));
// }
// }
// }
// }
private
function
formatPassUsers
(
$data
,
$num
=
3
)
{
$result
=
array
();
...
...
@@ -1042,7 +1037,10 @@ class PkTopAction extends IdentityAction{
// header('location:'.M_URL.'/Match/jiang');
// exit;
// }
//邀请人id
if
(
I
(
'aid'
)){
cookie
(
'aid'
,
I
(
'aid'
));
}
$userIdParam
=
I
(
'user_id'
,
''
,
intval
);
// $isapp = I('isapp');
// if ($isapp) {
...
...
app/Lib/Model/UserModel.class.php
View file @
5f11fdb3
...
...
@@ -55,6 +55,48 @@ class UserModel extends Model{
return
!
empty
(
$r
)
?
$r
[
'concern_user_id'
]
:
0
;
}
//参赛送1.88元
public
function
addMoney
(
$userId
,
$userName
,
$mobile
){
$wallet
=
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$userId
])
->
find
();
if
(
empty
(
$wallet
)){
M
(
'Wallet'
)
->
add
([
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'add_time'
=>
time
(),
'money'
=>
1.88
]);
}
else
{
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$userId
])
->
setInc
(
'money'
,
1.88
);
}
$addData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'mobile'
=>
$mobile
,
'item_money'
=>
1.88
,
'item_time'
=>
time
(),
'group_id'
=>
PRIZE_GROUP_2021
,
'status'
=>
1
,
'note'
=>
'【全民分赛场】报名奖励红包'
];
M
(
'WalletItem'
)
->
add
(
$addData
);
}
//加入邀请表
public
function
addInvite
(
$userIdB
,
$userNameB
){
$aid
=
cookie
(
'aid'
);
if
(
$aid
){
$ucA
=
uc_get_user
([
'userId'
=>
$aid
,
'type'
=>
3
]);
$ucDataA
=
$ucA
[
'data'
];
$userNameA
=
$ucDataA
[
'user_name'
];
//检查被邀请人是否被邀请过
$oldB
=
M
(
'WalletInvite'
)
->
where
([
'user_id_b'
=>
$userIdB
,
'status'
=>
1
])
->
count
();
if
(
$oldB
){
//-1不显示在界面上
M
(
'WalletInvite'
)
->
add
([
'user_id_a'
=>
$aid
,
'user_name_a'
=>
$userNameA
,
'user_id_b'
=>
$userIdB
,
'user_name_b'
=>
$userNameB
,
'status'
=>-
1
,
'add_time'
=>
time
(),
'group_id'
=>
PRIZE_GROUP_2021
]);
}
else
{
//status0报名未审核,1审核通过已报名状态
M
(
'WalletInvite'
)
->
add
([
'user_id_a'
=>
$aid
,
'user_name_a'
=>
$userNameA
,
'user_id_b'
=>
$userIdB
,
'user_name_b'
=>
$userNameB
,
'status'
=>
1
,
'money'
=>
1.88
,
'add_time'
=>
time
(),
'group_id'
=>
PRIZE_GROUP_2021
]);
//邀请人加1.88元
M
(
'Wallet'
)
->
where
([
'user_id'
=>
$aid
])
->
setInc
(
'money'
,
1.88
);
$addData
=
[
'user_id'
=>
$aid
,
'user_name'
=>
$userNameA
,
'mobile'
=>
$ucDataA
[
'mobile'
],
'item_money'
=>
1.88
,
'item_time'
=>
time
(),
'group_id'
=>
PRIZE_GROUP_2021
,
'status'
=>
1
,
'note'
=>
'邀请好友'
];
M
(
'WalletItem'
)
->
add
(
$addData
);
}
}
}
}
?>
\ No newline at end of file
app/Tpl/Vip/Index/jiang.html
View file @
5f11fdb3
...
...
@@ -112,7 +112,7 @@
<a
name=
"4"
></a>
<div
class=
"new-quanmin marginB20"
>
<p
class=
"bot-title"
>
实盘赛场
</p>
<div
class=
"item-cont item2"
url=
"{:M_URL}/True"
style=
"cursor: pointer"
>
<div
class=
"item-cont item2"
url=
"{:M_URL}/True
?aid={$Think.cookie.aid}
"
style=
"cursor: pointer"
>
<div
class=
"item-cont-logo"
>
<img
src=
"__PUBLIC__/Home/images/g2023/shipan.png"
alt=
""
>
</div>
...
...
@@ -134,7 +134,7 @@
<a
name=
"1"
></a>
<div
class=
"new-quanshang marginB20"
>
<p
class=
"bot-title"
>
券商专场
</p>
<div
class=
"item-cont"
url=
"{:WWW_URL}/Zjds"
style=
"cursor: pointer"
>
<div
class=
"item-cont"
url=
"{:WWW_URL}/Zjds
?aid={$Think.cookie.aid}
"
style=
"cursor: pointer"
>
<img
class=
"gjj"
src=
"__PUBLIC__/Home/images/g2023/gjj-img.png"
alt=
""
>
<div
class=
"item-cont-logo"
>
<img
src=
"__PUBLIC__/Home/images/g2023/quanshang.png"
alt=
""
>
...
...
@@ -150,7 +150,7 @@
<eq
name=
"dsStatus.zjStatus"
value=
"1"
>
<div
class=
"enter-btn goTradeBtn "
gid=
"{:ZHONGJIN_GROUP}"
>
交易
</div>
<else/>
<div
class=
"enter-btn baoming"
url=
"{:WWW_URL}/Zjds?clickFlag=1"
>
报名参赛
</div>
<div
class=
"enter-btn baoming"
url=
"{:WWW_URL}/Zjds?clickFlag=1
&aid={$Think.cookie.aid}
"
>
报名参赛
</div>
</eq>
</div>
</div>
...
...
app/Tpl/Vip/Index/userList.html
→
app/Tpl/Vip/Index/userList
_____
.html
View file @
5f11fdb3
File moved
app/Tpl/Vip/PkTop/indexOld.html
→
app/Tpl/Vip/PkTop/indexOld
____
.html
View file @
5f11fdb3
File moved
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