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
706eadd7
Commit
706eadd7
authored
Jul 16, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
83a8ac97
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
AppChat.php
application/chat/controller/AppChat.php
+2
-2
ChatService.php
application/chat/service/ChatService.php
+24
-4
ChatRelation.php
application/model/ChatRelation.php
+2
-1
No files found.
application/chat/controller/AppChat.php
View file @
706eadd7
...
...
@@ -321,8 +321,8 @@ class AppChat extends Basic
public
function
getChatRelation
()
{
$params
=
$this
->
params
;
/*
$params = array(
"target" => "agent_57
75
",
/*
$params = array(
"target" => "agent_57
39
",
"is_user"=> 0,//0用户1经纪人
);*/
if
(
!
isset
(
$params
[
'target'
])
||
!
isset
(
$params
[
"is_user"
]))
{
...
...
application/chat/service/ChatService.php
View file @
706eadd7
...
...
@@ -415,10 +415,30 @@ class ChatService
$result
[
$key
][
"img"
]
=
$item
[
"img"
];
$result
[
$key
][
"phone"
]
=
$item
[
"phone"
];
}
$result
[
$key
][
"only_id"
]
=
$item
[
"only_id"
];
$select_
[
"from"
]
=
$item
[
"from_id"
];
$select_
[
"target"
]
=
$item
[
"to_id"
];
$result
[
$key
][
"chat_info"
]
=
$msgModel
->
getChatHistory
(
$select_
,
$fields
,
1
,
1
);
$result
[
$key
][
"only_id"
]
=
$item
[
"only_id"
];
$select_
[
"from"
]
=
$item
[
"from_id"
];
$select_
[
"target"
]
=
$item
[
"to_id"
];
$chat_info
=
$msgModel
->
getChatHistory
(
$select_
,
$fields
,
1
,
1
);
if
(
count
(
$chat_info
)
>
0
)
{
$result
[
$key
][
"chat_info"
]
=
$chat_info
[
0
];
}
else
{
unset
(
$result
[
$key
]);
}
}
return
$this
->
sortByTime
(
array_values
(
$result
));
}
private
function
sortByTime
(
$result
)
{
for
(
$i
=
0
;
$i
<
count
(
$result
);
$i
++
)
{
for
(
$j
=
$i
+
1
;
$j
<
count
(
$result
);
$j
++
)
{
if
(
strtotime
(
$result
[
$j
][
"chat_info"
][
"created_at"
])
-
strtotime
(
$result
[
$i
][
"chat_info"
][
"created_at"
])
>
0
)
{
$temp
=
$result
[
$j
];
$result
[
$j
]
=
$result
[
$i
];
$result
[
$i
]
=
$temp
;
}
}
}
return
$result
;
}
...
...
application/model/ChatRelation.php
View file @
706eadd7
...
...
@@ -86,8 +86,9 @@ class ChatRelation extends Model
->
whereOr
(
function
(
$query
)
use
(
$whereOr_
)
{
$query
->
where
(
$whereOr_
);
})
->
group
(
"a.to_id,a.from_id"
)
->
select
();
echo
$this
->
getLastSql
();
//
echo $this->getLastSql();
return
$date
;
}
...
...
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