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
c7c5034e
Commit
c7c5034e
authored
Jan 24, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增、解除经纪人和楼盘关系
parent
efab9ff8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
0 deletions
+134
-0
Broker.php
application/index/controller/Broker.php
+63
-0
GHousesToAgents.php
application/model/GHousesToAgents.php
+69
-0
route.php
application/route.php
+2
-0
No files found.
application/index/controller/Broker.php
View file @
c7c5034e
...
@@ -12,6 +12,7 @@ namespace app\index\controller;
...
@@ -12,6 +12,7 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\AAgents
;
use
app\model\Agents
;
use
app\model\Agents
;
use
app\model\GHousesToAgents
;
class
Broker
extends
Basic
class
Broker
extends
Basic
{
{
...
@@ -80,4 +81,65 @@ class Broker extends Basic
...
@@ -80,4 +81,65 @@ class Broker extends Basic
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
/**
* 添加经纪人与楼盘关系
*
* @return \think\Response
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
AddHousesAgents
()
{
$data
[
'status'
]
=
200
;
$data
[
'data'
]
=
''
;
$data
[
'msg'
]
=
''
;
$params
=
$this
->
request
->
param
();
if
(
$params
[
'houses_id'
])
{
$hg
=
new
GHousesToAgents
();
switch
(
$params
[
'type'
])
{
case
1
:
$res
=
$hg
->
addAgents
(
$params
[
'phone'
],
$params
[
'houses_id'
],
$params
[
'type'
]);
break
;
case
2
:
$res
=
$hg
->
addAgents
(
$params
[
'phone'
],
$params
[
'houses_id'
],
$params
[
'type'
]);
break
;
default
:
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
'type is null'
;
}
if
(
!
count
(
$res
)
>
0
)
{
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'Data already exists'
;
}
}
else
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
'houses_id is null'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 解除经纪人和楼盘关系
*
* @return \think\Response
*/
public
function
delTohouses
()
{
$data
[
'status'
]
=
200
;
$data
[
'data'
]
=
''
;
$data
[
'msg'
]
=
''
;
$params
=
$this
->
request
->
param
();
if
(
$params
[
'id'
])
{
$hg
=
new
GHousesToAgents
();
$hg
->
del
(
$params
[
'id'
]);
}
else
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
'id is null'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
}
\ No newline at end of file
application/model/GHousesToAgents.php
0 → 100644
View file @
c7c5034e
<?php
namespace
app\model
;
use
think\Model
;
class
GHousesToAgents
extends
BaseModel
{
protected
$table
=
'g_houses_to_agents'
;
protected
$date
=
''
;
public
function
__construct
()
{
$this
->
date
=
date
(
'Y-m-d H:i:s'
);
}
/**
* @param $data
* @param $houses_id
* @param $type 案场权限人:0,盘方:1,独家:2
* @return array|false|int
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
addAgents
(
$data
,
$houses_id
,
$type
){
$agent_arr
=
array
();
$data
=
array_unique
(
$data
);
foreach
(
$data
as
$k
=>
$v
)
{
$arr
=
explode
(
'-'
,
$v
);
if
(
count
(
$arr
)
==
3
)
{
$check
=
$this
->
where
([
'houses_id'
=>
$houses_id
,
'agents_id'
=>
$arr
[
'0'
],
'is_del'
=>
0
,
'type'
=>
$type
])
->
find
();
if
(
$check
)
{
continue
;
}
$agent_arr
[
$k
][
'agents_id'
]
=
$arr
[
'0'
];
$agent_arr
[
$k
][
'houses_id'
]
=
$houses_id
;
$agent_arr
[
$k
][
'type'
]
=
$type
;
$agent_arr
[
$k
][
'create_time'
]
=
$this
->
date
;
$agent_arr
[
$k
][
'update_time'
]
=
$this
->
date
;
}
}
$res
=
$this
->
saveAll
(
$agent_arr
);
return
$res
;
}
/**
* 解除经纪人和楼盘关系
*
* @param $id
* @return bool|false|int
*/
public
function
del
(
$id
)
{
if
(
$id
)
{
$res
=
$this
->
save
([
'is_del'
=>
1
],[
'id'
=>
$id
]);
}
else
{
$res
=
false
;
}
return
$res
;
}
}
application/route.php
View file @
c7c5034e
...
@@ -67,6 +67,8 @@ Route::group('index', [
...
@@ -67,6 +67,8 @@ Route::group('index', [
//查询经纪人
//查询经纪人
'getBroker'
=>
[
'index/broker/getBroker'
,[
'method'
=>
'get'
]],
'getBroker'
=>
[
'index/broker/getBroker'
,[
'method'
=>
'get'
]],
'getBroker_new'
=>
[
'index/broker/getBroker_new'
,[
'method'
=>
'get'
]],
'getBroker_new'
=>
[
'index/broker/getBroker_new'
,[
'method'
=>
'get'
]],
'addHousesAgents'
=>
[
'index/broker/AddHousesAgents'
,
[
'method'
=>
'POST'
]],
//新增楼盘与经纪人关系
'delTohouses'
=>
[
'index/broker/delTohouses'
,
[
'method'
=>
'POST'
]],
//解除经纪人和楼盘关系
//版本管理
//版本管理
'version'
=>
[
'index/version/index'
,[
'method'
=>
'get'
]],
'version'
=>
[
'index/version/index'
,[
'method'
=>
'get'
]],
...
...
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