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
35999362
Commit
35999362
authored
Jan 25, 2018
by
clone
Committed by
hujun
Mar 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取用户信息
parent
2ee0bb29
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
14 deletions
+68
-14
AppChat.php
application/chat/controller/AppChat.php
+18
-6
ChatService.php
application/chat/service/ChatService.php
+40
-5
curl_cookie.txt
application/chat/utils/curl_cookie.txt
+1
-1
Agents.php
application/model/Agents.php
+2
-0
Users.php
application/model/Users.php
+7
-2
No files found.
application/chat/controller/AppChat.php
View file @
35999362
...
...
@@ -107,18 +107,30 @@ class AppChat extends Basic
return
$this
->
response
(
"200"
,
"success"
,
""
);
}
/**
* 获取经纪人或用户的信息
* @return \think\Response
*/
public
function
getUserOrAgentInfo
()
{
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
'
id
'
])
||
!
isset
(
$params
[
'type'
]))
{
if
(
!
isset
(
$params
[
'
only_id'
])
&&
!
isset
(
$params
[
'phone
'
])
||
!
isset
(
$params
[
'type'
]))
{
return
$this
->
response
(
ErrorCodeConst
::
ERROR_CODE_PARAM_NOT_EXIST
,
"请求参数错误"
);
}
$params
=
array
(
"id"
=>
1
,
"type"
=>
1
,
//1用户 or 2经纪人
);
$this
->
_chat
->
getUserInfo
();
/* $params = array(
"only_id" => "user_66",
"phone" => "13817616471",
"source" => 2,// 1经纪人 or 2用户
);*/
$only_id
=
isset
(
$params
[
'only_id'
])
?
$params
[
'only_id'
]
:
0
;
$phone
=
isset
(
$params
[
'phone'
])
?
$params
[
'phone'
]
:
0
;
$result
=
$this
->
_chat
->
getUserInfo
(
$only_id
,
$phone
,
$params
[
"source"
]);
if
(
$result
)
{
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
return
$this
->
response
(
"101"
,
"request error ,not fund list"
,
[]);
}
...
...
application/chat/service/ChatService.php
View file @
35999362
...
...
@@ -91,7 +91,9 @@ class ChatService
$onlyId
=
""
;
switch
(
$source
)
{
case
1
:
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
"id"
,
$userId
);
$where_
[
"inuse"
]
=
1
;
$where_
[
"id"
]
=
$userId
;
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
"id"
,
$where_
);
if
(
count
(
$agentsResult
)
>
1
)
$onlyId
=
self
::
SOURCE_TYPE_AGENT
.
$userId
;
break
;
...
...
@@ -175,21 +177,54 @@ class ChatService
$this->insertPushLog($sender, $target, $msg_content, $status, $response['statusMsg']);*/
}
public
function
getUserInfo
(
$id
,
$type
)
/**
* 根据手机号或者onlyId获取用户信息
* @param $only_id
* @param $phone
* @param $type
* @return array|false|\PDOStatement|string|\think\Model
*/
public
function
getUserInfo
(
$only_id
,
$phone
,
$type
)
{
$user_phone
=
$phone
;
if
(
$only_id
)
{
$where_
[
"only_id"
]
=
$only_id
;
$where_
[
"status"
]
=
0
;
$field
=
"type,user_id,phone,only_id"
;
$chat_user
=
$this
->
chatUserModel
->
getChatUser
(
$where_
,
$field
);
if
(
$chat_user
[
0
][
"phone"
])
{
$user_phone
=
$chat_user
[
0
][
"phone"
];
}
}
$info
=
[];
switch
(
$type
)
{
case
1
:
$field
=
"id,"
;
$field
=
"id,realname as user_nick,phone as user_phone,head_portrait as user_pic"
;
$where_agent
[
"phone"
]
=
$user_phone
;
$where_agent
[
"inuse"
]
=
1
;
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
$field
,
$
id
);
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
$field
,
$
where_agent
);
if
(
$agentsResult
[
"user_pic"
])
{
$agentsResult
[
"user_pic"
]
=
IMG_PATH
.
$agentsResult
[
"user_pic"
];
}
$info
=
$agentsResult
;
break
;
case
2
:
$
userResult
=
$this
->
userModel
->
selectUser
(
$id
)
;
$
fields
=
"id,user_nick,user_phone,user_pic"
;
$param
[
"status"
]
=
0
;
$param
[
"user_phone"
]
=
$user_phone
;
$userResult
=
$this
->
userModel
->
getUserByWhere
(
$param
,
$fields
);
if
(
$userResult
[
"user_pic"
])
{
$agentsResult
[
"user_pic"
]
=
HEADERIMGURL
.
$userResult
[
"user_pic"
];
}
$info
=
$userResult
;
break
;
}
return
$info
;
}
/**
...
...
application/chat/utils/curl_cookie.txt
View file @
35999362
...
...
@@ -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 1516
76281
9 rememberMe deleteMe
a1.easemob.com FALSE / FALSE 1516
85276
9 rememberMe deleteMe
application/model/Agents.php
View file @
35999362
...
...
@@ -115,8 +115,10 @@ class Agents extends Model
->
field
(
$field
)
->
where
(
'inuse = 1 and id = '
.
$id
)
->
find
();
return
$data
;
}
/**
* 查询经纪人列表
*
...
...
application/model/Users.php
View file @
35999362
...
...
@@ -32,8 +32,13 @@ class Users extends Model
}
return
$data
;
}
/**
public
function
getUserByWhere
(
$param
,
$fields
=
'id,user_phone'
)
{
$data
=
$this
->
field
(
$fields
)
->
where
(
$param
)
->
find
();
return
$data
;
}
/**
* 查询用户和经纪人
*
* @param int $pageNo
...
...
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