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
4d65a249
Commit
4d65a249
authored
Jul 09, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量修改客方
parent
e88021f2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
21 deletions
+38
-21
Member.php
application/index/controller/Member.php
+10
-7
BrokerService.php
application/index/service/BrokerService.php
+15
-14
UserAgentModel.php
application/model/UserAgentModel.php
+13
-0
No files found.
application/index/controller/Member.php
View file @
4d65a249
...
...
@@ -14,6 +14,7 @@ use app\model\OfficePhoneFollowUp;
use
app\model\OfficeUPhoneFollowUp
;
use
app\model\UPhoneFollowUp
;
use
app\model\UPhoneFollowUpTemporary
;
use
app\model\UserAgentModel
;
use
app\model\Users
;
use
think\Request
;
use
think\session
;
...
...
@@ -555,27 +556,29 @@ class Member extends Basic{
return
$this
->
response
(
101
,
'经纪人信息错误'
);
}
$user
=
new
Users
();
$user
->
startTrans
();
$user
->
lock
(
true
);
$user_data
=
$user
->
getUserByWhere
([
'agent_id'
=>
$this
->
params
[
'old_agents_id'
]],
'id'
);
$m_user_agent
=
new
UserAgentModel
();
$m_user_agent
->
startTrans
();
$m_user_agent
->
lock
(
true
);
// $user_data = $user->getUserByWhere(['agent_id' => $this->params['old_agents_id']], 'id');
$user_data
=
$m_user_agent
->
getAllData
([
'agent_id'
=>
$this
->
params
[
'old_agents_id'
]],
'id'
);
$user_data_arr
=
[];
$total
=
0
;
$records
=
new
GOperatingRecords
();
$agent
=
new
AAgents
();
$redis_service
=
new
RedisCacheService
();
foreach
(
$user_data
as
$k
=>
$v
)
{
$user_data_arr
[
$k
][
'id'
]
=
$v
[
'id'
];
$user_data_arr
[
$k
][
'agent_id'
]
=
$this
->
params
[
'agents_id'
];
$m_user_agent
->
updateUserAgent
([
'id'
=>
$v
[
'id'
]],[
'agent_id'
=>
$this
->
params
[
'agents_id'
]]);
$agent_data
=
$agent
->
getAgentInfo
(
'name,phone'
,
$this
->
params
[
'agents_id'
]);
$remark
=
'修改为'
.
$agent_data
[
'name'
]
.
'-'
.
$agent_data
[
'phone'
];
$records
->
record
(
$this
->
userId
,
3
,
$remark
,
0
,
$v
[
'id'
]);
$redis_service
->
userCache
(
$v
[
'id'
]);
$total
++
;
}
$total
=
$user
->
updateUserAll
(
$user_data_arr
);
$user
->
commit
();
$m_user_agent
->
commit
();
return
$this
->
response
(
200
,
''
,
[
'total'
=>
count
(
$total
)]);
}
...
...
application/index/service/BrokerService.php
View file @
4d65a249
...
...
@@ -24,6 +24,7 @@ use app\model\Evaluate;
use
app\model\GHousesToAgents
;
use
app\model\GOperatingRecords
;
use
app\model\OMarchInModel
;
use
app\model\UserAgentModel
;
use
app\model\Users
;
use
app\task\controller\ResultsSummaryNewTask
;
use
phpDocumentor\Reflection\Types\Integer
;
...
...
@@ -398,15 +399,19 @@ class BrokerService
private
function
transferUserHouse
(
Int
$id
,
int
$change_old_id
,
int
$operation_id
,
array
$agent_data
=
[])
{
$m_user
=
new
Users
();
$redis_service
=
new
RedisCacheService
();
$update_user
=
$update_house
=
[];
$user_id_arr
=
$m_user
->
getUserByWhereColumn
([
'agent_id'
=>
$change_old_id
],
'id'
);
$m_user_agent
=
new
UserAgentModel
();
// $redis_service = new RedisCacheService();
// $user_id_arr = $m_user->getUserByWhereColumn(['agent_id' => $change_old_id], 'id');
$user_agent_id_arr
=
$m_user_agent
->
getAllData
(
'id,user_id'
,
[
'agent_id'
=>
$change_old_id
]);
$referrer_id_arr
=
$m_user
->
getUserByWhereColumn
([
'referrer_id'
=>
$change_old_id
,
'referrer_source'
=>
20
],
'id'
);
foreach
(
$user_id_arr
as
$k
=>
$v
)
{
$update_user
[
$k
][
'id'
]
=
$v
;
$update_user
[
$k
][
'agent_id'
]
=
$id
;
$redis_service
->
userCache
(
$v
);
foreach
(
$user_agent_id_arr
as
$k
=>
$v
)
{
// $update_user[$k]['id'] = $v;
// $update_user[$k]['agent_id'] = $id;
// $redis_service->userCache($v);
$user_id
[]
=
$v
[
'user_id'
];
$m_user_agent
->
updateUserAgent
([
'id'
=>
$v
[
'id'
]],[
'agent_id'
=>
$id
]);
}
foreach
(
$referrer_id_arr
as
$k2
=>
$v2
)
{
...
...
@@ -414,14 +419,15 @@ class BrokerService
'id'
=>
$v2
,
'referrer_id'
=>
$id
];
array_push
(
$update_user
,
$update_referrer
);
}
if
(
isset
(
$update_referrer
))
{
$m_user
->
updateUserAll
(
$update_referrer
);
}
$record_data
[
'user_id'
]
=
empty
(
$user_id
)
?
""
:
implode
(
','
,
$user_id
);
$m_house
=
new
GHousesToAgents
();
$house_where
[
'is_del'
]
=
0
;
$house_where
[
'agents_id'
]
=
$change_old_id
;
// $house_where['type'] = ['in', '2,3'];
$house_id_arr
=
$m_house
->
getAgentHouseOne
(
'id'
,
$house_where
);
foreach
(
$house_id_arr
as
$k
=>
$v
)
{
...
...
@@ -431,11 +437,6 @@ class BrokerService
$house_id_arr
=
array_unique
(
$house_id_arr
);
$record_data
[
'house_id'
]
=
empty
(
$house_id_arr
)
?
""
:
'关系id'
.
implode
(
','
,
$house_id_arr
);
if
(
!
empty
(
$update_user
))
{
$m_user
->
updateUserAll
(
$update_user
);
}
if
(
!
empty
(
$update_house
))
{
$m_house
->
updateUserAll
(
$update_house
);
}
...
...
application/model/UserAgentModel.php
View file @
4d65a249
...
...
@@ -133,4 +133,17 @@ class UserAgentModel extends Model
->
insertAll
(
$data
);
return
$result
;
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAllData
(
$field
,
$where
)
{
$where
[
'is_del'
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
}
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