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
0e877c54
Commit
0e877c54
authored
Jul 26, 2024
by
houyadong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成员交易逻辑修改-bug
parent
c9bee5eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
74 deletions
+103
-74
PkTopAction.class.php
app/Lib/Action/Vip/PkTopAction.class.php
+8
-2
UserModel.class.php
app/Lib/Model/UserModel.class.php
+95
-72
No files found.
app/Lib/Action/Vip/PkTopAction.class.php
View file @
0e877c54
...
@@ -699,8 +699,14 @@ class PkTopAction extends IdentityAction
...
@@ -699,8 +699,14 @@ class PkTopAction extends IdentityAction
$pageSize
=
10
;
$pageSize
=
10
;
$order
=
I
(
'order'
,
0
);
$order
=
I
(
'order'
,
0
);
$gInfo
=
D
(
'Group'
)
->
getGroup
(
$this
->
GID
);
$gInfo
=
D
(
'Group'
)
->
getGroup
(
$this
->
GID
);
$top
=
$order
==
1
?
50
:
0
;
if
(
$order
==
1
){
$phb
=
D
(
'User'
)
->
getGroupEntrustList
(
$gInfo
,
$top
,
$p
,
$pageSize
);
$top
=
50
;
$isTop3
=
0
;
}
else
{
$top
=
500
;
$isTop3
=
1
;
}
$phb
=
D
(
'User'
)
->
getGroupEntrustList
(
$gInfo
,
$top
,
1
,
$isTop3
,
$p
,
$pageSize
);
$this
->
assign
([
$this
->
assign
([
'p'
=>
$p
,
'p'
=>
$p
,
'pageSize'
=>
$pageSize
,
'pageSize'
=>
$pageSize
,
...
...
app/Lib/Model/UserModel.class.php
View file @
0e877c54
...
@@ -174,14 +174,16 @@ class UserModel extends Model
...
@@ -174,14 +174,16 @@ class UserModel extends Model
}
}
/**
/**
* 获取训练区或大赛区的成员交易,找出该大赛前3名的委托记录置顶
* 训练区和大赛区的成员交易,找出该大赛前3名的委托记录
* @param $gId string 大赛id
* * @param $gId string 大赛id
* @param $top int 显示前几名,0全部
* * @param $top int 只取排行榜前几名:0全部
* @param $p int 页码
* * @param $top_type int 排行榜类型:0总收益 1周收益
* @param $pageSize int 每页显示条数
* * @param $isTop3 int 是否置顶排行榜前三名当日最新交易
* @return array
* * @param $p int 页码
* * @param $pageSize int 每页显示条数
* * @return array
*/
*/
public
function
getGroupEntrustList
(
$gInfo
,
$top
=
0
,
$p
=
1
,
$pageSize
=
5
)
public
function
getGroupEntrustList
(
$gInfo
,
$top
=
0
,
$
top_type
=
0
,
$isTop3
=
0
,
$
p
=
1
,
$pageSize
=
5
)
{
{
$gId
=
$gInfo
[
'group_id'
];
$gId
=
$gInfo
[
'group_id'
];
$is_xlq
=
$gInfo
[
'category'
]
==
1
?
1
:
0
;
$is_xlq
=
$gInfo
[
'category'
]
==
1
?
1
:
0
;
...
@@ -192,14 +194,13 @@ class UserModel extends Model
...
@@ -192,14 +194,13 @@ class UserModel extends Model
return
M
()
->
db
(
2
,
getModel
(
$gInfo
[
'web_id'
]));
return
M
()
->
db
(
2
,
getModel
(
$gInfo
[
'web_id'
]));
}
}
};
};
$model
=
$getModel
(
$is_xlq
,
$gInfo
);
if
(
$is_xlq
==
1
){
if
(
$is_xlq
==
1
){
$uinfo_table_name
=
'syn_userinfo'
;
$uinfo_table_name
=
'syn_userinfo'
;
$table_name
=
'syn_entrust'
;
$table_name
=
'syn_entrust'
;
$his_table_name
=
'syn_hisentrust'
;
$his_table_name
=
'syn_hisentrust'
;
$uinfo_where
=
[
$uinfo_where
=
[
'category'
=>
1
'category'
=>
1
,
'zt'
=>
1
,
];
];
$entrust_where
=
[
$entrust_where
=
[
'bz'
=>
[
'in'
,
D
(
'Group'
)
->
ids
],
'bz'
=>
[
'in'
,
D
(
'Group'
)
->
ids
],
...
@@ -219,34 +220,35 @@ class UserModel extends Model
...
@@ -219,34 +220,35 @@ class UserModel extends Model
'status'
=>
[
'in'
,[
'已报'
,
'已成'
]],
'status'
=>
[
'in'
,[
'已报'
,
'已成'
]],
];
];
}
}
if
(
$top
==
0
){
# 取前3名置顶
#置顶逻辑
if
(
$top_type
==
0
){
$uinfo_where
[
'new_phb'
]
=
[
'between'
,[
1
,
3
]];
$uinfo_where
[
'new_phb'
]
=
[
'between'
,[
1
,
3
]];
$u_order
=
'new_phb asc'
;
}
else
{
}
else
{
# 取前$top名,近300条
$uinfo_where
[
'new_phb'
]
=
[
'gt'
,
0
];
$uinfo_where
[
'new_phb'
]
=
[
'between'
,[
1
,
$top
]];
$u_order
=
'lastweekup desc,new_phb asc'
;
}
$top3_uids
=
$getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$uinfo_table_name
)
->
where
(
$uinfo_where
)
->
order
(
$u_order
)
->
limit
(
3
)
->
getField
(
'uid,new_phb'
,
true
);
$i
=
1
;
foreach
(
$top3_uids
as
$k
=>
$v
){
$top3_uids
[
$k
]
=
$i
;
$i
++
;
}
}
$top_uid
=
$model
->
table
(
$uinfo_table_name
)
->
where
(
$uinfo_where
)
->
order
(
'new_phb asc'
)
->
getField
(
'uid,new_phb,lastweekup'
,
true
);
unset
(
$uinfo_where
);
#截取前三名的id
$top3_uids
=
array_slice
(
$top_uid
,
0
,
3
);
$list
=
[];
#第一页显示该大赛总收益排名前三的用户在当天最新的一条交易记录
#第一页显示该大赛总收益排名前三的用户在当天最新的一条交易记录
if
(
$top
==
0
&&
!
empty
(
$top3_uids
)
){
if
(
!
empty
(
$top3_uids
)
&&
$isTop3
==
1
){
#获取置顶数据
#获取置顶数据
$top3_data
=
$
model
->
table
(
$table_name
)
$top3_data
=
$
getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$table_name
)
->
field
(
'*,(case when cj_time then cj_time else CONCAT_WS(" " ,date, time) end) sort_time'
)
->
field
(
'*,(case when cj_time then cj_time else CONCAT_WS(" " ,date, time) end) sort_time'
)
->
where
(
$entrust_where
)
->
where
(
$entrust_where
)
->
where
([
'userid'
=>
[
'in'
,
array_keys
(
$top3_uids
)]])
->
where
([
'userid'
=>
[
'in'
,
array_keys
(
$top3_uids
)]])
->
group
(
'userid'
)
->
order
(
'FIELD(userid,"'
.
implode
(
'","'
,
array_keys
(
$top3_uids
))
.
'") asc,cj_time desc'
)
->
order
(
'FIELD(userid,"'
.
implode
(
'","'
,
array_keys
(
$top3_uids
))
.
'") asc,cj_time desc'
)
->
select
();
->
select
();
if
(
empty
(
$top3_data
)){
if
(
empty
(
$top3_data
)){
$top3_data
=
$
model
->
table
(
$his_table_name
)
$top3_data
=
$
getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$his_table_name
)
->
field
(
'*,cj_time sort_time'
)
->
field
(
'*,cj_time sort_time'
)
->
where
(
$entrust_where
)
->
where
(
$entrust_where
)
->
where
([
'userid'
=>
[
'in'
,
array_keys
(
$top3_uids
)],
'cj_time'
=>
[
'gt'
,
date
(
'Y-m-d H:i:s'
,
strtotime
(
'today'
))]])
->
where
([
'userid'
=>
[
'in'
,
array_keys
(
$top3_uids
)],
'cj_time'
=>
[
'gt'
,
date
(
'Y-m-d H:i:s'
,
strtotime
(
'today'
))]])
->
group
(
'userid'
)
->
order
(
'FIELD(userid,"'
.
implode
(
'","'
,
array_keys
(
$top3_uids
))
.
'") asc,cj_time desc'
)
->
order
(
'FIELD(userid,"'
.
implode
(
'","'
,
array_keys
(
$top3_uids
))
.
'") asc,cj_time desc'
)
->
select
();
->
select
();
}
}
...
@@ -258,24 +260,41 @@ class UserModel extends Model
...
@@ -258,24 +260,41 @@ class UserModel extends Model
$tmp
[
$v
[
'userid'
]]
=
1
;
$tmp
[
$v
[
'userid'
]]
=
1
;
}
}
}
}
$top3_ids
=
array_column
(
$top3_data
,
'id'
);
$top3_htxh
=
array_column
(
$top3_data
,
'htxh'
);
#前三名当天最新的交易数据id
if
(
!
empty
(
$top3_ids
)){
if
(
!
empty
(
$top3_htxh
)){
$entrust_where
[
'id'
]
=
[
'not in'
,
$top3_ids
];
$entrust_where
[
'htxh'
]
=
[
'not in'
,
$top3_htxh
];
}
}
#限制名次
unset
(
$uinfo_where
[
'new_phb'
]);
if
(
$top_type
==
0
){
$uinfo_where
[
'new_phb'
]
=
[
'between'
,[
1
,
$top
]];
$u_order
=
'new_phb asc'
;
}
else
{
$uinfo_where
[
'new_phb'
]
=
[
'gt'
,
0
];
$u_order
=
'lastweekup desc,new_phb asc'
;
}
}
if
(
$p
==
1
){
if
(
$top
==
0
){
$list
=
(
array
)
$top3_data
;
$top_uid
=
$getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$uinfo_table_name
)
->
where
(
$uinfo_where
)
->
order
(
$u_order
)
->
getField
(
'uid,new_phb,zongup,lastweekup'
,
true
);
}
else
{
$limit
=
$top
;
$top_uid
=
$getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$uinfo_table_name
)
->
where
(
$uinfo_where
)
->
order
(
$u_order
)
->
limit
(
$limit
)
->
getField
(
'uid,new_phb,zongup,lastweekup'
,
true
);
}
}
$i
=
1
;
foreach
(
$top_uid
as
$k
=>
$v
){
$top_uid
[
$k
][
'new_phb'
]
=
$i
;
$i
++
;
}
}
if
(
$top
>
0
&&
!
empty
(
$top_uid
)){
if
(
$top
>
0
&&
!
empty
(
$top_uid
)){
$entrust_where
[
'userid'
]
=
[
'in'
,
array_keys
(
$top_uid
)];
$entrust_where
[
'userid'
]
=
[
'in'
,
array_keys
(
$top_uid
)];
}
}
#取委托总条数和页数
#取委托总条数和页数
$
model
=
$getModel
(
$is_xlq
,
$gInfo
);
$
today_count
=
$getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$table_name
)
->
where
(
$entrust_where
)
->
cache
(
true
,
3600
)
->
count
(
);
$
today_count
=
$model
->
table
(
$table_name
)
->
where
(
$entrust_where
)
->
cache
(
true
,
3600
)
->
count
(
);
$
his_count
=
$getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$his_table_name
)
->
where
(
$entrust_where
)
->
limit
(
20
*
$pageSize
)
->
getField
(
'htxh'
,
true
);
$
his_count
=
$today_count
+
$model
->
table
(
$his_table_name
)
->
where
(
$entrust_where
)
->
cache
(
true
,
3600
)
->
count
(
);
$
count
=
$today_count
+
count
(
$his_count
);
$today_max_page
=
ceil
(
$today_count
/
$pageSize
);
$today_max_page
=
ceil
(
$today_count
/
$pageSize
);
if
(
$p
<=
$today_max_page
){
if
(
$p
<=
$today_max_page
){
$today_list
=
$
model
->
table
(
$table_name
)
$today_list
=
$
getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$table_name
)
->
field
(
'*,(case when cj_time then cj_time else CONCAT_WS(" " ,date, time) end) sort_time'
)
->
field
(
'*,(case when cj_time then cj_time else CONCAT_WS(" " ,date, time) end) sort_time'
)
->
where
(
$entrust_where
)
->
where
(
$entrust_where
)
->
order
(
'sort_time desc'
)
->
order
(
'sort_time desc'
)
...
@@ -292,19 +311,20 @@ class UserModel extends Model
...
@@ -292,19 +311,20 @@ class UserModel extends Model
if
(
$p
>=
$today_max_page
){
if
(
$p
>=
$today_max_page
){
$p
=
$p
>
(
$today_max_page
+
$his_max_page
)
?
(
$today_max_page
+
$his_max_page
)
:
$p
;
$p
=
$p
>
(
$today_max_page
+
$his_max_page
)
?
(
$today_max_page
+
$his_max_page
)
:
$p
;
if
(
$his_count
>
0
){
if
(
$his_count
>
0
){
$his_list
=
$
model
->
table
(
$his_table_name
)
$his_list
=
$
getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$his_table_name
)
->
where
(
$entrust_where
)
->
where
(
$entrust_where
)
->
order
(
'cj_time desc'
)
->
order
(
'cj_time desc'
)
->
page
((
$p
-
$today_max_page
<
0
?
1
:
$p
-
$today_max_page
),
$pageSize
)
->
page
((
$p
-
$today_max_page
<
0
?
1
:
$p
-
$today_max_page
),
$pageSize
)
->
select
();
->
select
();
}
}
}
}
$list
=
array_merge
((
array
)
$
list
,(
array
)
$today_list
,(
array
)
$his_list
);
$list
=
array_merge
((
array
)
$
top3_data
,(
array
)
$today_list
,(
array
)
$his_list
);
#补全数据
#补全数据
if
(
$list
){
if
(
$list
){
$uids
=
array_column
(
$list
,
'userid'
);
$uids
=
array_column
(
$list
,
'userid'
);
if
(
!
empty
(
$uids
)){
if
(
!
empty
(
$uids
)){
$top_uid
=
$model
->
table
(
$uinfo_table_name
)
->
where
([
'uid'
=>
[
'in'
,
$uids
]])
->
getField
(
'uid,new_phb,lastweekup'
,
true
);
if
(
$top
==
0
){
$top_uid
=
$getModel
(
$is_xlq
,
$gInfo
)
->
table
(
$uinfo_table_name
)
->
where
([
'uid'
=>
[
'in'
,
$uids
]])
->
getField
(
'uid,new_phb,zongup,lastweekup'
,
true
);
}
}
$stockHq
=
array
();
$stockHq
=
array
();
$stockCodes
=
array_column
(
$list
,
'stock_code'
);
$stockCodes
=
array_column
(
$list
,
'stock_code'
);
...
@@ -322,6 +342,8 @@ class UserModel extends Model
...
@@ -322,6 +342,8 @@ class UserModel extends Model
'show_time'
=>
$v
[
'cj_time'
]
?
substr
(
$v
[
'cj_time'
],
11
,
8
)
:
$v
[
'time'
],
'show_time'
=>
$v
[
'cj_time'
]
?
substr
(
$v
[
'cj_time'
],
11
,
8
)
:
$v
[
'time'
],
'amount'
=>
$v
[
'amount'
],
'amount'
=>
$v
[
'amount'
],
'userid'
=>
$v
[
'userid'
],
'userid'
=>
$v
[
'userid'
],
'is_wt'
=>
!
$v
[
'cj_time'
]
?
1
:
0
,
'wt_price'
=>
!
$v
[
'cj_time'
]
?
$v
[
'price'
]
:
''
];
];
#获利比
#获利比
$stockCodeType
=
strtolower
(
$v
[
'stock_type'
]
.
$v
[
'stock_code'
]);
$stockCodeType
=
strtolower
(
$v
[
'stock_type'
]
.
$v
[
'stock_code'
]);
...
@@ -343,7 +365,8 @@ class UserModel extends Model
...
@@ -343,7 +365,8 @@ class UserModel extends Model
$list
[
$k
]
=
$return
;
$list
[
$k
]
=
$return
;
}
}
}
}
return
[
$list
,(
$today_count
+
$his_count
)];
}
return
[
$list
,
$count
];
}
}
//完成勋章,只有参赛勋章
//完成勋章,只有参赛勋章
...
...
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