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
4cbe4b68
Commit
4cbe4b68
authored
Nov 28, 2018
by
hujun
Committed by
zw
Nov 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
聊天推送
parent
c8024fc2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
16 deletions
+8
-16
ChatService.php
application/chat/service/ChatService.php
+8
-16
No files found.
application/chat/service/ChatService.php
View file @
4cbe4b68
...
@@ -86,7 +86,7 @@ class ChatService
...
@@ -86,7 +86,7 @@ class ChatService
//todo 保存或更新push_id
//todo 保存或更新push_id
//todo 1.判断设备id +id 的数据是否存在,存在并且push_id和提交的不同则修改,否者新增
//todo 1.判断设备id +id 的数据是否存在,存在并且push_id和提交的不同则修改,否者新增
if
(
$id
>
0
&&
$device_id
&&
$push_id
)
{
if
(
$id
>
0
&&
$device_id
&&
$push_id
)
{
$this
->
savePushIdV2
(
$id
,
$device_id
,
$push_id
);
$this
->
savePushIdV2
(
$id
,
$device_id
,
$push_id
,
$chatUser
[
0
][
'type'
]
);
}
}
return
[
"code"
=>
200
,
"only_id"
=>
$only_id
];
return
[
"code"
=>
200
,
"only_id"
=>
$only_id
];
}
}
...
@@ -143,29 +143,30 @@ class ChatService
...
@@ -143,29 +143,30 @@ class ChatService
* @param $chat_user_id
* @param $chat_user_id
* @param $device_id
* @param $device_id
* @param $push_id
* @param $push_id
* @param $type
* @return bool
* @return bool
* @throws
\think\
Exception
* @throws Exception
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
private
function
savePushIdV2
(
$chat_user_id
,
$device_id
,
$push_id
)
private
function
savePushIdV2
(
$chat_user_id
,
$device_id
,
$push_id
,
$type
)
{
{
//todo 根据设备来判断使用设备用户,
//todo 根据设备来判断使用设备用户,
$where
[
'device_id'
]
=
$device_id
;
$where
[
'device_id'
]
=
$device_id
;
$where
[
'
push_id'
]
=
$push_id
;
$where
[
'
type'
]
=
$type
;
$info
=
$this
->
chatUserExtModel
->
getChatUserExt
(
$where
,
'id,ext_id,device_id,push_id,is_forbidden'
);
$info
=
$this
->
chatUserExtModel
->
getChatUserExtByUserId
(
$where
,
'a.id,a.ext_id,a.device_id,a.push_id,a.is_forbidden'
,
100
);
$result
=
false
;
$result
=
false
;
if
(
count
(
$info
)
>
0
)
{
if
(
count
(
$info
)
>
0
)
{
$current_user_id
=
0
;
$current_user_id
=
0
;
foreach
(
$info
as
$k
=>
$v
)
{
foreach
(
$info
as
$k
=>
$v
)
{
if
(
$v
[
'is_forbidden'
]
==
0
)
{
if
(
$v
[
'is_forbidden'
]
==
0
)
{
if
(
$v
[
'ext_id'
]
!=
$chat_user_id
)
{
if
(
$v
[
'ext_id'
]
!=
$chat_user_id
&&
$push_id
==
$v
[
'push_id'
]
)
{
$this
->
chatUserExtModel
->
addChatUserExt
([
'is_forbidden'
=>
1
],
$v
[
'id'
]);
$this
->
chatUserExtModel
->
addChatUserExt
([
'is_forbidden'
=>
1
],
$v
[
'id'
]);
}
else
{
}
else
{
$current_user_id
=
$chat_user_id
;
$current_user_id
=
$chat_user_id
;
}
}
}
else
{
}
else
{
if
(
$v
[
'ext_id'
]
==
$chat_user_id
&&
$
current_user_id
!=
$chat_user_id
)
{
if
(
$v
[
'ext_id'
]
==
$chat_user_id
&&
$
push_id
==
$v
[
'push_id'
]
)
{
$this
->
chatUserExtModel
->
addChatUserExt
([
'is_forbidden'
=>
0
],
$v
[
'id'
]);
$this
->
chatUserExtModel
->
addChatUserExt
([
'is_forbidden'
=>
0
],
$v
[
'id'
]);
$current_user_id
=
$chat_user_id
;
$current_user_id
=
$chat_user_id
;
}
}
...
@@ -179,15 +180,6 @@ class ChatService
...
@@ -179,15 +180,6 @@ class ChatService
$params
[
"push_id"
]
=
$push_id
;
$params
[
"push_id"
]
=
$push_id
;
$params
[
"is_forbidden"
]
=
0
;
$params
[
"is_forbidden"
]
=
0
;
$result
=
$this
->
chatUserExtModel
->
addChatUserExt
(
$params
);
$result
=
$this
->
chatUserExtModel
->
addChatUserExt
(
$params
);
}
else
{
$old_device_where
[
'ext_id'
]
=
$current_user_id
;
$old_device_where
[
'is_forbidden'
]
=
0
;
$old_device_where
[
'push_id'
]
=
[
'<>'
,
$push_id
];
$info
=
$this
->
chatUserExtModel
->
getChatUserExt
(
$where
,
'id'
);
foreach
(
$info
as
$k2
=>
$v2
)
{
$this
->
chatUserExtModel
->
addChatUserExt
([
'is_forbidden'
=>
1
],
$v2
[
'id'
]);
}
}
}
}
else
{
}
else
{
//todo 保存或更新push_id
//todo 保存或更新push_id
...
...
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