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
49e57002
Commit
49e57002
authored
Feb 06, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
聊天关系
parent
3feb22ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
ChatService.php
application/chat/service/ChatService.php
+15
-1
ChatRelation.php
application/model/ChatRelation.php
+45
-0
No files found.
application/chat/service/ChatService.php
View file @
49e57002
...
@@ -16,6 +16,7 @@ use app\model\Agents;
...
@@ -16,6 +16,7 @@ use app\model\Agents;
use
app\model\ChatMsg
;
use
app\model\ChatMsg
;
use
app\model\ChatMsgExt
;
use
app\model\ChatMsgExt
;
use
app\model\ChatMsgStatus
;
use
app\model\ChatMsgStatus
;
use
app\model\ChatRelation
;
use
app\model\ChatUser
;
use
app\model\ChatUser
;
use
app\model\Users
;
use
app\model\Users
;
...
@@ -141,7 +142,8 @@ class ChatService
...
@@ -141,7 +142,8 @@ class ChatService
public
function
sendMsg
(
$target_type
,
$target
,
$source
,
$is_user
,
$type
,
$msg_content
,
$from
,
$accessToken
)
public
function
sendMsg
(
$target_type
,
$target
,
$source
,
$is_user
,
$type
,
$msg_content
,
$from
,
$accessToken
)
{
{
//todo
//todo 判断是否创建关系没有则保存
$this
->
verifyRelation
(
$target
,
$from
);
$this
->
insertMsg
(
$target_type
,
$target
,
$source
,
$is_user
,
$type
,
$msg_content
,
$from
);
$this
->
insertMsg
(
$target_type
,
$target
,
$source
,
$is_user
,
$type
,
$msg_content
,
$from
);
$rPush
=
new
RPush
();
$rPush
=
new
RPush
();
...
@@ -276,6 +278,18 @@ class ChatService
...
@@ -276,6 +278,18 @@ class ChatService
}
}
}
}
/**
* @param $target
* @param $from
*/
private
function
verifyRelation
(
$target
,
$from
){
$chatRelationModel
=
new
ChatRelation
();
$param
[
"to_id"
]
=
$chatRelationModel
->
getChatRelation
();
//getChatRelation
}
/**
/**
* 记录消息body
* 记录消息body
* @param $id
* @param $id
...
...
application/model/ChatRelation.php
0 → 100644
View file @
49e57002
<?php
namespace
app\model
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/2/6
* Time : 16:07
* Intro:
*/
use
think\Model
;
use
think\Db
;
class
ChatRelation
extends
Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'chat_relation'
;
protected
$db_
;
public
function
__construct
()
{
$this
->
db_
=
Db
(
$this
->
table
);
}
public
function
getChatRelation
(
$params
,
$field
=
"id,to_id,from_id"
)
{
return
$this
->
db
->
field
(
$field
)
->
where
(
$params
)
->
find
();
}
public
function
addChatRelation
(
$params
)
{
Db
::
startTrans
();
try
{
$this
->
insert
(
$params
);
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
}
}
}
\ No newline at end of file
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