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
0e0b0b6f
Commit
0e0b0b6f
authored
Jan 25, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取用户信息
parent
8e62fd6d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
28 deletions
+83
-28
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
+16
-14
Users.php
application/model/Users.php
+7
-2
route.php
application/route.php
+1
-0
No files found.
application/chat/controller/AppChat.php
View file @
0e0b0b6f
...
...
@@ -104,18 +104,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 @
0e0b0b6f
...
...
@@ -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
;
...
...
@@ -167,21 +169,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 @
0e0b0b6f
...
...
@@ -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 @
0e0b0b6f
...
...
@@ -55,11 +55,11 @@ class Agents extends Model
public
function
agentsDetail
(
$id
)
{
if
(
$id
)
{
$result
=
$this
->
field
(
'id,realname,created,sub_shopname,head_portrait'
)
$result
=
$this
->
field
(
'id,realname,created,sub_shopname,head_portrait'
)
->
where
(
'level=2 or level=5'
)
->
where
(
'id'
,
$id
)
->
find
();
$result
[
'head_portrait'
]
=
'user_header/'
.
$result
[
'head_portrait'
];
//头像
$evaluate_grade
=
Db
::
table
(
'u_evaluate'
)
$evaluate_grade
=
Db
::
table
(
'u_evaluate'
)
->
field
(
'sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num'
)
->
where
(
'agents_id'
,
$id
)
->
where
(
'is_show'
,
0
)
->
find
();
...
...
@@ -70,18 +70,18 @@ class Agents extends Model
}
$result
[
'evaluate_grade'
]
=
$grade
;
//评分等级
$result
[
'evaluate_num'
]
=
$evaluate_grade
[
'evaluate_num'
];
//评论数量
$result
[
'watch_shop'
]
=
Db
::
table
(
'u_appoint_watch_shop'
)
$result
[
'evaluate_num'
]
=
$evaluate_grade
[
'evaluate_num'
];
//评论数量
$result
[
'watch_shop'
]
=
Db
::
table
(
'u_appoint_watch_shop'
)
->
where
(
'agents_id'
,
$id
)
->
count
();
//看铺
$result
[
'head_portrait'
]
=
ADMIN_URL_TL
.
$result
[
'head_portrait'
];
$journal
=
new
JournalAccounts
();
$fields
=
'count(j.id) as num'
;
$result
[
'head_portrait'
]
=
ADMIN_URL_TL
.
$result
[
'head_portrait'
];
$journal
=
new
JournalAccounts
();
$fields
=
'count(j.id) as num'
;
$result
[
'JournalAccounts'
]
=
$journal
->
getJournalHouseInfoId
(
$fields
,
$id
)[
'num'
];
//成交记录
$current_time
=
time
();
$user_time
=
strtotime
(
$result
[
'created'
]);
$year
=
date
(
'Y'
,
$current_time
)
-
date
(
'Y'
,
$user_time
);
$user_time
=
strtotime
(
$result
[
'created'
]);
$year
=
date
(
'Y'
,
$current_time
)
-
date
(
'Y'
,
$user_time
);
//入职年限
if
(
$year
==
0
)
{
...
...
@@ -91,7 +91,7 @@ class Agents extends Model
}
$result
[
'label'
]
=
array
(
0
=>
'待定标签数据'
,
1
=>
'待定标签数据'
);
$data
=
$result
;
$data
=
$result
;
}
else
{
$data
=
false
;
}
...
...
@@ -102,17 +102,19 @@ class Agents extends Model
/**
* 获取经纪人 by zw
* @param $field
* @param $
id
* @param $
where_
* @return array|false|\PDOStatement|string|Model
*/
public
function
getAgentsById
(
$field
,
$id
)
public
function
getAgentsById
(
$field
,
$where_
)
{
return
$this
$data
=
$this
->
field
(
$field
)
->
where
(
'inuse = 1 and id = '
.
$id
)
->
where
(
$where_
)
->
find
();
return
$data
;
}
/**
* 查询经纪人列表
*
...
...
application/model/Users.php
View file @
0e0b0b6f
...
...
@@ -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
...
...
application/route.php
View file @
0e0b0b6f
...
...
@@ -143,6 +143,7 @@ Route::group('chat', [
'userChat'
=>
[
'chat/AppChat/userChat'
,
[
'method'
=>
'post|get'
]
],
'pushMsg'
=>
[
'chat/AppChat/pushMsg'
,
[
'method'
=>
'post|get'
]
],
'getChatHistory'
=>
[
'chat/AppChat/getChatHistory'
,
[
'method'
=>
'post|get'
]
],
'getUserOrAgentInfo'
=>
[
'chat/AppChat/getUserOrAgentInfo'
,
[
'method'
=>
'post|get'
]
],
]);
Route
::
group
(
'task'
,[
...
...
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