Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
e3905337
Commit
e3905337
authored
Jan 23, 2018
by
clone
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/test'
parents
d1cdc3f1
6aa9b1d2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
24 deletions
+73
-24
Member.php
application/index/controller/Member.php
+15
-6
Users.php
application/model/Users.php
+58
-15
.gitignore
runtime/.gitignore
+0
-3
No files found.
application/index/controller/Member.php
View file @
e3905337
...
...
@@ -24,7 +24,15 @@ class Member extends Basic{
public
function
index
()
{
return
view
(
'member/users_list'
);
}
/**
* 用户列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getUserList
()
{
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
...
...
@@ -36,21 +44,22 @@ class Member extends Basic{
$where
[
'status'
]
=
0
;
if
(
!
empty
(
$params
[
'name'
]))
{
$where
[
'
user_nick'
]
=
[
'like'
,
'%'
.
$params
[
'name'
]
.
'%'
];
$where
[
'
a.user_nick'
]
=
[
'like'
,
$params
[
'name'
]
.
'%'
];
}
if
(
!
empty
(
$params
[
'phone'
]))
{
$where
[
'user_phone'
]
=
[
'like'
,
'%'
.
$params
[
'phone'
]
.
'%'
];
$where
[
'user_phone'
]
=
[
'like'
,
$params
[
'phone'
]
.
'%'
];
}
if
(
!
empty
(
$params
[
'invite'
]))
{
$where
[
'phone'
]
=
[
'like'
,
'%'
.
$params
[
'invite'
]
.
'%
'
];
$where
[
'phone'
]
=
$params
[
'invite
'
];
}
if
(
!
empty
(
$params
[
'id'
]))
{
$where
[
'id'
]
=
$params
[
'id'
];
$where
[
'
a.
id'
]
=
$params
[
'id'
];
}
$fields
=
'id,user_nick,user_phone,user_pic,create_time,user_pswd,referrer_id'
;
$fields
=
'a.id,a.user_nick,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,a.referrer_source'
;
$data
[
'list'
]
=
$this
->
user
->
getUserAgent
(
$pageNo
,
$pageSize
,
''
,
$fields
,
$where
);
$data
[
'total'
]
=
$this
->
user
->
getUserAgentTotal
(
$where
);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
);
...
...
application/model/Users.php
View file @
e3905337
...
...
@@ -10,6 +10,16 @@ class Users extends Model
// 设置当前模型对应的完整数据表名称
protected
$table
=
'u_users'
;
/**
* 查询用户
*
* @param $userId
* @param string $fields
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
selectUser
(
$userId
,
$fields
=
'id,user_phone'
)
{
$param
[
"status"
]
=
array
(
"eq"
,
0
);
...
...
@@ -22,38 +32,62 @@ class Users extends Model
}
return
$data
;
}
/**
* 查询用户和经纪人
*
* @param type $pageNo
* @param type $pageSize
* @param type $order_
* @param type $fields
* @param type $params
* @return type
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $fields
* @param string $params
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getUserAgent
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$fields
=
'*'
,
$params
=
''
)
{
$result
=
$this
->
field
(
$fields
)
$data
=
array
();
if
(
$params
[
'phone'
])
{
$result
=
$this
->
field
(
$fields
)
->
alias
(
'a'
)
->
join
(
'agents b'
,
'a.referrer_id=b.id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
else
{
$result
=
$this
->
field
(
$fields
)
->
alias
(
'a'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
$agents
=
new
Agents
();
foreach
(
$result
as
$k
=>
$v
)
{
$data
[
$k
]
=
$v
->
getData
();
if
(
$data
[
$k
][
'user_pic'
])
{
$data
[
$k
][
'user_pic'
]
=
CURRENT_URL
.
'static/head_portrait/'
.
$data
[
$k
][
'user_pic'
];
}
else
{
$data
[
$k
][
'user_pic'
]
=
''
;
}
$agent_data
=
$agents
->
field
(
'realname,phone'
)
->
where
(
'id'
,
$data
[
$k
][
'referrer_id'
])
->
find
();
$data
[
$k
][
'realname'
]
=
$agent_data
[
'realname'
];
$data
[
$k
][
'phone'
]
=
$agent_data
[
'phone'
];
//判断来源
if
(
$data
[
$k
][
'referrer_source'
]
==
10
)
{
$user_data
=
$this
->
field
(
'id,user_nick,user_phone'
)
->
where
(
'id'
,
$data
[
$k
][
'referrer_id'
])
->
find
();
$data
[
$k
][
'realname'
]
=
$user_data
->
user_nick
;
$data
[
$k
][
'phone'
]
=
$user_data
->
user_phone
;
}
else
{
$agent_data
=
$agents
->
field
(
'realname,phone'
)
->
where
(
'id'
,
$data
[
$k
][
'referrer_id'
])
->
find
();
$data
[
$k
][
'realname'
]
=
$agent_data
->
realname
;
$data
[
$k
][
'phone'
]
=
$agent_data
->
phone
;
}
}
return
$data
;
return
$data
;
}
/**
...
...
@@ -63,7 +97,16 @@ class Users extends Model
* @return mixed
*/
public
function
getUserAgentTotal
(
$params
)
{
$result
=
$this
->
where
(
$params
)
->
count
();
if
(
$params
[
'phone'
])
{
$result
=
$this
->
alias
(
'a'
)
->
join
(
'agents b'
,
'a.referrer_id=b.id'
,
'left'
)
->
where
(
$params
)
->
count
();
}
else
{
$result
=
$this
->
alias
(
'a'
)
->
where
(
$params
)
->
count
();
}
return
$result
;
}
...
...
runtime/.gitignore
deleted
100644 → 0
View file @
d1cdc3f1
*
!.gitignore
\ 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