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
2709e290
Commit
2709e290
authored
May 21, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增分佣提成修改
parent
f5cb755b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
40 deletions
+91
-40
Broker.php
application/index/controller/Broker.php
+20
-5
Finance.php
application/index/controller/Finance.php
+14
-34
Basic.php
application/index/extend/Basic.php
+2
-1
OBargainModel.php
application/model/OBargainModel.php
+54
-0
route.php
application/route.php
+1
-0
No files found.
application/index/controller/Broker.php
View file @
2709e290
<?php
/**
* Created by PhpStorm.
* User:
fuju
* User:
hu jun
* Date: 2017/12/22
* Time: 14:44
*/
...
...
@@ -11,7 +11,6 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\Agents
;
use
app\model\GHousesToAgents
;
class
Broker
extends
Basic
...
...
@@ -187,6 +186,9 @@ class Broker extends Basic
* 获取经纪人和楼盘关系信息
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentsTohouses
()
{
$data
[
'status'
]
=
200
;
...
...
@@ -210,7 +212,19 @@ class Broker extends Basic
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 根据经纪人id获取部门和门店id
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentDistrictStore
()
{
$m_store
=
new
AAgents
();
$where
[
'a.id'
]
=
$this
->
params
[
'id'
];
$field
=
'b.store_name, c.district_name'
;
$data
=
$m_store
->
getStoreDistrict
(
$field
,
$where
);
return
$this
->
response
(
200
,
''
,
$data
);
}
}
\ No newline at end of file
application/index/controller/Finance.php
View file @
2709e290
...
...
@@ -244,39 +244,18 @@ class Finance extends Basic
$data
[
'msg'
]
=
""
;
$data
[
'data'
]
=
[];
if
(
empty
(
$this
->
params
[
'id'
]))
{
if
(
empty
(
$this
->
params
[
'id'
])
||
empty
(
$this
->
params
[
'agent_id'
])
)
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'
Id is null.
'
;
$data
[
'msg'
]
=
'
提交信息错误!
'
;
}
else
{
$bargain
=
new
OBargainModel
();
$bargain_data
=
$bargain
->
get
(
$this
->
params
[
'id'
]);
if
(
empty
(
$bargain_data
))
{
$data
[
'data'
]
=
$bargain
->
addBargainCommission
(
$this
->
params
[
'id'
],
$this
->
userId
,
$this
->
params
[
'agent_id'
],
$this
->
params
[
'role'
],
$this
->
params
[
'scale_fee'
],
$this
->
params
[
'scale'
]);
if
(
$data
[
'data'
]
==
0
)
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Don\'t have info.'
;
}
else
{
$insert_data
[
'report_id'
]
=
$bargain_data
[
'report_id'
];
$insert_data
[
'agent_id'
]
=
$bargain_data
[
'agent_id'
];
$insert_data
[
'order_id'
]
=
$bargain_data
[
'order_id'
];
$insert_data
[
'order_no'
]
=
$bargain_data
[
'order_no'
];
$insert_data
[
'trade_type'
]
=
$bargain_data
[
'trade_type'
];
$insert_data
[
'submit_agent_id'
]
=
$bargain_data
[
'submit_agent_id'
];
$insert_data
[
'price'
]
=
$bargain_data
[
'price'
];
$insert_data
[
'commission'
]
=
$bargain_data
[
'commission'
];
$insert_data
[
'status'
]
=
$bargain_data
[
'status'
];
$insert_data
[
'source'
]
=
1
;
$insert_data
[
'role'
]
=
empty
(
$this
->
params
[
'role'
])
?
0
:
$this
->
params
[
'role'
];
$insert_data
[
'scale_fee'
]
=
empty
(
$this
->
params
[
'scale_fee'
])
?
0
:
$this
->
params
[
'scale_fee'
];
$insert_data
[
'practical_fee'
]
=
empty
(
$this
->
params
[
'practical_fee'
])
?
0
:
$this
->
params
[
'practical_fee'
];
$insert_data
[
'father_id'
]
=
empty
(
$this
->
params
[
'id'
])
?
0
:
$this
->
params
[
'id'
];
$insert_data
[
'scale'
]
=
empty
(
$this
->
params
[
'scale'
])
?
0
:
$this
->
params
[
'scale'
];
$data
[
'data'
][
'id'
]
=
$bargain
->
insertBargain
(
$insert_data
);
if
(
$data
[
'data'
]
==
0
)
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Add the failure.'
;
}
$data
[
'msg'
]
=
'Add the failure.'
;
}
}
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
...
...
@@ -299,14 +278,15 @@ class Finance extends Basic
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Id is null.'
;
}
else
{
$bargain
=
new
OBargainModel
();
$fields
=
'role,agent_id,scale,scale_fee,practical_fee,content'
;
$where
=
"id =
{
$this
->
params
[
'id'
]
}
or father_id =
{
$this
->
params
[
'id'
]
}
"
;
$data
[
'data'
]
=
$bargain
->
selectBargainByOrderNo
(
$fields
,
$where
);
$agent
=
new
AAgents
();
$m_comm
=
new
OPartialCommission
();
$fields
=
'role,b.agent_id,scale,scale_fee,a.practical_fee,content,a.cash,a.service_charge,a.tallage,a.charity_fund,a.real_fee,a.create_time'
;
$where
[
0
]
=
[
'EXP'
,
"b.id =
{
$this
->
params
[
'id'
]
}
or b.father_id =
{
$this
->
params
[
'id'
]
}
"
];
$data
[
'data'
]
=
$m_comm
->
getCommissionBargainList
(
1
,
100
,
'a.id desc'
,
$fields
,
$where
);
$m_agent
=
new
AAgents
();
$fields_a
=
'name,store_name'
;
foreach
(
$data
[
'data'
]
as
$k
=>
$v
)
{
$agent_store
=
$agent
->
getAgentsStoreById
([
'a.id'
=>
$v
[
'agent_id'
]],
$fields_a
);
$agent_store
=
$
m_
agent
->
getAgentsStoreById
([
'a.id'
=>
$v
[
'agent_id'
]],
$fields_a
);
$data
[
'data'
][
$k
][
'agent_name'
]
=
$agent_store
[
'name'
];
$data
[
'data'
][
$k
][
'store_name'
]
=
$agent_store
[
'store_name'
];
...
...
application/index/extend/Basic.php
View file @
2709e290
...
...
@@ -46,7 +46,8 @@ class Basic extends Controller
'index/getLabelsList'
,
'index/regions'
,
'index/getAuth2'
,
'index/getDistrict'
'index/getDistrict'
,
'index/getAgentDistrictStore'
);
/**
...
...
application/model/OBargainModel.php
View file @
2709e290
...
...
@@ -485,4 +485,57 @@ class OBargainModel extends Model
->
order
(
"create_time desc"
)
->
select
();
}
/**
* 新增分佣
*
* @param $id
* @param $submit_agent_id
* @param $agent_id
* @param $role
* @param $scale_fee
* @param $scale
* @return bool|int|string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
addBargainCommission
(
$id
,
$submit_agent_id
,
$agent_id
,
$role
,
$scale_fee
,
$scale
)
{
$this
->
startTrans
();
$bargain_data
=
$this
->
where
(
'id'
,
$id
)
->
find
()
->
lock
(
true
);
if
(
empty
(
$bargain_data
[
'id'
]))
{
$result
=
false
;
}
else
{
$insert_data
[
'father_id'
]
=
$id
;
$insert_data
[
'report_id'
]
=
$bargain_data
[
'report_id'
];
$insert_data
[
'agent_id'
]
=
$agent_id
;
$insert_data
[
'order_id'
]
=
$bargain_data
[
'order_id'
];
$insert_data
[
'order_no'
]
=
$bargain_data
[
'order_no'
];
$insert_data
[
'trade_type'
]
=
$bargain_data
[
'trade_type'
];
$insert_data
[
'submit_agent_id'
]
=
$submit_agent_id
;
$insert_data
[
'submit_agent_name'
]
=
$bargain_data
[
'submit_agent_name'
];
$insert_data
[
'price'
]
=
$bargain_data
[
'price'
];
$insert_data
[
'commission'
]
=
$bargain_data
[
'commission'
];
$insert_data
[
'status'
]
=
$bargain_data
[
'status'
];
$insert_data
[
'source'
]
=
$bargain_data
[
'source'
];
$insert_data
[
'role'
]
=
$role
;
$insert_data
[
'scale_fee'
]
=
$scale_fee
;
$insert_data
[
'scale'
]
=
$scale
;
$insert_data
[
'is_commission'
]
=
1
;
$insert_data
[
'is_open'
]
=
$bargain_data
[
'is_open'
];
$insert_data
[
'house_number'
]
=
$bargain_data
[
'house_number'
];
$insert_data
[
'account_statement'
]
=
$bargain_data
[
'account_statement'
];
$insert_data
[
'is_commission'
]
=
$bargain_data
[
'is_commission'
];
$insert_data
[
'content'
]
=
$bargain_data
[
'content'
];
$result
=
$this
->
insert
(
$insert_data
);
if
(
$result
==
1
)
{
$this
->
commit
();
}
else
{
$this
->
rollback
();
$result
=
false
;
}
}
return
$result
;
}
}
\ No newline at end of file
application/route.php
View file @
2709e290
...
...
@@ -102,6 +102,7 @@ Route::group('index', [
'addHousesAgentsDish'
=>
[
'index/broker/AddHousesAgents'
,
[
'method'
=>
'POST'
]],
//新增楼盘与经纪人关系(盘方)
'delTohouses'
=>
[
'index/broker/delTohouses'
,
[
'method'
=>
'POST'
]],
//解除经纪人和楼盘关系
'getAgentsTohouses'
=>
[
'index/broker/getAgentsTohouses'
,
[
'method'
=>
'GET'
]],
//获取经纪人和楼盘关系信息
'getAgentDistrictStore'
=>
[
'index/broker/getAgentDistrictStore'
,
[
'method'
=>
'GET'
]],
//获取经纪人id获取部门门店名称
'batchChangDish'
=>
[
'index/houses/batchChangDish'
,
[
'method'
=>
'post'
]
],
//批量修改盘方
//版本管理
...
...
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