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
55d9b61e
Commit
55d9b61e
authored
Jul 17, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
f8195f19
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
AppChat.php
application/chat/controller/AppChat.php
+2
-2
ChatService.php
application/chat/service/ChatService.php
+2
-1
ChatMsg.php
application/model/ChatMsg.php
+4
-1
No files found.
application/chat/controller/AppChat.php
View file @
55d9b61e
...
@@ -324,8 +324,8 @@ class AppChat extends Basic
...
@@ -324,8 +324,8 @@ class AppChat extends Basic
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
/* $params = array(
"target" => "agent_5739",
"target" => "agent_5739",
"is_user" =>
0
,//0用户1经纪人
"is_user" =>
1
,//0用户1经纪人
"relation_list" => '[
{ "r_id" : 12, "msg_id" : 111}, { "r_id" : 11, "msg_id" : 111
}]',
"relation_list" => '[
{"r_id":"13","msg_id":2868},{"r_id":"12","msg_id":2849
}]',
);*/
);*/
if
(
!
isset
(
$params
[
'target'
])
||
!
isset
(
$params
[
"is_user"
]))
{
if
(
!
isset
(
$params
[
'target'
])
||
!
isset
(
$params
[
"is_user"
]))
{
return
$this
->
response
(
"300"
,
"参数不全"
);
return
$this
->
response
(
"300"
,
"参数不全"
);
...
...
application/chat/service/ChatService.php
View file @
55d9b61e
...
@@ -430,7 +430,8 @@ class ChatService
...
@@ -430,7 +430,8 @@ class ChatService
$where_
[
"id"
]
=
array
(
"between"
,
array
(
$relation_list
[
$item
[
"id"
]][
0
][
"msg_id"
],
$chat_info
[
0
][
"id"
]
)
);
$where_
[
"id"
]
=
array
(
"between"
,
array
(
$relation_list
[
$item
[
"id"
]][
0
][
"msg_id"
],
$chat_info
[
0
][
"id"
]
)
);
//计算未读消息个数
//计算未读消息个数
$unread_count
=
$msgModel
->
getTotalUnread
(
$where_
,
"id"
);
$unread_count
=
$msgModel
->
getTotalUnread
(
$where_
,
"id"
);
$result
[
$key
][
"unread"
]
=
$unread_count
;
//dump($unread_count);
$result
[
$key
][
"unread"
]
=
$unread_count
>
0
?
$unread_count
-
1
:
0
;
}
catch
(
Exception
$exception
)
{
}
catch
(
Exception
$exception
)
{
$result
[
$key
][
"unread"
]
=
0
;
$result
[
$key
][
"unread"
]
=
0
;
}
}
...
...
application/model/ChatMsg.php
View file @
55d9b61e
...
@@ -78,7 +78,8 @@ class ChatMsg extends Model
...
@@ -78,7 +78,8 @@ class ChatMsg extends Model
return
$data
;
return
$data
;
}
}
public
function
getTotalUnread
(
$params
,
$field
){
public
function
getTotalUnread
(
$params
,
$field
)
{
if
(
isset
(
$params
[
"from"
]))
{
if
(
isset
(
$params
[
"from"
]))
{
$where_
[
"a.from_id"
]
=
$params
[
"from"
];
$where_
[
"a.from_id"
]
=
$params
[
"from"
];
...
@@ -90,6 +91,7 @@ class ChatMsg extends Model
...
@@ -90,6 +91,7 @@ class ChatMsg extends Model
}
}
if
(
isset
(
$params
[
"id"
]))
{
if
(
isset
(
$params
[
"id"
]))
{
$where_
[
"a.id"
]
=
$params
[
"id"
];
$where_
[
"a.id"
]
=
$params
[
"id"
];
$where_or
[
"a.id"
]
=
$params
[
"id"
];
}
}
$where_
[
"a.is_del"
]
=
0
;
$where_
[
"a.is_del"
]
=
0
;
...
@@ -102,6 +104,7 @@ class ChatMsg extends Model
...
@@ -102,6 +104,7 @@ class ChatMsg extends Model
})
})
->
order
(
"a.created_at desc"
)
->
order
(
"a.created_at desc"
)
->
count
();
->
count
();
//echo $this->getLastSql();
return
$data
;
return
$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