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
5821792c
Commit
5821792c
authored
Nov 12, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息页面--通讯录
parent
6fbd9515
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
0 deletions
+99
-0
Agent.php
application/api_broker/controller/Agent.php
+59
-0
AAgents.php
application/model/AAgents.php
+40
-0
No files found.
application/api_broker/controller/Agent.php
0 → 100644
View file @
5821792c
<?php
namespace
app\api_broker\controller
;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018-11-12
* Time: 10:25:16
*/
use
app\api_broker\extend\Basic
;
use
app\model\AAgents
;
class
Agent
extends
Basic
{
protected
$aAgents
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
aAgents
=
new
AAgents
();
}
/**
* 消息页面--通讯录
* User: 朱伟
* Date: 2018-11-12
* Time: 10:49:56
* 接口文档 http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=680
*/
public
function
getPhoneBook
()
{
$params
=
$this
->
params
;
$where
=
[];
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
if
(
!
empty
(
$params
[
'site_id'
]))
{
$where
[
'Agents.site_id'
]
=
$params
[
'site_id'
]
;
}
$field
=
'Agents.id as agent_id,'
;
$field
.=
'Agents.name,'
;
$field
.=
'Agents.phone'
;
$res
=
$this
->
aAgents
->
getPhoneBookList
(
$field
,
$where
,
$pageSize
,
$pageNo
);
$res_total
=
$this
->
aAgents
->
getPhoneBookListTotal
(
$params
);
return
$this
->
response
(
"200"
,
"成功"
,[
'data'
=>
$res
,
'total'
=>
$res_total
]);
}
}
\ No newline at end of file
application/model/AAgents.php
View file @
5821792c
...
...
@@ -1430,4 +1430,43 @@ class AAgents extends BaseModel
->
select
();
}
/**
* 消息页面--通讯录
* @param $field
* @param $params
* @param $page_size
* @param $page_no
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getPhoneBookList
(
$field
,
$params
,
$page_size
,
$page_no
)
{
$params
[
"Agents.status"
]
=
0
;
$result
=
$this
->
field
(
$field
)
->
alias
(
"Agents"
)
->
where
(
$params
)
->
limit
(
$page_size
)
->
page
(
$page_no
)
->
select
();
//echo $this->getLastSql();
return
$result
;
}
/**
* 消息页面--通讯录
* @param $params
* @return int|string
*/
public
function
getPhoneBookListTotal
(
$params
)
{
$params
[
"Agents.status"
]
=
0
;
$result
=
$this
->
alias
(
"Agents"
)
->
where
(
$params
)
->
count
();
//echo $this->getLastSql();
return
$result
;
}
}
\ 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