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
6ae323ed
Commit
6ae323ed
authored
Jan 25, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量查询经纪人或者会员的信息
parent
101633bf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
29 deletions
+65
-29
AppChat.php
application/chat/controller/AppChat.php
+4
-4
ChatService.php
application/chat/service/ChatService.php
+41
-20
curl_cookie.txt
application/chat/utils/curl_cookie.txt
+1
-1
Agents.php
application/model/Agents.php
+10
-2
Users.php
application/model/Users.php
+9
-2
No files found.
application/chat/controller/AppChat.php
View file @
6ae323ed
...
@@ -102,12 +102,12 @@ class AppChat extends Basic
...
@@ -102,12 +102,12 @@ class AppChat extends Basic
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
'only_id'
])
&&
!
isset
(
$params
[
'phone'
])
||
!
isset
(
$params
[
'typ
e'
]))
{
if
(
!
isset
(
$params
[
'only_id'
])
||
!
isset
(
$params
[
'phone'
])
||
!
isset
(
$params
[
'sourc
e'
]))
{
return
$this
->
response
(
ErrorCodeConst
::
ERROR_CODE_PARAM_NOT_EXIST
,
"请求参数错误"
);
return
$this
->
response
(
ErrorCodeConst
::
ERROR_CODE_PARAM_NOT_EXIST
,
"请求参数错误"
);
}
}
/* $params = array(
/* $params = array(
"only_id" => "user_
66
",
"only_id" => "user_
72,agent_10
",
"phone" => "13
817616471
",
"phone" => "13
112341234
",
"source" => 2,// 1经纪人 or 2用户
"source" => 2,// 1经纪人 or 2用户
);*/
);*/
$only_id
=
isset
(
$params
[
'only_id'
])
?
$params
[
'only_id'
]
:
0
;
$only_id
=
isset
(
$params
[
'only_id'
])
?
$params
[
'only_id'
]
:
0
;
...
@@ -208,7 +208,7 @@ class AppChat extends Basic
...
@@ -208,7 +208,7 @@ class AppChat extends Basic
$image
=
\think\Image
::
open
(
$static_path
);
$image
=
\think\Image
::
open
(
$static_path
);
$image
->
thumb
(
500
,
500
)
->
save
(
$static_path
);
//生成缩略图
$image
->
thumb
(
500
,
500
)
->
save
(
$static_path
);
//生成缩略图
$data
=
[
'
file_name'
=>
CHAT_IMG_URL
.
$img_path
,
'
name'
=>
$img_path
];
$data
=
[
'name'
=>
$img_path
];
}
else
{
}
else
{
// 上传失败获取错误信息
// 上传失败获取错误信息
return
$this
->
response
(
"101"
,
$file
->
getError
());
return
$this
->
response
(
"101"
,
$file
->
getError
());
...
...
application/chat/service/ChatService.php
View file @
6ae323ed
...
@@ -95,7 +95,7 @@ class ChatService
...
@@ -95,7 +95,7 @@ class ChatService
$where_
[
"id"
]
=
$userId
;
$where_
[
"id"
]
=
$userId
;
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
"id"
,
$where_
);
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
"id"
,
$where_
);
if
(
$agentsResult
->
id
>
0
)
if
(
$agentsResult
[
0
][
'id'
]
>
0
)
$onlyId
=
self
::
SOURCE_TYPE_AGENT
.
$userId
;
$onlyId
=
self
::
SOURCE_TYPE_AGENT
.
$userId
;
break
;
break
;
case
2
:
case
2
:
...
@@ -179,45 +179,66 @@ class ChatService
...
@@ -179,45 +179,66 @@ class ChatService
*/
*/
public
function
getUserInfo
(
$only_id
,
$phone
,
$type
)
public
function
getUserInfo
(
$only_id
,
$phone
,
$type
)
{
{
$user_phone
=
$phone
;
$user_phone
=
$agent_phone
=
[];
if
(
$only_id
)
{
if
(
$only_id
)
{
$where_
[
"only_id"
]
=
$only_id
;
$only_id_arr
=
explode
(
","
,
$only_id
);
$where_
[
"only_id"
]
=
array
(
"in"
,
$only_id_arr
);
$where_
[
"status"
]
=
0
;
$where_
[
"status"
]
=
0
;
$field
=
"type,user_id,phone,only_id"
;
$field
=
"type,user_id,phone,only_id"
;
$chat_user
=
$this
->
chatUserModel
->
getChatUser
(
$where_
,
$field
);
$chat_user
=
$this
->
chatUserModel
->
getChatUser
(
$where_
,
$field
);
if
(
$chat_user
[
0
][
"phone"
])
{
foreach
(
$chat_user
as
$v
)
{
$user_phone
=
$chat_user
[
0
][
"phone"
];
if
(
$v
[
"type"
]
==
1
)
{
array_push
(
$agent_phone
,
$v
[
"phone"
]);
}
else
{
array_push
(
$user_phone
,
$v
[
"phone"
]);
}
}
}
}
else
{
if
(
$type
==
1
)
{
$agent_phone
=
[
$phone
];
}
else
if
(
$type
==
2
)
{
$user_phone
=
[
$phone
];
}
}
$info
=
[];
}
switch
(
$type
)
{
case
1
:
$info_arr
=
[];
if
(
count
(
$agent_phone
)
>
0
)
{
$field
=
"id,realname as user_nick,phone as user_phone,head_portrait as user_pic"
;
$field
=
"id,realname as user_nick,phone as user_phone,head_portrait as user_pic"
;
$where_agent
[
"phone"
]
=
$user_phone
;
$where_agent
[
"phone"
]
=
array
(
"in"
,
$agent_phone
)
;
$where_agent
[
"inuse"
]
=
1
;
$where_agent
[
"inuse"
]
=
1
;
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
$field
,
$where_agent
);
$agentsResult
=
$this
->
agentsModel
->
getAgentsById
(
$field
,
$where_agent
);
if
(
$agentsResult
[
"user_pic"
])
{
foreach
(
$agentsResult
as
$v
)
{
$agentsResult
[
"user_pic"
]
=
IMG_PATH
.
$agentsResult
[
"user_pic"
];
if
(
$v
[
"user_pic"
])
{
$v
[
"user_pic"
]
=
IMG_PATH
.
$v
[
"user_pic"
];
}
}
$info
=
$agentsResult
;
array_push
(
$info_arr
,
$v
);
break
;
}
case
2
:
}
if
(
count
(
$user_phone
)
>
0
)
{
$fields
=
"id,user_nick,user_phone,user_pic"
;
$fields
=
"id,user_nick,user_phone,user_pic"
;
$param
[
"status"
]
=
0
;
$param
[
"status"
]
=
0
;
$param
[
"user_phone"
]
=
$user_phone
;
$param
[
"user_phone"
]
=
array
(
"in"
,
$user_phone
)
;
$userResult
=
$this
->
userModel
->
getUserByWhere
(
$param
,
$fields
);
$userResult
=
$this
->
userModel
->
getUserByWhere
(
$param
,
$fields
);
if
(
$userResult
[
"user_pic"
])
{
foreach
(
$userResult
as
$v
)
{
$agentsResult
[
"user_pic"
]
=
HEADERIMGURL
.
$userResult
[
"user_pic"
];
if
(
$v
[
"user_pic"
])
{
$v
[
"user_pic"
]
=
HEADERIMGURL
.
$v
[
"user_pic"
];
}
array_push
(
$info_arr
,
$v
);
}
}
$info
=
$userResult
;
break
;
}
}
return
$info
;
return
$info
_arr
;
}
}
...
...
application/chat/utils/curl_cookie.txt
View file @
6ae323ed
...
@@ -2,4 +2,4 @@
...
@@ -2,4 +2,4 @@
# http://curl.haxx.se/docs/http-cookies.html
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
# This file was generated by libcurl! Edit at your own risk.
a1.easemob.com FALSE / FALSE 15168
69338
rememberMe deleteMe
a1.easemob.com FALSE / FALSE 15168
74980
rememberMe deleteMe
application/model/Agents.php
View file @
6ae323ed
...
@@ -7,6 +7,14 @@ use think\Db;
...
@@ -7,6 +7,14 @@ use think\Db;
class
Agents
extends
Model
class
Agents
extends
Model
{
{
protected
$table
=
'agents'
;
protected
$agentsModel
;
function
__construct
()
{
$this
->
agentsModel
=
Db
(
$this
->
table
);
}
/**
/**
* 查询经纪人
* 查询经纪人
*
*
...
@@ -107,10 +115,10 @@ class Agents extends Model
...
@@ -107,10 +115,10 @@ class Agents extends Model
*/
*/
public
function
getAgentsById
(
$field
,
$where_
)
public
function
getAgentsById
(
$field
,
$where_
)
{
{
$data
=
$this
$data
=
$this
->
agentsModel
->
field
(
$field
)
->
field
(
$field
)
->
where
(
$where_
)
->
where
(
$where_
)
->
find
();
->
select
();
return
$data
;
return
$data
;
}
}
...
...
application/model/Users.php
View file @
6ae323ed
...
@@ -9,6 +9,12 @@ class Users extends Model
...
@@ -9,6 +9,12 @@ class Users extends Model
{
{
// 设置当前模型对应的完整数据表名称
// 设置当前模型对应的完整数据表名称
protected
$table
=
'u_users'
;
protected
$table
=
'u_users'
;
protected
$usersModel
;
function
__construct
()
{
$this
->
usersModel
=
Db
(
$this
->
table
);
}
/**
/**
* 查询用户
* 查询用户
...
@@ -34,9 +40,10 @@ class Users extends Model
...
@@ -34,9 +40,10 @@ class Users extends Model
}
}
public
function
getUserByWhere
(
$param
,
$fields
=
'id,user_phone'
)
public
function
getUserByWhere
(
$param
,
$fields
=
'id,user_phone'
)
{
{
$data
=
$this
->
field
(
$fields
)
$data
=
$this
->
usersModel
->
field
(
$fields
)
->
where
(
$param
)
->
where
(
$param
)
->
find
();
->
select
();
return
$data
;
return
$data
;
}
/**
}
/**
* 查询用户和经纪人
* 查询用户和经纪人
...
...
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