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
7ec7259a
Commit
7ec7259a
authored
Aug 20, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
f796db04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
ABindingDevice.php
application/model/ABindingDevice.php
+12
-9
No files found.
application/model/ABindingDevice.php
View file @
7ec7259a
...
...
@@ -102,20 +102,23 @@ class ABindingDevice extends BaseModel
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getDeviceNewByAgentId
(
array
$params
,
string
$field
)
public
function
getDeviceNewByAgentId
(
array
$params
,
string
$field
)
{
$where_
=
[]
;
$where_
=
$str
=
"1=1"
;
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
$where_
.=
" and agent_id ="
.
$params
[
"agent_id"
];
$str
=
$where_
;
$where_
.=
" and is_pc = 0 "
;
$str
.=
" and is_pc = 1 "
;
}
try
{
$
data
=
$this
->
field
(
$field
)
->
where
(
$where_
)
->
order
(
"update_time desc"
)
->
limit
(
5
)
->
select
(
);
$
sql
=
"select
$field
from (
(SELECT
$field
FROM
$this->table
where
$where_
order by update_time desc limit 5
)
union
(SELECT
$field
FROM
$this->table
where
$str
order by update_time desc limit 5
)
) as aa order by aa.update_time desc"
;
$data
=
$this
->
query
(
$sql
);
}
catch
(
\Exception
$e
)
{
$data
=
[];
}
...
...
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