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
5fa70bbe
Commit
5fa70bbe
authored
Jan 25, 2018
by
clone
Committed by
hujun
Mar 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传图片
parent
05eb5d3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
14 deletions
+35
-14
AppChat.php
application/chat/controller/AppChat.php
+32
-12
ChatService.php
application/chat/service/ChatService.php
+2
-1
curl_cookie.txt
application/chat/utils/curl_cookie.txt
+1
-1
No files found.
application/chat/controller/AppChat.php
View file @
5fa70bbe
...
...
@@ -96,16 +96,6 @@ class AppChat extends Basic
}
}
/**
* c端根据经纪人的手机号获取唯一id
* @return \think\Response
*/
public
function
getAgentOnlyId
()
{
//todo
return
$this
->
response
(
"200"
,
"success"
,
""
);
}
/**
* 获取经纪人或用户的信息
...
...
@@ -200,9 +190,39 @@ class AppChat extends Basic
$msgModel
=
new
ChatMsg
();
$history_result
=
$msgModel
->
getChatHistory
(
$params
,
$field
,
$page_no
,
$page_size
);
if
(
$history_result
)
{
return
$this
->
response
(
"200"
,
"request success"
,
array_reverse
(
$history_result
));
return
$this
->
response
(
"200"
,
"request success"
,
array_reverse
(
$history_result
));
}
/**
* 上传聊天图片
* @return \think\Response
*/
public
function
uploadImg
()
{
$file
=
request
()
->
file
(
'image'
);
$data
=
[];
if
(
$file
)
{
$path
=
ROOT_PATH
.
'public'
.
DS
.
'static'
.
DS
.
'chat_image'
;
$info
=
$file
->
validate
([
'size'
=>
512000
,
'ext'
=>
'jpg,png'
])
//限制500KB
->
move
(
$path
);
if
(
$info
)
{
$img_path
=
$info
->
getSaveName
();
//生成的图片路径
$static_path
=
$path
.
DS
.
$img_path
;
//生成图片的绝对路径
$image
=
\think\Image
::
open
(
$static_path
);
$image
->
thumb
(
500
,
500
)
->
save
(
$static_path
);
//生成缩略图
$data
=
[
'file_name'
=>
HEADERIMGURL
.
$img_path
];
}
else
{
// 上传失败获取错误信息
return
$this
->
response
(
"101"
,
$file
->
getError
());
}
}
else
{
return
$this
->
response
(
"101"
,
"没有该文件"
);
}
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
}
...
...
application/chat/service/ChatService.php
View file @
5fa70bbe
...
...
@@ -95,7 +95,7 @@ class ChatService
$where_
[
"id"
]
=
$userId
;
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
"id"
,
$where_
);
if
(
$agentsResult
->
id
>
0
)
if
(
$agentsResult
->
id
>
0
)
$onlyId
=
self
::
SOURCE_TYPE_AGENT
.
$userId
;
break
;
case
2
:
...
...
@@ -227,6 +227,7 @@ class ChatService
}
return
$info
;
}
/**
* 保存用户发送的消息
...
...
application/chat/utils/curl_cookie.txt
View file @
5fa70bbe
...
...
@@ -2,4 +2,4 @@
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
a1.easemob.com FALSE / FALSE 151686
0430
rememberMe deleteMe
a1.easemob.com FALSE / FALSE 151686
1121
rememberMe deleteMe
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