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
d1a6752d
Commit
d1a6752d
authored
Jul 16, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
c597f1dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
ChatService.php
application/chat/service/ChatService.php
+19
-8
RPush.php
application/chat/utils/RPush.php
+7
-6
No files found.
application/chat/service/ChatService.php
View file @
d1a6752d
...
...
@@ -217,7 +217,7 @@ class ChatService
foreach
(
$info
as
$item
)
{
array_push
(
$target
,
$item
[
"push_id"
]);
}
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$accessToken
,
[
$this
,
'saveSendStatus'
]);
$rPush
->
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$is_user
,
$type
,
$accessToken
,
[
$this
,
'saveSendStatus'
]);
return
true
;
}
...
...
@@ -377,11 +377,11 @@ class ChatService
}
}
/**
*
获取聊天列表
/**
获取聊天列表
* @param $target
* @return
false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @return
array
*
*
@throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
...
...
@@ -394,15 +394,26 @@ class ChatService
c.name as agent_name,c.img,d.user_name,d.user_phone,d.user_nick,d.user_pic,d.other_pic"
;
$relationList
=
$chatRelationModel
->
getChatRelationInfo
(
$params
,
$field
);
$result
=
[];
//dump($relationList);
$fields
=
"a.id,a.from_id,a.to_id,b.body,a.created_at"
;
$msgModel
=
new
ChatMsg
();
foreach
(
$relationList
as
$key
=>
$item
)
{
foreach
(
$relationList
as
$key
=>
$item
)
{
if
(
$item
[
"from_id"
]
==
$target
)
{
$result
[
$key
][
"relation_id"
]
=
$item
[
"to_id"
];
}
else
{
$result
[
$key
][
"relation_id"
]
=
$item
[
"from_id"
];
}
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
$result
[
$key
][
"type"
]
=
$item
[
"type"
];
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
$result
[
$key
][
"id"
]
=
$item
[
"id"
];
$select_
[
"from"
]
=
$item
[
"from_id"
];
$select_
[
"target"
]
=
$item
[
"to_id"
];
$re
lationLis
t
[
$key
][
"chat_info"
]
=
$msgModel
->
getChatHistory
(
$select_
,
$fields
,
1
,
1
);
$re
sul
t
[
$key
][
"chat_info"
]
=
$msgModel
->
getChatHistory
(
$select_
,
$fields
,
1
,
1
);
}
return
$re
lationLis
t
;
return
$re
sul
t
;
}
/**
...
...
application/chat/utils/RPush.php
View file @
d1a6752d
...
...
@@ -24,11 +24,12 @@ class RPush
* @param $target
* @param $msg_content
* @param $from
* @param $is_user
* @param $type
* @param $access_token
* @param $callback
*/
public
function
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$access_token
,
$callback
)
public
function
send
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$
is_user
,
$
type
,
$access_token
,
$callback
)
{
//todo
if
(
Cache
::
get
(
'save_message_num'
))
{
...
...
@@ -44,7 +45,7 @@ class RPush
Cache
::
set
(
'save_message_num'
,
0
);
}
$response
=
$this
->
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$access_token
);
$response
=
$this
->
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$
is_user
,
$
type
,
$access_token
);
call_user_func_array
([
$callback
[
0
],
$callback
[
1
]
],
[
$response
,
$target
,
$from
,
$msg_content
]);
}
...
...
@@ -61,7 +62,7 @@ class RPush
* @param $access_token
* @return array
*/
public
function
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$type
,
$access_token
)
public
function
sendRequestByCurl
(
$user_name
,
$target_type
,
$target
,
$msg_content
,
$from
,
$
is_user
,
$
type
,
$access_token
)
{
$title
=
"收到一条消息"
;
...
...
@@ -80,18 +81,18 @@ class RPush
'url'
=>
''
,
'name'
=>
$title
,
'imageUrl'
=>
''
,
'id'
=>
0
,
'id'
=>
0
,
'target'
=>
$target
,
'from'
=>
$from
,
'is_user'
=>
$is_user
,
'msg_type'
=>
1
,
// 1文本 2图片3楼盘
'ext'
=>
[
"user_name"
=>
$user_name
]
'ext'
=>
[
"user_name"
=>
$user_name
]
));
$pushMessageToIgt
=
new
GeTuiUtils
();
$push_arr
=
$target
;
return
$pushMessageToIgt
->
pushMessageToIgt
(
$push_arr
,
$title
,
$payload
);
/* $curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
...
...
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