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
788880ea
Commit
788880ea
authored
May 11, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
f83c274f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
40 deletions
+47
-40
application/Admin/Controller/ProxyController.class.php
+47
-40
No files found.
application/Admin/Controller/ProxyController.class.php
View file @
788880ea
...
...
@@ -4,7 +4,7 @@ namespace Admin\Controller;
use
Common\Controller\AdminbaseController
;
class
ProxyController
extends
AdminbaseController
{
protected
$users_model
,
$role_model
;
function
_initialize
()
{
parent
::
_initialize
();
$this
->
users_model
=
D
(
"Common/Users"
);
...
...
@@ -22,27 +22,27 @@ class ProxyController extends AdminbaseController{
// $where['r.role_id'] = '8';
// $where['_logic'] = 'or';
$where
[
'u.tg_type'
]
=
array
(
'in'
,
array
(
'2'
,
'3'
));
}
elseif
(
$user
[
'tg_type'
]
==
2
){
//一级代理
$path
=
setpath
(
$user
[
'id'
]);
$uids
=
$Proxy
->
where
(
"type=2 and path like '%
{
$path
}
%'"
)
->
getField
(
'uid'
,
true
);
if
(
$uids
){
$where
[
"u.id"
]
=
array
(
'in'
,
$uids
);
}
else
{
$where
[
"u.id"
]
=
array
(
'in'
,
array
(
'0'
));
}
$where
[
'u.tg_type'
]
=
'3'
;
$where
[
'r.role_id'
]
=
'8'
;
}
if
(
$_REQUEST
[
'keyword'
]
!=
''
){
$where
[
'u.user_login|u.user_nicename'
]
=
array
(
"like"
,
"%
{
$_REQUEST
[
'keyword'
]
}
%"
);
$_GET
[
'keyword'
]
=
$_REQUEST
[
'keyword'
];
}
$count
=
M
(
'users u'
)
->
join
(
'__ROLE_USER__ r ON r.user_id = u.id'
)
->
where
(
$where
)
->
count
();
$page
=
$this
->
page
(
$count
,
20
);
$users
=
M
(
'users u'
)
...
...
@@ -53,7 +53,7 @@ class ProxyController extends AdminbaseController{
->
limit
(
$page
->
firstRow
.
','
.
$page
->
listRows
)
->
select
();
$Charge
=
M
(
'users_charge'
);
$Votes
=
M
(
'users_voterecord'
);
$User
=
M
(
'users'
);
...
...
@@ -72,16 +72,24 @@ class ProxyController extends AdminbaseController{
$total_charge
=
'0'
;
}
$v
[
'total_charge'
]
=
$total_charge
;
//总消费
$map2
=
[];
$map2
[
'id'
]
=
array
(
'in'
,
$uids
);
$total_coin
=
$User
->
where
(
"user_type=2"
)
->
where
(
$map2
)
->
sum
(
'consumption'
);
if
(
!
$total_coin
){
$total_coin
=
'0'
;
}
$v
[
'total_coin'
]
=
$total_coin
;
// $map2=[];
// $map2['id'] = array('in',$uids);
// $total_coin=$User->where("user_type=2")->where($map2)->sum('consumption');
// if(!$total_coin){
// $total_coin='0';
// }
// $v['total_coin']=$total_coin;
$results
=
M
(
'users_coinrecord'
)
// ->select("sum('totalcoin') as sum")
->
where
(
"uid =
{
$v
[
'id'
]
}
and type='expend' and action in ('sendgift','sendbarrage')"
)
->
sum
(
'totalcoin'
);
$v
[
'total_coin'
]
=
(
int
)
$results
;
//主播收益
$map3
=
[];
$map3
[
'uid'
]
=
array
(
'in'
,
$uids
);
...
...
@@ -90,18 +98,18 @@ class ProxyController extends AdminbaseController{
$total_votes
=
'0'
;
}
$v
[
'total_votes'
]
=
$total_votes
;
$users
[
$k
]
=
$v
;
}
$this
->
assign
(
'formget'
,
$_GET
);
$this
->
assign
(
"page"
,
$page
->
show
(
'Admin'
));
$this
->
assign
(
"users"
,
$users
);
$this
->
display
();
}
function
add
(){
$user
=
$this
->
users_model
->
where
(
"id=
{
$_SESSION
[
'ADMIN_ID'
]
}
"
)
->
find
();
if
(
$user
){
...
...
@@ -119,11 +127,11 @@ class ProxyController extends AdminbaseController{
$this
->
assign
(
"role_id"
,
$role_id
);
$this
->
assign
(
"solt"
,
$solt
);
$code
=
createCode
();
$this
->
assign
(
"code"
,
$code
);
$this
->
display
();
}
function
add_post
(){
if
(
IS_POST
){
if
(
!
empty
(
$_POST
[
'role_id'
])
&&
is_array
(
$_POST
[
'role_id'
])){
...
...
@@ -161,7 +169,7 @@ class ProxyController extends AdminbaseController{
}
M
(
'users_proxy'
)
->
add
(
array
(
"uid"
=>
$result
,
"type"
=>
$type
,
"path"
=>
$path
,
'addtime'
=>
time
()));
}
$action
=
"添加
{
$solt
}
代理商:
{
$result
}
"
;
setAdminLog
(
$action
);
$this
->
success
(
"添加成功!"
);
...
...
@@ -174,11 +182,11 @@ class ProxyController extends AdminbaseController{
}
else
{
$this
->
error
(
"请为此用户指定角色!"
);
}
}
}
function
edit
(){
$id
=
intval
(
I
(
"get.id"
));
$user
=
$this
->
users_model
->
where
(
array
(
"id"
=>
$id
))
->
find
();
...
...
@@ -191,7 +199,7 @@ class ProxyController extends AdminbaseController{
$this
->
assign
(
$user
);
$this
->
display
();
}
function
edit_post
(){
if
(
IS_POST
)
{
if
(
!
empty
(
$_POST
[
'role_id'
])
&&
is_array
(
$_POST
[
'role_id'
])){
...
...
@@ -209,7 +217,7 @@ class ProxyController extends AdminbaseController{
foreach
(
$role_ids
as
$role_id
){
$role_user_model
->
add
(
array
(
"role_id"
=>
$role_id
,
"user_id"
=>
$uid
));
}
$action
=
"编辑代理商:
{
$uid
}
"
;
setAdminLog
(
$action
);
$this
->
success
(
"保存成功!"
);
...
...
@@ -222,10 +230,10 @@ class ProxyController extends AdminbaseController{
}
else
{
$this
->
error
(
"请为此用户指定角色!"
);
}
}
}
/**
* 删除
*/
...
...
@@ -234,7 +242,7 @@ class ProxyController extends AdminbaseController{
if
(
$id
==
1
){
$this
->
error
(
"最高代理商不能删除!"
);
}
if
(
$this
->
users_model
->
where
(
"id=
$id
"
)
->
delete
()
!==
false
)
{
M
(
"RoleUser"
)
->
where
(
array
(
"user_id"
=>
$id
))
->
delete
();
$action
=
"删除代理商:
{
$id
}
"
;
...
...
@@ -245,7 +253,7 @@ class ProxyController extends AdminbaseController{
}
}
function
ban
(){
$id
=
intval
(
$_GET
[
'id'
]);
if
(
$id
)
{
...
...
@@ -261,7 +269,7 @@ class ProxyController extends AdminbaseController{
$this
->
error
(
'数据传入失败!'
);
}
}
function
cancelban
(){
$id
=
intval
(
$_GET
[
'id'
]);
if
(
$id
)
{
...
...
@@ -277,7 +285,7 @@ class ProxyController extends AdminbaseController{
$this
->
error
(
'数据传入失败!'
);
}
}
}
\ No newline at end of file
}
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