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
bea8e483
Commit
bea8e483
authored
Jan 23, 2018
by
刘丹
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test-hujun1.15' into test-hujun1.15-dan1.22
parents
290cc4b7
1e68107a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
367 additions
and
28 deletions
+367
-28
common.php
application/index/common.php
+6
-0
Auth.php
application/index/controller/Auth.php
+66
-7
BusinessDistrict.php
application/index/controller/BusinessDistrict.php
+3
-0
Houses.php
application/index/controller/Houses.php
+137
-12
index.html
application/index/view/auth/index.html
+4
-0
navigation.html
application/index/view/global/navigation.html
+1
-1
BaseModel.php
application/model/BaseModel.php
+23
-0
GHouses.php
application/model/GHouses.php
+124
-6
route.php
application/route.php
+3
-2
No files found.
application/index/common.php
View file @
bea8e483
<?php
//打印
function
prt
(
$arr
){
echo
'<pre/>'
;
print_r
(
$arr
);
}
\ No newline at end of file
application/index/controller/Auth.php
View file @
bea8e483
...
...
@@ -12,6 +12,8 @@ use app\index\extend\Basic;
use
app\model\AuthGroup
;
class
Auth
extends
Basic
{
/**
* 权限列表页
*
...
...
@@ -21,12 +23,6 @@ class Auth extends Basic
return
view
(
'index'
);
}
/**
* 角色编辑
*/
public
function
roleedit
()
{
return
view
(
'roleedit'
);
}
/**
* 权限分配
...
...
@@ -57,8 +53,70 @@ class Auth extends Basic
$where
=
'status <> 0'
;
$data
[
'list'
]
=
$auth_group
->
getList
(
$pageNo
,
$pageSize
,
''
,
'*'
,
$where
);
$data
[
'total'
]
=
$auth_group
->
getTotal
(
$where
);
return
$this
->
response
(
200
,
''
,
$data
);
}
/**
* 角色编辑
*/
public
function
roleedit
()
{
//$this->assign('type','1');
// return $this->display();
return
view
(
'roleedit'
);
}
/**
* 验证数据
* @param string $validate 验证器名或者验证规则数组
* @param array $data [description]
* @return [type] [description]
*/
protected
function
validateData
(
$data
,
$validate
)
{
if
(
!
$validate
||
empty
(
$data
))
return
false
;
$result
=
$this
->
validate
(
$data
,
$validate
);
if
(
true
!==
$result
){
// 验证失败 输出错误信息
return
$result
;
}
return
1
;
}
//添加角色
public
function
addAuth
(
$group_id
=
0
){
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
$title
=
$group_id
?
'编辑'
:
'新增'
;
$table
=
New
AuthGroup
();
$info
=
$table
->
find
();
if
(
empty
(
$group_id
))
{
$data
=
input
(
'post.'
);
$err
=
$this
->
validateData
(
$data
,
[
[
'title'
,
'require|chsAlpha'
,
'用户组名称不能为空|用户组名称只能是汉字和字母'
],
[
'description'
,
'chsAlphaNum'
,
'描述只能是汉字字母数字'
]
]
);
if
(
$err
!=
1
){
return
$this
->
response
(
100
,
$err
);
}
$id
=
isset
(
$data
[
'id'
])
&&
$data
[
'id'
]
>
0
?
$data
[
'id'
]
:
false
;
if
(
$table
->
editData
(
$data
,
$id
))
{
return
$this
->
response
(
200
,
'成功'
);
}
else
{
return
$this
->
response
(
101
,
'失败'
);
}
}
else
{
return
$this
->
response
(
200
,
$title
,
$info
);
}
}
}
\ No newline at end of file
application/index/controller/BusinessDistrict.php
View file @
bea8e483
...
...
@@ -111,6 +111,9 @@ class BusinessDistrict extends Basic
* 获取省市区数据
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
regions
()
{
$code
=
$this
->
request
->
get
(
'code'
);
...
...
application/index/controller/Houses.php
View file @
bea8e483
...
...
@@ -13,11 +13,19 @@ use app\index\extend\Basic;
use
app\model\GHouses
;
use
app\model\GHousesExt
;
use
app\model\GHousesImgs
;
use
app\model\HouseInfos
;
use
think\Request
;
class
Houses
extends
Basic
{
protected
$house
;
public
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
house
=
new
GHouses
();
}
public
function
index
()
{
return
view
(
'houseList'
);
}
...
...
@@ -40,14 +48,14 @@ class Houses extends Basic
$params
[
'update_time'
]
=
$date
;
}
$house
=
new
GHouses
();
$house
->
startTrans
();
$
this
->
house
->
startTrans
();
//新增或编辑
if
(
$params
[
'id'
]
==
''
)
{
$house_id
=
$house
->
allowField
(
true
)
->
save
(
$params
);
$house_id
=
$
this
->
house
->
allowField
(
true
)
->
save
(
$params
);
}
else
{
$house_id
=
$house
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]]);
$house_id
=
$
this
->
house
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]]);
}
$params
[
'house_id'
]
=
$house_id
;
$house_ext
=
new
GHousesExt
();
...
...
@@ -73,10 +81,10 @@ class Houses extends Basic
}
/***保存图片 hujun 2018.1.19 end***/
if
(
$house_id
)
{
$house
->
commit
();
$
this
->
house
->
commit
();
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
]);
}
else
{
$house
->
rollback
();
$
this
->
house
->
rollback
();
$return
=
$this
->
response
(
101
,
$result
[
'msg'
]);
}
}
elseif
(
$params
[
'id'
]){
...
...
@@ -94,9 +102,12 @@ class Houses extends Basic
}
/**
*
获取商铺
列表
*
楼盘
列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseList
()
{
$data
[
'status'
]
=
200
;
...
...
@@ -105,15 +116,128 @@ class Houses extends Basic
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$house
=
new
GHouses
();
$where
=
'status <> 2'
;
$fields
=
''
;
$data
[
'data'
][
'list'
]
=
$house
->
getHouseList
(
$pageNo
,
$pageSize
,
'id DESC'
,
$fields
,
$where
);
$data
[
'data'
][
'total'
]
=
$house
->
getTotal
(
$where
);
/*精选商铺--0是1否*/
if
(
$params
[
'is_carefully_chosen'
]
!=
NULL
)
{
$where
[
'is_carefully_chosen'
]
=
$params
[
'is_carefully_chosen'
];
}
/*0是1否显示在c端用户*/
if
(
$params
[
'is_show'
]
!=
NULL
)
{
$where
[
'is_show'
]
=
$params
[
'is_show'
];
}
/*商铺类型(0商场,1街铺)*/
if
(
$params
[
'shop_type'
]
!=
NULL
)
{
$where
[
'shop_type'
]
=
$params
[
'shop_type'
];
}
/*所在城市*/
if
(
$params
[
'city'
]
!=
NULL
)
{
$where
[
'city'
]
=
$params
[
'city'
];
}
/*所在区*/
if
(
$params
[
'disc'
]
!=
NULL
)
{
$where
[
'disc'
]
=
$params
[
'disc'
];
}
/*状态 0待审批 1上架 2下架 3回收*/
if
(
$params
[
'status'
]
!=
NULL
)
{
$where
[
'status'
]
=
$params
[
'status'
];
}
/*价格 -1表示营业额扣点 存分*/
if
(
$params
[
'rent_price'
]
!=
NULL
)
{
switch
(
$params
[
'rent_price'
])
{
case
1
:
$where
[
'rent_price'
]
=
[
'>'
,
10000
];
break
;
case
2
:
$where
[
'rent_price'
]
=
[
'between'
,
'10000,30000'
];
break
;
default
:
$where
[
'rent_price'
]
=
[
'>'
,
'30000'
];
}
}
/*对内楼盘名*/
if
(
$params
[
'internal_title'
]
!=
NULL
)
{
$where
[
'internal_title'
]
=
[
'LIKE'
,
$params
[
'internal_title'
]
.
'%'
];
}
/*是否独家0否1是*/
if
(
$params
[
'is_exclusive_type'
]
!=
NULL
)
{
$where
[
'is_exclusive_type'
]
=
[
'LIKE'
,
$params
[
'is_exclusive_type'
]
.
'%'
];
}
/*开始时间*/
if
(
$params
[
'start_date'
]
!=
NULL
)
{
$where
[
'create_time'
]
=
[
'> time'
,
$params
[
'start_date'
]
.
' 00:00:00'
];
}
/*结束时间*/
if
(
$params
[
'end_date'
]
!=
NULL
)
{
$where
[
'create_time'
]
=
[
'< time'
,
$params
[
'end_date'
]
.
' 23:59:59'
];
}
/*开始结束时间*/
if
(
$params
[
'start_date'
]
!=
NULL
&&
$params
[
'end_date'
]
!=
NULL
)
{
$where
[
'create_time'
]
=
[
'between time'
,[
$params
[
'start_date'
]
.
' 00:00:00'
],
$params
[
'end_date'
]
.
' 23:59:59'
];
}
/*根据库存判断是否已租*/
if
(
$params
[
'leased'
]
!=
NULL
)
{
if
(
$params
[
'leased'
]
==
0
)
{
$where
[
'residue_num'
]
=
0
;
}
else
{
$where
[
'residue_num'
]
=
[
'<>'
,
0
];
}
}
/*业态*/
if
(
$params
[
'industry_type'
]
!=
NULL
)
{
$where
[
'industry_type'
]
=
[
'LIKE'
,
$params
[
'industry_type'
]
.
'%'
];
}
if
(
empty
(
$params
[
'dish'
]))
{
/*楼盘编号*/
if
(
$params
[
'id'
]
!=
NULL
)
{
$where
[
'id'
]
=
$params
[
'id'
];
}
$where
[
'status'
]
=
[
'<>'
,
2
];
$data
[
'data'
][
'list'
]
=
$this
->
house
->
getHouseList
(
$pageNo
,
$pageSize
,
'id DESC'
,
$fields
,
$where
);
$data
[
'data'
][
'total'
]
=
$this
->
house
->
getTotal
(
$where
);
}
else
{
/*楼盘编号*/
if
(
$params
[
'id'
]
!=
NULL
)
{
$where
[
'a.id'
]
=
$params
[
'id'
];
}
$where
[
'a.status'
]
=
[
'<>'
,
2
];
$where
[
'c.name'
]
=
[
'LIKE'
,
$params
[
'dish'
]
.
'%'
];
$data
[
'data'
][
'list'
]
=
$this
->
house
->
getHouseListDish
(
$pageNo
,
$pageSize
,
'a.id DESC'
,
$fields
,
$where
);
$data
[
'data'
][
'total'
]
=
$this
->
house
->
getHouseListDishTotal
(
$where
);
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 伪删除商铺
*
* @return \think\Response
*/
public
function
del
()
{
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
''
;
$params
=
$this
->
request
->
param
();
if
(
$params
[
'id'
])
{
$this
->
house
->
isUpdate
(
true
)
->
save
([
'status'
=>
3
],[
'id'
=>
$params
[
'id'
]]);
$data
[
'msg'
]
=
'successfully deleted'
;
}
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/index/view/auth/index.html
View file @
bea8e483
{layout name="global/frame_tpl" /}
<h4>
权限管理
</h4>
<a
href=
"/index/roleedit"
>
添加角色
</a>
<input
type=
"hidden"
class=
"page-load"
id=
"auth"
/>
<div
id=
"page-content-wrapper"
>
<div
class=
"container"
>
...
...
application/index/view/global/navigation.html
View file @
bea8e483
...
...
@@ -57,7 +57,7 @@
<div
class=
"successModel"
>
<div
class=
"successModel-center"
>
<p>
提交成功!
<!--提交成功!-->
</p>
</div>
</div>
...
...
application/model/BaseModel.php
View file @
bea8e483
...
...
@@ -24,6 +24,29 @@ class BaseModel extends Model
return
$this
->
where
(
$params
)
->
count
();
}
/**
* 新增或编辑数据
* @param array/object $data 来源数据
* @param boolean $kv 主键值
* @param string $key 主键名
* @return [type] 执行结果
*/
public
function
editData
(
$data
,
$kv
=
false
,
$key
=
'id'
,
$confirm
=
false
)
{
$this
->
allowField
(
true
);
if
(
$confirm
)
{
//是否验证
$this
->
validate
(
$confirm
);
}
if
(
$kv
){
//编辑
$res
=
$this
->
save
(
$data
,[
$key
=>
$kv
]);
}
else
{
$res
=
$this
->
data
(
$data
)
->
save
();
}
return
$res
;
}
/**
* 列表
*
...
...
application/model/GHouses.php
View file @
bea8e483
...
...
@@ -3,7 +3,6 @@
namespace
app\model
;
use
think\Db
;
class
GHouses
extends
BaseModel
...
...
@@ -22,12 +21,11 @@ class GHouses extends BaseModel
public
function
getHouseById
(
$id
)
{
$fields
=
'a.*,b.fee_rule,internal_item_advantage,external_item_advantage,tiny_brochure_url,auditorium,traffic,
enter_num,do_business_date,start_business_date,singn_rule,landlord_phone'
;
$data
=
$this
->
alias
(
'a'
)
->
field
(
$fields
)
$
select_
data
=
$this
->
alias
(
'a'
)
->
field
(
$fields
)
->
join
(
'g_houses_ext b'
,
'a.id = b.house_id'
,
'left'
)
->
where
(
'a.id'
,
$id
)
->
find
();
$data
=
$data
->
toArray
();
$data
=
$select_data
->
getData
();
$img
=
new
GHousesImgs
();
$img_data
=
$img
->
field
(
'id,img_type,img_name'
)
->
where
(
'img_status = 0 AND house_id = '
.
$id
)
...
...
@@ -66,11 +64,131 @@ class GHouses extends BaseModel
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$house_id
=
array
();
foreach
(
$data
as
$k
=>
$v
)
{
$house_id
[
$k
]
=
$v
[
'id'
];
}
$result
=
array
();
if
(
empty
(
$house_id
))
{
$result
=
$data
;
}
else
{
/*案场权限人*/
$house_agents
=
Db
::
table
(
'g_houses_to_agents'
)
->
alias
(
'a'
)
->
field
(
'a.houses_id,b.id,b.name,b.phone'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.houses_id'
,
'IN'
,
implode
(
','
,
$house_id
))
->
select
();
/*盘方*/
$house_dish
=
Db
::
table
(
'g_houses_dish'
)
->
alias
(
'a'
)
->
field
(
'a.houses_id,b.id,b.name,b.phone'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.houses_id'
,
'IN'
,
implode
(
','
,
$house_id
))
->
select
();
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
]
=
$v
->
toArray
();
foreach
(
$house_agents
as
$k2
=>
$v2
)
{
if
(
$v
->
id
==
$v2
[
'houses_id'
])
{
$result
[
$k
][
'agents_name'
][
$k2
][
'id'
]
=
$v2
[
'id'
];
$result
[
$k
][
'agents_name'
][
$k2
][
'name'
]
=
$v2
[
'name'
];
$result
[
$k
][
'agents_name'
][
$k2
][
'phone'
]
=
$v2
[
'phone'
];
}
}
foreach
(
$house_dish
as
$k3
=>
$v3
)
{
if
(
$v
->
id
==
$v3
[
'houses_id'
])
{
$result
[
$k
][
'dish_name'
][
$k3
][
'id'
]
=
$v3
[
'id'
];
$result
[
$k
][
'dish_name'
][
$k3
][
'name'
]
=
$v3
[
'name'
];
$result
[
$k
][
'dish_name'
][
$k3
][
'phone'
]
=
$v3
[
'phone'
];
}
}
}
}
return
$result
;
}
/**
* 查询属于盘方的商铺列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return array|false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseListDish
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'g_houses_dish b'
,
'a.id=b.houses_id'
,
'left'
)
->
join
(
'a_agents c'
,
'b.agents_id=c.id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
$house_id
=
array
();
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
]
=
$v
->
getData
();
$rsult
[
$k
][
'dish'
]
=
Db
::
table
(
'g_houses_to_agents'
)
->
where
(
'houses_id'
,
$result
[
$k
][
'house_id'
])
->
select
();
$house_id
[
$k
]
=
$v
[
'id'
];
}
$result
=
array
();
if
(
empty
(
$house_id
))
{
$result
=
$data
;
}
else
{
/*案场权限人*/
$house_agents
=
Db
::
table
(
'g_houses_to_agents'
)
->
alias
(
'a'
)
->
field
(
'a.houses_id,b.id,b.name,b.phone'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.houses_id'
,
'IN'
,
implode
(
','
,
$house_id
))
->
select
();
/*盘方*/
$house_dish
=
Db
::
table
(
'g_houses_dish'
)
->
alias
(
'a'
)
->
field
(
'a.houses_id,b.id,b.name,b.phone'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.houses_id'
,
'IN'
,
implode
(
','
,
$house_id
))
->
select
();
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
]
=
$v
->
toArray
();
foreach
(
$house_agents
as
$k2
=>
$v2
)
{
if
(
$v
->
id
==
$v2
[
'houses_id'
])
{
$result
[
$k
][
'agents_name'
][
$k2
][
'id'
]
=
$v2
[
'id'
];
$result
[
$k
][
'agents_name'
][
$k2
][
'name'
]
=
$v2
[
'name'
];
$result
[
$k
][
'agents_name'
][
$k2
][
'phone'
]
=
$v2
[
'phone'
];
}
}
foreach
(
$house_dish
as
$k3
=>
$v3
)
{
if
(
$v
->
id
==
$v3
[
'houses_id'
])
{
$result
[
$k
][
'dish_name'
][
$k3
][
'id'
]
=
$v3
[
'id'
];
$result
[
$k
][
'dish_name'
][
$k3
][
'name'
]
=
$v3
[
'name'
];
$result
[
$k
][
'dish_name'
][
$k3
][
'phone'
]
=
$v3
[
'phone'
];
}
}
}
}
return
$result
;
}
/**
* 查询属于盘方的商铺列表总记录数
*
* @param string $params
* @return int|string
*/
public
function
getHouseListDishTotal
(
$params
=
''
)
{
$data
=
$this
->
alias
(
'a'
)
->
join
(
'g_houses_dish b'
,
'a.id=b.houses_id'
,
'left'
)
->
join
(
'a_agents c'
,
'b.agents_id=c.id'
,
'left'
)
->
where
(
$params
)
->
count
();
return
$data
;
}
}
application/route.php
View file @
bea8e483
...
...
@@ -75,6 +75,7 @@ Route::group('index', [
'addVersion'
=>
[
'index/version/addVersion'
,[
'method'
=>
'post'
]],
'getAuth'
=>
[
'index/auth/getAuth'
,
[
'method'
=>
'get'
]],
//权限列表
'access'
=>
[
'index/auth/access'
,
[
'method'
=>
'get'
]],
//权限分配
'addAuth'
=>
[
'index/auth/addAuth'
,
[
'method'
=>
'post'
]],
//添加角色
'roleedit'
=>
[
'index/auth/roleedit'
,
[
'method'
=>
'get'
]],
//编辑角色
'accessUser'
=>
[
'index/auth/accessUser'
,
[
'method'
=>
'get'
]],
//成员授权
'BusinessDistrict'
=>
[
'index/BusinessDistrict/index'
,
[
'method'
=>
'get'
]],
//商圈列表
...
...
@@ -83,9 +84,9 @@ Route::group('index', [
'BusinessList'
=>
[
'index/BusinessDistrict/getBusiness'
,
[
'method'
=>
'get'
]],
//获取商铺列表数据
'houseList'
=>
[
'index/Houses/index'
,
[
'method'
=>
'get'
]],
//商铺列表
'houseEdit'
=>
[
'index/Houses/edit'
,
[
'method'
=>
'get|post'
]],
//编辑商铺
'houseDel'
=>
[
'index/Houses/del'
,
[
'method'
=>
'
ge
t'
]],
//删除商铺
'houseDel'
=>
[
'index/Houses/del'
,
[
'method'
=>
'
pos
t'
]],
//删除商铺
'regions'
=>
[
'index/BusinessDistrict/regions'
,
[
'method'
=>
'get'
]],
//获取省市区数据
'getHouseList'
=>
[
'index/houses/getHouseList'
,
[
'method'
=>
'get'
]]
'getHouseList'
=>
[
'index/houses/getHouseList'
,
[
'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