Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
haishi
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
haishi
Commits
cae3f32f
Commit
cae3f32f
authored
Apr 27, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
18969c88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
80 deletions
+91
-80
api/Common/functions.php
+2
-2
application/Appapi/Controller/LevelController.class.php
+89
-78
No files found.
api/Common/functions.php
View file @
cae3f32f
...
...
@@ -522,7 +522,7 @@
$level
=
getLevelList
();
foreach
(
$level
as
$k
=>
$v
){
if
(
$v
[
'level_up'
]
>
=
$experience
){
if
(
$v
[
'level_up'
]
>
$experience
){
$levelid
=
$v
[
'levelid'
];
break
;
}
else
{
...
...
@@ -556,7 +556,7 @@
$level
=
getLevelAnchorList
();
foreach
(
$level
as
$k
=>
$v
){
if
(
$v
[
'level_up'
]
>
=
$experience
){
if
(
$v
[
'level_up'
]
>
$experience
){
$levelid
=
$v
[
'levelid'
];
break
;
}
else
{
...
...
application/Appapi/Controller/LevelController.class.php
View file @
cae3f32f
...
...
@@ -6,90 +6,101 @@ namespace Appapi\Controller;
use
Common\Controller\HomebaseController
;
class
LevelController
extends
HomebaseController
{
function
index
(){
$uid
=
I
(
"uid"
);
$token
=
I
(
"token"
);
function
index
(){
$uid
=
I
(
"uid"
);
$token
=
I
(
"token"
);
if
(
checkToken
(
$uid
,
$token
)
==
700
){
$this
->
assign
(
"reason"
,
'您的登陆状态失效,请重新登陆!'
);
$this
->
display
(
':error'
);
exit
;
}
if
(
checkToken
(
$uid
,
$token
)
==
700
){
$this
->
assign
(
"reason"
,
'您的登陆状态失效,请重新登陆!'
);
$this
->
display
(
':error'
);
exit
;
}
$User
=
M
(
"users"
);
$User
=
M
(
"users"
);
$userinfo
=
$User
->
field
(
"avatar,consumption,votestotal"
)
->
where
(
"id=
{
$uid
}
"
)
->
find
();
$userinfo
=
$User
->
field
(
"avatar,consumption,votestotal"
)
->
where
(
"id=
{
$uid
}
"
)
->
find
();
$userinfo
[
'avatar'
]
=
get_upload_path
(
$userinfo
[
'avatar'
]);
$this
->
assign
(
"userinfo"
,
$userinfo
);
/* 用户等级 */
$Level
=
M
(
"experlevel"
);
$levelinfo
=
$Level
->
where
(
"level_up>='
{
$userinfo
[
'consumption'
]
}
'"
)
->
order
(
"levelid asc"
)
->
find
();
if
(
!
$levelinfo
){
$levelinfo
=
$Level
->
order
(
"levelid desc"
)
->
find
();
}
$cha
=
$levelinfo
[
'level_up'
]
+
1
-
$userinfo
[
'consumption'
];
if
(
$cha
>
0
)
{
$baifen
=
floor
(
$userinfo
[
'consumption'
]
/
$levelinfo
[
'level_up'
]
*
100
);
$type
=
"1"
;
}
else
{
$baifen
=
100
;
$type
=
"0"
;
}
$this
->
assign
(
"userinfo"
,
$userinfo
);
/* 用户等级 */
$Level
=
M
(
"experlevel"
);
$levelinfo
=
$Level
->
where
(
"level_up>'
{
$userinfo
[
'consumption'
]
}
'"
)
->
order
(
"levelid asc"
)
->
find
();
if
(
!
$levelinfo
){
$levelinfo
=
$Level
->
order
(
"levelid desc"
)
->
find
();
}
$cha
=
$levelinfo
[
'level_up'
]
-
$userinfo
[
'consumption'
];
if
(
$cha
>
0
)
{
$levelinfo
[
'levelid'
]
=
$levelinfo
[
'levelid'
]
>
1
?
(
$levelinfo
[
'levelid'
]
-
1
)
:
$levelinfo
[
'levelid'
];
$baifen
=
floor
(
$userinfo
[
'consumption'
]
/
$levelinfo
[
'level_up'
]
*
100
);
$type
=
"1"
;
}
else
{
$baifen
=
100
;
$type
=
"0"
;
}
$set
=
M
(
"experlevel_set"
)
->
where
(
'id=1'
)
->
find
();
$this
->
assign
(
"baifen"
,
$baifen
);
$this
->
assign
(
"levelinfo"
,
$levelinfo
);
$this
->
assign
(
"cha"
,
$cha
);
$this
->
assign
(
"type"
,
$type
);
$this
->
assign
(
'set'
,
$set
);
/* 主播等价 */
$Level_a
=
M
(
"experlevel_anchor"
);
$levelinfo_a
=
$Level_a
->
where
(
"level_up>='
{
$userinfo
[
'votestotal'
]
}
'"
)
->
order
(
"levelid asc"
)
->
find
();
if
(
!
$levelinfo_a
){
$levelinfo_a
=
$Level_a
->
order
(
"levelid desc"
)
->
find
();
}
$cha_a
=
$levelinfo_a
[
'level_up'
]
+
1
-
$userinfo
[
'votestotal'
];
if
(
$cha_a
>
0
)
{
$baifen_a
=
floor
(
$userinfo
[
'votestotal'
]
/
$levelinfo_a
[
'level_up'
]
*
100
);
$type_a
=
"1"
;
}
else
{
$baifen_a
=
100
;
$type_a
=
"0"
;
}
$this
->
assign
(
"cha_a"
,
$cha_a
);
$this
->
assign
(
"type_a"
,
$type_a
);
$this
->
assign
(
"baifen_a"
,
$baifen_a
);
$this
->
assign
(
"levelinfo_a"
,
$levelinfo_a
);
$this
->
display
();
}
function
level
(){
$list
=
M
(
"experlevel"
)
->
order
(
"levelid asc"
)
->
select
();
foreach
(
$list
as
$k
=>
$v
){
$list
[
$k
][
'level_up'
]
=
number_format
(
$v
[
'level_up'
]);
$list
[
$k
][
'thumb'
]
=
get_upload_path
(
$v
[
'thumb'
]);
}
$this
->
assign
(
"list"
,
$list
);
$this
->
display
();
}
function
level_a
(){
$list
=
M
(
"experlevel_anchor"
)
->
order
(
"levelid asc"
)
->
select
();
foreach
(
$list
as
$k
=>
$v
){
$list
[
$k
][
'level_up'
]
=
number_format
(
$v
[
'level_up'
]);
$list
[
$k
][
'thumb'
]
=
get_upload_path
(
$v
[
'thumb'
]);
}
$this
->
assign
(
"list"
,
$list
);
$this
->
display
();
}
$this
->
assign
(
"baifen"
,
$baifen
);
$this
->
assign
(
"levelinfo"
,
$levelinfo
);
$this
->
assign
(
"cha"
,
$cha
);
$this
->
assign
(
"type"
,
$type
);
$this
->
assign
(
'set'
,
$set
);
$anchor_certification
=
0
;
$auth
=
M
(
"users_auth"
)
->
where
(
"uid=
{
$uid
}
"
)
->
find
();
if
(
!
empty
(
$auth
))
{
if
(
$auth
[
'status'
]
==
1
)
{
$anchor_certification
=
1
;
}
}
$this
->
assign
(
'anchor_certification'
,
$anchor_certification
);
/* 主播等价 */
$Level_a
=
M
(
"experlevel_anchor"
);
$levelinfo_a
=
$Level_a
->
where
(
"level_up>='
{
$userinfo
[
'votestotal'
]
}
'"
)
->
order
(
"levelid asc"
)
->
find
();
if
(
!
$levelinfo_a
){
$Level_a
[
'levelid'
]
=
$Level_a
[
'levelid'
]
>
1
?
(
$Level_a
[
'levelid'
]
-
1
)
:
$Level_a
[
'levelid'
];
$levelinfo_a
=
$Level_a
->
order
(
"levelid desc"
)
->
find
();
}
$cha_a
=
$levelinfo_a
[
'level_up'
]
-
$userinfo
[
'votestotal'
];
if
(
$cha_a
>
0
)
{
$baifen_a
=
floor
(
$userinfo
[
'votestotal'
]
/
$levelinfo_a
[
'level_up'
]
*
100
);
$type_a
=
"1"
;
}
else
{
$baifen_a
=
100
;
$type_a
=
"0"
;
}
$this
->
assign
(
"cha_a"
,
$cha_a
);
$this
->
assign
(
"type_a"
,
$type_a
);
$this
->
assign
(
"baifen_a"
,
$baifen_a
);
$this
->
assign
(
"levelinfo_a"
,
$levelinfo_a
);
$this
->
display
();
}
function
level
(){
$list
=
M
(
"experlevel"
)
->
order
(
"levelid asc"
)
->
select
();
foreach
(
$list
as
$k
=>
$v
){
$list
[
$k
][
'level_up'
]
=
number_format
(
$v
[
'level_up'
]);
$list
[
$k
][
'thumb'
]
=
get_upload_path
(
$v
[
'thumb'
]);
}
$this
->
assign
(
"list"
,
$list
);
$this
->
display
();
}
function
level_a
(){
$list
=
M
(
"experlevel_anchor"
)
->
order
(
"levelid asc"
)
->
select
();
foreach
(
$list
as
$k
=>
$v
){
$list
[
$k
][
'level_up'
]
=
number_format
(
$v
[
'level_up'
]);
$list
[
$k
][
'thumb'
]
=
get_upload_path
(
$v
[
'thumb'
]);
}
$this
->
assign
(
"list"
,
$list
);
$this
->
display
();
}
}
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