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
a8d792a4
Commit
a8d792a4
authored
Oct 18, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
经纪人转勤
parent
7ce32b43
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
7 deletions
+113
-7
BrokerService.php
application/index/service/BrokerService.php
+62
-3
AOperatingRecords.php
application/model/AOperatingRecords.php
+39
-0
GHousesToAgents.php
application/model/GHousesToAgents.php
+1
-4
Users.php
application/model/Users.php
+11
-0
No files found.
application/index/service/BrokerService.php
View file @
a8d792a4
...
...
@@ -15,6 +15,10 @@ use app\index\validate\AAgentValidate;
use
app\model\AAgents
;
use
app\model\ABindingDevice
;
use
app\model\ADistrict
;
use
app\model\AOperatingRecords
;
use
app\model\GHousesToAgents
;
use
app\model\Users
;
use
think\Request
;
class
BrokerService
{
...
...
@@ -34,6 +38,7 @@ class BrokerService
*/
public
function
saveAgentData
(
array
$data
,
int
$operation_id
)
{
$change_old_id
=
0
;
$result
[
'status'
]
=
'fail'
;
$validate
=
new
AAgentValidate
();
$m_district
=
new
ADistrict
();
...
...
@@ -60,6 +65,19 @@ class BrokerService
return
$result
;
}
$agent_old
=
$this
->
m_agent
->
getAgentById
(
'id'
,
[
'phone'
=>
$data
[
'phone'
],
'status'
=>
0
]);
if
(
empty
(
$data
[
'confirm_old'
]))
{
if
(
!
empty
(
$agent_old
))
{
$result
[
'msg'
]
=
'转勤'
;
return
$result
;
}
}
else
{
$num
=
$this
->
m_agent
->
updateData
(
$agent_old
[
'id'
],
[
'status'
=>
3
]);
//更新原始账号状态
if
(
$num
>
0
)
{
$change_old_id
=
$agent_old
[
'id'
];
}
}
$msg
=
'新增成功'
;
$data
[
'status'
]
=
0
;
$data
[
'level'
]
=
10
;
...
...
@@ -87,6 +105,47 @@ class BrokerService
$result
[
'status'
]
=
'successful'
;
$result
[
'data'
]
=
[
'id'
=>
$id
];
$result
[
'msg'
]
=
$msg
;
if
(
$change_old_id
)
{
$m_user
=
new
Users
();
$update_user
=
$update_house
=
[];
$user_id_arr
=
$m_user
->
getUserByWhereColumn
([
'agent_id'
=>
$change_old_id
],
'id'
);
foreach
(
$user_id_arr
as
$k
=>
$v
)
{
$update_user
[
$k
][
'id'
]
=
$v
;
$update_user
[
$k
][
'agent_id'
]
=
$id
;
}
$record_data
[
'user_id'
]
=
empty
(
$user_id_arr
)
?
""
:
explode
(
','
,
$user_id_arr
);
$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
(
'houses_id'
,
$house_where
);
foreach
(
$house_id_arr
as
$k
=>
$v
)
{
$update_house
[
$k
][
'houses_id'
]
=
$v
;
$update_house
[
$k
][
'agents_id'
]
=
$id
;
}
$house_id_arr
=
array_unique
(
$house_id_arr
);
$record_data
[
'house_id'
]
=
empty
(
$user_id_arr
)
?
""
:
explode
(
','
,
$house_id_arr
);
$m_records
=
new
AOperatingRecords
();
$record_data
[
'remark'
]
=
'经纪人转勤操作'
;
$record_data
[
'type'
]
=
0
;
$record_data
[
'operation_id'
]
=
$operation_id
;
$record_data
[
'agent_id'
]
=
$id
;
$m_records
->
insertData
(
$data
);
if
(
!
empty
(
$update_user
))
{
$m_user
->
updateUserAll
(
$update_user
);
}
if
(
!
empty
(
$update_house
))
{
$m_house
->
updateUserAll
(
$update_house
);
}
}
}
else
{
$result
[
'msg'
]
=
'新增或编辑失败'
;
}
...
...
@@ -123,7 +182,7 @@ class BrokerService
//同时修改设备绑定表
try
{
$m_agent_device
=
new
ABindingDevice
();
$m_agent_device
->
updateDate
([
'is_forbidden'
=>
$is_forbidden
],
[
'agent_id'
=>
$data
[
'id'
]]);
$m_agent_device
->
updateDate
([
'is_forbidden'
=>
$is_forbidden
],
[
'agent_id'
=>
$data
[
'id'
]]);
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'设备解绑失败'
;
...
...
@@ -132,7 +191,7 @@ class BrokerService
if
(
$data
[
'status'
]
!=
0
)
{
$where
[
'a.id'
]
=
$data
[
'id'
];
$where
[
'a.id'
]
=
$data
[
'id'
];
$where
[
'b.status'
]
=
1
;
$agent_phone
=
$this
->
m_agent
->
getAgentCallPhone
(
'b.phone_a,b.phone_b,c.phone_x'
,
$where
);
...
...
@@ -145,7 +204,7 @@ class BrokerService
$push
=
new
PushMessageService
();
$message_data
[
'message'
]
=
'你的账号被冻结。'
;
$message_data
[
'agent_id'
]
=
$data
[
'id'
];
$message_data
[
'agent_id'
]
=
$data
[
'id'
];
$push
->
record
(
4
,
0
,
0
,
$operation_id
,
$message_data
);
}
...
...
application/model/AOperatingRecords.php
0 → 100644
View file @
a8d792a4
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2018/10/18
* Time: 16:16
*/
namespace
app\model
;
use
think\Db
;
class
AOperatingRecords
extends
BaseModel
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'a_operating_records'
;
protected
$db
;
public
function
__construct
()
{
$this
->
db
=
Db
::
table
(
$this
->
table
);
}
/**
* @param $data
* @return mixed
*/
public
function
insertData
(
$data
)
{
$save_data
[
'agent_id'
]
=
$data
[
'agent_id'
];
$save_data
[
'remark'
]
=
$data
[
'remark'
];
$save_data
[
'house_id'
]
=
$data
[
'house_id'
];
$save_data
[
'user_id'
]
=
$data
[
'user_id'
];
$save_data
[
'type'
]
=
$data
[
'type'
];
$save_data
[
'operation_id'
]
=
$data
[
'operation_id'
];
return
$this
->
inset
(
$save_data
);
}
}
\ No newline at end of file
application/model/GHousesToAgents.php
View file @
a8d792a4
...
...
@@ -423,10 +423,7 @@ class GHousesToAgents extends BaseModel
* @param int $is_del
* @return array
*/
public
function
getAgentHouseOne
(
$field
,
$type
,
$houses_id
,
$is_del
=
0
)
{
$where
[
'is_del'
]
=
$is_del
;
$where
[
'type'
]
=
$type
;
$where
[
'houses_id'
]
=
$houses_id
;
public
function
getAgentHouseOne
(
$field
,
$where
)
{
return
$this
->
where
(
$where
)
->
column
(
$field
);
}
...
...
application/model/Users.php
View file @
a8d792a4
...
...
@@ -55,6 +55,17 @@ class Users extends Model
return
$data
;
}
/**
* @param $param
* @param $fields
* @return array
*/
public
function
getUserByWhereColumn
(
$param
,
$fields
)
{
return
$this
->
where
(
$param
)
->
Column
(
$fields
);
}
/**
* 查询好友邀请记录-后期加分页
* @param $param
...
...
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