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
747fdfd6
Commit
747fdfd6
authored
Feb 07, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建聊天关系
parent
e469ea76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
ChatService.php
application/chat/service/ChatService.php
+3
-4
ChatRelation.php
application/model/ChatRelation.php
+12
-2
No files found.
application/chat/service/ChatService.php
View file @
747fdfd6
...
@@ -305,11 +305,10 @@ class ChatService
...
@@ -305,11 +305,10 @@ class ChatService
$params
[
"from"
]
=
$from
;
$params
[
"from"
]
=
$from
;
$relationResult
=
$chatRelationModel
->
getChatRelation
(
$params
);
$relationResult
=
$chatRelationModel
->
getChatRelation
(
$params
);
if
(
count
(
$relationResult
)
>
0
)
{
if
(
count
(
$relationResult
)
==
0
)
{
//
表示关系已经建立
//
如果没有记录则记录聊天关系
$chatRelationModel
->
addChatRelation
(
$params
);
}
}
//getChatRelation
}
}
/**
/**
...
...
application/model/ChatRelation.php
View file @
747fdfd6
...
@@ -55,13 +55,23 @@ class ChatRelation extends Model
...
@@ -55,13 +55,23 @@ class ChatRelation extends Model
public
function
addChatRelation
(
$params
)
public
function
addChatRelation
(
$params
)
{
{
$where_
=
[];
if
(
isset
(
$params
[
"target"
]))
{
$where_
[
"to_id"
]
=
$params
[
"target"
];
}
if
(
isset
(
$params
[
"from"
]))
{
$where_
[
"from_id"
]
=
$params
[
"from"
];
}
$where_
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$where_
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
$this
->
insert
(
$
params
);
$this
->
insert
(
$
where_
);
Db
::
commit
();
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
Db
::
rollback
();
}
}
}
}
...
...
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