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
3224f5bd
Commit
3224f5bd
authored
Nov 12, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
searchOrder bug
parent
6661df8f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
2 deletions
+75
-2
AppChat.php
application/chat/controller/AppChat.php
+33
-2
MPushMessage.php
application/model/MPushMessage.php
+42
-0
route.php
application/route.php
+0
-0
No files found.
application/chat/controller/AppChat.php
View file @
3224f5bd
...
...
@@ -460,7 +460,7 @@ class AppChat extends Basic
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$field
=
"id,addressee_id,type,message,house_id,create_time"
;
$field
=
"id,addressee_id,type,message,house_id,create_time
,is_read
"
;
//获取此经纪人的所有盘方楼盘id
...
...
@@ -493,7 +493,7 @@ class AppChat extends Basic
$page_no
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$page_size
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$field
=
"id,addressee_id,type,message,user_id,create_time"
;
$field
=
"id,addressee_id,type,message,user_id,create_time
,is_read
"
;
//获取此经纪人的所有盘方楼盘id
...
...
@@ -507,4 +507,35 @@ class AppChat extends Basic
}
/**
* 获取商铺消息和客户消息的未读消息个数,并修改已读消息状态
* @return \think\Response
*/
public
function
updateSystemMessageIsRead
(){
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 1,//经纪人id
"read_ids" => "1,2,3" //需要修改的消息id
);*/
if
(
empty
(
$params
[
'agent_id'
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$msgModel
=
new
MPushMessage
();
//修改已读消息
if
(
!
empty
(
$params
[
'read_ids'
])){
$where_arr
[
"id"
]
=
array
(
"in"
,
$params
[
"read_ids"
]);
$update_arr
[
"is_read"
]
=
1
;
$msgModel
->
updateIsRead
(
$where_arr
,
$update_arr
);
}
$param
[
"addressee_id"
]
=
$params
[
"agent_id"
];
$param
[
"type"
]
=
2
;
//TODO 获取未读个数
$data
[
"user_count"
]
=
$msgModel
->
getListCountByWhere
(
$param
);
$param
[
"type"
]
=
1
;
$data
[
"shop_count"
]
=
$msgModel
->
getListCountByWhere
(
$param
);
return
$this
->
response
(
"200"
,
"success"
,
$data
);
}
}
application/model/MPushMessage.php
View file @
3224f5bd
...
...
@@ -216,6 +216,16 @@ class MPushMessage
return
$result
;
}
/**
* @param string $field
* @param array $params
* @param int $page_no
* @param int $page_size
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getListByWhere
(
string
$field
,
array
$params
,
int
$page_no
=
1
,
int
$page_size
=
15
)
{
return
$this
->
db_
...
...
@@ -226,4 +236,35 @@ class MPushMessage
->
limit
(
$page_size
)
->
select
();
}
/**
* 获取未读个数
* @param array $params
* @return int|string
*/
public
function
getListCountByWhere
(
array
$params
)
{
return
$this
->
db_
->
where
(
$params
)
->
count
();
}
/** 批量更新已看记录
* @param array $where_arr
* @param array $update_arr
* @return array
*/
public
function
updateIsRead
(
array
$where_arr
,
array
$update_arr
){
$result
=
[];
try
{
$this
->
db_
->
where
(
$where_arr
)
->
update
(
$update_arr
);
$result
[
'code'
]
=
true
;
}
catch
(
\Exception
$e
)
{
$result
[
'code'
]
=
false
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
return
$result
;
}
}
\ No newline at end of file
application/route.php
View file @
3224f5bd
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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