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
b69b79f6
Commit
b69b79f6
authored
Nov 23, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
专门店
parent
d3843249
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
16 deletions
+77
-16
BrokerService.php
application/index/service/BrokerService.php
+39
-8
AOperatingRecords.php
application/model/AOperatingRecords.php
+38
-8
No files found.
application/index/service/BrokerService.php
View file @
b69b79f6
...
@@ -22,6 +22,8 @@ use app\model\GHousesToAgents;
...
@@ -22,6 +22,8 @@ use app\model\GHousesToAgents;
use
app\model\GOperatingRecords
;
use
app\model\GOperatingRecords
;
use
app\model\OMarchInModel
;
use
app\model\OMarchInModel
;
use
app\model\Users
;
use
app\model\Users
;
use
app\task\controller\ResultsSummaryNewTask
;
use
phpDocumentor\Reflection\Types\Integer
;
class
BrokerService
class
BrokerService
{
{
...
@@ -152,7 +154,29 @@ class BrokerService
...
@@ -152,7 +154,29 @@ class BrokerService
$result
[
'msg'
]
=
'新增或编辑失败'
;
$result
[
'msg'
]
=
'新增或编辑失败'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
}
}
}
else
{
}
elseif
(
$data
[
'confirm_old'
]
==
2
&&
!
empty
(
$data
[
'id'
]))
{
$m_record
=
new
AOperatingRecords
();
$task
=
new
ResultsSummaryNewTask
();
$start_time
=
$data
[
'performance_time'
];
$end_time
=
date
(
'Y-m-d'
,
strtotime
(
'+1 day'
));
$is_ok
=
$task
->
updateStoreByAgentId
(
$data
[
'id'
],
$data
[
'store_id'
],
$data
[
'district_id'
],
$start_time
,
$end_time
);
if
(
$is_ok
)
{
$id
=
$this
->
m_agent
->
saveAgent
(
$data
);
//正常新增或编辑
if
(
$id
>
0
)
{
$data
[
'agent_id'
]
=
$id
;
$data
[
'type'
]
=
1
;
$m_record
->
insertData
(
$data
);
//记录更换门店操作
$result
[
'msg'
]
=
'修改成功'
;
$result
[
'status'
]
=
'successful'
;
}
else
{
$result
[
'msg'
]
=
'修改失败'
;
$result
[
'status'
]
=
'fail'
;
}
}
else
{
$result
[
'msg'
]
=
'业绩转换失败'
;
$result
[
'status'
]
=
'fail'
;
}
}
elseif
(
$data
[
'confirm_old'
]
==
1
){
$data
[
'site_id'
]
=
$new_site_id
;
$data
[
'site_id'
]
=
$new_site_id
;
$id
=
$this
->
transferAgent
(
$data
,
$agent_old
,
$is_new_id
,
$operation_id
);
//转勤
$id
=
$this
->
transferAgent
(
$data
,
$agent_old
,
$is_new_id
,
$operation_id
);
//转勤
...
@@ -288,7 +312,7 @@ class BrokerService
...
@@ -288,7 +312,7 @@ class BrokerService
unset
(
$data
[
'id'
]);
unset
(
$data
[
'id'
]);
$data
[
'password_md5'
]
=
$agent_old
[
0
][
'password'
];
$data
[
'password_md5'
]
=
$agent_old
[
0
][
'password'
];
$id
=
$this
->
m_agent
->
saveAgent
(
$data
);
//普通转勤
$id
=
$this
->
m_agent
->
saveAgent
(
$data
);
//普通转勤
$this
->
transferUserHouse
(
$id
,
$agent_old
[
0
][
'id'
],
$operation_id
);
$this
->
transferUserHouse
(
$id
,
$agent_old
[
0
][
'id'
],
$operation_id
,
$data
);
}
else
{
}
else
{
$agent_old
[
0
][
'status'
]
=
3
;
$agent_old
[
0
][
'status'
]
=
3
;
unset
(
$agent_old
[
0
][
'id'
]);
unset
(
$agent_old
[
0
][
'id'
]);
...
@@ -300,7 +324,7 @@ class BrokerService
...
@@ -300,7 +324,7 @@ class BrokerService
}
else
{
}
else
{
$this
->
m_agent
->
saveAgent
([
'id'
=>
$agent_old
[
0
][
'id'
],
'status'
=>
3
]);
//将原来的设置为转勤状态
$this
->
m_agent
->
saveAgent
([
'id'
=>
$agent_old
[
0
][
'id'
],
'status'
=>
3
]);
//将原来的设置为转勤状态
$this
->
m_agent
->
saveAgent
([
'id'
=>
$transfer_agent
,
'status'
=>
0
]);
//将原来转勤状态处理为正常
$this
->
m_agent
->
saveAgent
([
'id'
=>
$transfer_agent
,
'status'
=>
0
]);
//将原来转勤状态处理为正常
$this
->
transferUserHouse
(
$transfer_agent
,
$agent_old
[
0
][
'id'
],
$operation_id
);
$this
->
transferUserHouse
(
$transfer_agent
,
$agent_old
[
0
][
'id'
],
$operation_id
,
$data
);
$id
=
$transfer_agent
;
$id
=
$transfer_agent
;
}
}
...
@@ -317,12 +341,14 @@ class BrokerService
...
@@ -317,12 +341,14 @@ class BrokerService
/**
/**
* 转换客户和商铺到转勤后的id
* 转换客户和商铺到转勤后的id
*
*
* @param $id
* @param Int $id
* @param $change_old_id
* @param int $change_old_id
* @param $operation_id
* @param int $operation_id
* @param array $agent_data
* @return mixed
* @throws \Exception
* @throws \Exception
*/
*/
private
function
transferUserHouse
(
$id
,
$change_old_id
,
$operation_id
)
private
function
transferUserHouse
(
Int
$id
,
int
$change_old_id
,
int
$operation_id
,
array
$agent_data
=
[]
)
{
{
$m_user
=
new
Users
();
$m_user
=
new
Users
();
$update_user
=
$update_house
=
[];
$update_user
=
$update_house
=
[];
...
@@ -361,7 +387,12 @@ class BrokerService
...
@@ -361,7 +387,12 @@ class BrokerService
$record_data
[
'type'
]
=
0
;
$record_data
[
'type'
]
=
0
;
$record_data
[
'operation_id'
]
=
$operation_id
;
$record_data
[
'operation_id'
]
=
$operation_id
;
$record_data
[
'agent_id'
]
=
$id
;
$record_data
[
'agent_id'
]
=
$id
;
$m_records
->
insertData
(
$record_data
);
$record_data
[
'name'
]
=
$agent_data
[
'name'
];
$record_data
[
'phone'
]
=
$agent_data
[
'phone'
];
$record_data
[
'district_id'
]
=
$agent_data
[
'district_id'
];
$record_data
[
'store_id'
]
=
$agent_data
[
'store_id'
];
$record_data
[
'performance_time'
]
=
date
(
'Y-m-d'
);
return
$m_records
->
insertData
(
$record_data
);
}
}
/**
/**
...
...
application/model/AOperatingRecords.php
View file @
b69b79f6
...
@@ -17,8 +17,9 @@ class AOperatingRecords extends BaseModel
...
@@ -17,8 +17,9 @@ class AOperatingRecords extends BaseModel
protected
$table
=
'a_operating_records'
;
protected
$table
=
'a_operating_records'
;
protected
$db
;
protected
$db
;
public
function
__construct
()
public
function
__construct
(
$data
=
[]
)
{
{
parent
::
__construct
(
$data
);
$this
->
db
=
Db
::
table
(
$this
->
table
);
$this
->
db
=
Db
::
table
(
$this
->
table
);
}
}
...
@@ -27,12 +28,40 @@ class AOperatingRecords extends BaseModel
...
@@ -27,12 +28,40 @@ class AOperatingRecords extends BaseModel
* @return mixed
* @return mixed
*/
*/
public
function
insertData
(
$data
)
{
public
function
insertData
(
$data
)
{
$save_data
[
'agent_id'
]
=
$data
[
'agent_id'
];
$save_data
=
[];
$save_data
[
'remark'
]
=
$data
[
'remark'
];
if
(
!
empty
(
$data
[
'agent_id'
]))
{
$save_data
[
'house_id'
]
=
$data
[
'house_id'
];
$save_data
[
'agent_id'
]
=
$data
[
'agent_id'
];
$save_data
[
'user_id'
]
=
$data
[
'user_id'
];
}
$save_data
[
'type'
]
=
$data
[
'type'
];
if
(
!
empty
(
$data
[
'remark'
]))
{
$save_data
[
'operation_id'
]
=
$data
[
'operation_id'
];
$save_data
[
'remark'
]
=
$data
[
'remark'
];
return
$this
->
insert
(
$save_data
);
}
if
(
!
empty
(
$data
[
'house_id'
]))
{
$save_data
[
'house_id'
]
=
$data
[
'house_id'
];
}
if
(
!
empty
(
$data
[
'user_id'
]))
{
$save_data
[
'user_id'
]
=
$data
[
'user_id'
];
}
if
(
!
empty
(
$data
[
'type'
]))
{
$save_data
[
'type'
]
=
$data
[
'type'
];
}
if
(
!
empty
(
$data
[
'operation_id'
]))
{
$save_data
[
'operation_id'
]
=
$data
[
'operation_id'
];
}
if
(
!
empty
(
$data
[
'district_id'
]))
{
$save_data
[
'district_id'
]
=
$data
[
'district_id'
];
}
if
(
!
empty
(
$data
[
'store_id'
]))
{
$save_data
[
'store_id'
]
=
$data
[
'store_id'
];
}
if
(
!
empty
(
$data
[
'name'
]))
{
$save_data
[
'name'
]
=
$data
[
'name'
];
}
if
(
!
empty
(
$data
[
'phone'
]))
{
$save_data
[
'phone'
]
=
$data
[
'phone'
];
}
if
(
!
empty
(
$data
[
'performance_time'
]))
{
$save_data
[
'performance_time'
]
=
$data
[
'performance_time'
];
}
return
$this
->
db
->
insert
(
$save_data
);
}
}
}
}
\ No newline at end of file
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