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
217213b8
Commit
217213b8
authored
Jan 11, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
聊天构建
parent
f86fc643
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
3 deletions
+62
-3
ChatService.php
application/chat/service/ChatService.php
+62
-3
No files found.
application/chat/service/ChatService.php
View file @
217213b8
...
@@ -23,7 +23,7 @@ class ChatService
...
@@ -23,7 +23,7 @@ class ChatService
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
userModel
=
new
Users
();
$this
->
userModel
=
new
Users
();
$this
->
agentsModel
=
new
Agents
();
$this
->
agentsModel
=
new
Agents
();
}
}
...
@@ -37,17 +37,18 @@ class ChatService
...
@@ -37,17 +37,18 @@ class ChatService
public
function
createOnlyId
(
$userId
,
$mobile
,
$source
)
public
function
createOnlyId
(
$userId
,
$mobile
,
$source
)
{
{
//todo 1.验证用户是否存在 经纪人和用户 2.根据规则生成唯一id 3.判断唯一id是否登录中,登陆中则调用退出接口 4.返回唯一id
//todo 1.验证用户是否存在 经纪人和用户 2.根据规则生成唯一id 3.判断唯一id是否登录中,登陆中则调用退出接口 4.返回唯一id
$onlyId
=
""
;
switch
(
$source
)
{
switch
(
$source
)
{
case
1
:
case
1
:
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
$userId
);
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
$userId
);
if
(
count
(
$agentsResult
)
>
1
)
if
(
count
(
$agentsResult
)
>
1
)
$onlyId
=
self
::
SOURCE_TYPE_AGENT
.
$userId
;
$onlyId
=
self
::
SOURCE_TYPE_AGENT
.
$userId
;
break
;
case
2
:
case
2
:
$userResult
=
$this
->
userModel
->
selectUser
(
$userId
);
$userResult
=
$this
->
userModel
->
selectUser
(
$userId
);
if
(
count
(
$userResult
)
>
1
)
if
(
count
(
$userResult
)
>
1
)
$onlyId
=
self
::
SOURCE_TYPE_APP
.
$userId
;
$onlyId
=
self
::
SOURCE_TYPE_APP
.
$userId
;
break
;
default
:
default
:
return
array
(
"code"
=>
101
,
"msg"
=>
"没找到用户信息"
);
return
array
(
"code"
=>
101
,
"msg"
=>
"没找到用户信息"
);
}
}
...
@@ -55,4 +56,61 @@ class ChatService
...
@@ -55,4 +56,61 @@ class ChatService
return
$onlyId
;
return
$onlyId
;
}
}
/**
* 发送消息
* @param $sender_id
* @param $receiver_ids
* @param $group_id
* @param $msg_content
* @param $msg_type
* @param $msg_filename
* @param $msg_file_url
*/
public
function
sendMsg
(
$sender_id
,
$receiver_ids
,
$group_id
,
$msg_content
,
$msg_type
,
$msg_filename
,
$msg_file_url
)
{
//todo
$this
->
insertMsg
();
}
/**
* 保存推送到环信的消息状态 往msg_status中插入数据
* @param $response
* @param $tmp
* @param $sender
* @param $msg_content
*/
public
function
saveSendStatus
(
$response
,
$tmp
,
$sender
,
$msg_content
)
{
//todo
}
/**
* 保存用户发送的消息
* @param $sender
* @param $receiver
* @param $group_id
* @param $msg_content
* @param $type
* @param $msg_filename
* @param $msg_file_url
*/
private
function
insertMsg
(
$sender
,
$receiver
,
$group_id
,
$msg_content
,
$type
,
$msg_filename
,
$msg_file_url
)
{
//todo
}
/** 获取聊天记录
* @param $sender
* @param $start
* @param $limit
* @param $site_id
* @return array
*/
public
function
getHistoryChatList
(
$sender
,
$start
,
$limit
,
$site_id
)
{
//todo
}
}
}
\ 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