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
6df84c14
Commit
6df84c14
authored
Jan 19, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑商铺
parent
c082d4a3
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
190 additions
and
4 deletions
+190
-4
BusinessDistrict.php
application/index/controller/BusinessDistrict.php
+5
-0
Houses.php
application/index/controller/Houses.php
+141
-2
GHouses.php
application/model/GHouses.php
+10
-0
GHousesExt.php
application/model/GHousesExt.php
+16
-0
GHousesImgs.php
application/model/GHousesImgs.php
+16
-0
route.php
application/route.php
+2
-2
No files found.
application/index/controller/BusinessDistrict.php
View file @
6df84c14
...
@@ -65,6 +65,11 @@ class BusinessDistrict extends Basic
...
@@ -65,6 +65,11 @@ class BusinessDistrict extends Basic
}
}
}
}
/**
* 删除商圈
*
* @return \think\Response
*/
public
function
del
()
{
public
function
del
()
{
$result
[
'code'
]
=
200
;
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
''
;
$result
[
'msg'
]
=
''
;
...
...
application/index/controller/Houses.php
View file @
6df84c14
...
@@ -9,14 +9,153 @@
...
@@ -9,14 +9,153 @@
namespace
app\index\controller
;
namespace
app\index\controller
;
class
Houses
use
app\index\extend\Basic
;
use
app\model\GHouses
;
use
app\model\GHousesExt
;
use
app\model\GHousesImgs
;
class
Houses
extends
Basic
{
{
public
function
index
()
{
public
function
index
()
{
return
view
(
'index'
);
return
view
(
'index'
);
}
}
/**
* 新增商铺
*
* @return \think\response\View
* @throws \Exception
* @throws \think\exception\PDOException
*/
public
function
edit
()
{
public
function
edit
()
{
return
view
(
'edit'
);
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
''
;
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
param
();
$date
=
date
(
'Y-m-d H:i:s'
);
if
(
$params
[
'id'
])
{
$params
[
'update_time'
]
=
$date
;
}
else
{
$params
[
'create_time'
]
=
$date
;
$params
[
'update_time'
]
=
$date
;
}
$house
=
new
GHouses
();
$house
->
startTrans
();
//新增或编辑
if
(
$params
[
'id'
]
==
''
)
{
$house
->
allowField
(
true
)
->
save
(
$params
);
}
else
{
$house
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]]);
}
$params
[
'house_id'
]
=
$house
->
id
;
$house_ext
=
new
GHousesExt
();
if
(
$params
[
'start_business_date'
])
{
$params
[
'start_business_date'
]
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$params
[
'start_business_date'
]));
}
//新增或编辑根据id
if
(
$params
[
'id'
]
==
''
)
{
$house_ext
->
allowField
(
true
)
->
save
(
$params
);
}
else
{
$house_ext_data
=
$house_ext
->
field
(
'id'
)
->
where
(
'house_id'
,
$params
[
'id'
])
->
find
();
$house_ext
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$house_ext_data
[
'id'
]]);
}
/***保存图片 hujun 2018.1.19 start***/
$house_img
=
new
GHousesImgs
();
//新增图片
if
(
$params
[
'id'
]
!=
''
)
{
//编辑图片
$house_img_data
=
$house_img
->
field
(
'id,img_name,img_type'
)
->
where
(
'img_type <> 6 AND house_id = '
.
$params
[
'id'
])
->
select
();
$count
=
0
;
foreach
(
$house_img_data
as
$k
=>
$v
)
{
if
(
$v
->
img_type
==
1
&&
$v
->
img_name
==
$params
[
'cover'
])
{
$house_img_edit
[
'0'
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
'0'
][
'img_type'
]
=
5
;
$params
[
'cover'
]
=
0
;
//删除重复的数据
$count
=
1
;
}
foreach
(
$params
[
'slideshow'
]
as
$kk
=>
$vv
)
{
if
(
$v
->
img_type
==
2
&&
$v
->
img_name
==
$vv
)
{
unset
(
$params
[
'slideshow'
][
$kk
]);
$kk
+=
$count
;
$house_img_edit
[
$kk
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$kk
][
'img_type'
]
=
5
;
$params
[
'cover'
]
=
0
;
}
}
}
$house_img
->
isUpdate
(
true
)
->
saveAll
(
$house_img_edit
);
}
$count
=
0
;
$insert_img
=
array
();
//1列表页封面图
if
(
$params
[
'cover'
])
{
$insert_img
[
'0'
][
'house_id'
]
=
$house
->
id
;
$insert_img
[
'0'
][
'img_type'
]
=
1
;
$insert_img
[
'0'
][
'img_name'
]
=
$params
[
'cover'
];
$insert_img
[
'0'
][
'create_time'
]
=
$params
[
'create_time'
];
$insert_img
[
'0'
][
'update_time'
]
=
$params
[
'update_time'
];
$count
=
count
(
$insert_img
)
+
1
;
}
//2详情页轮播图
if
(
$params
[
'slideshow'
])
{
foreach
(
$params
[
'slideshow'
]
as
$k
=>
$v
)
{
$k
+=
$count
;
$insert_img
[
$k
][
'house_id'
]
=
$house
->
id
;
$insert_img
[
$k
][
'img_type'
]
=
2
;
$insert_img
[
$k
][
'img_name'
]
=
$v
;
$insert_img
[
$k
][
'create_time'
]
=
$params
[
'create_time'
];
$insert_img
[
$k
][
'update_time'
]
=
$params
[
'update_time'
];
}
if
(
count
(
$insert_img
)
>
0
)
{
$count
=
count
(
$insert_img
)
+
1
;
}
}
//3楼层平面图
if
(
$params
[
'plan'
])
{
foreach
(
$params
[
'plan'
]
as
$kk
=>
$vv
)
{
$kk
+=
$count
;
$insert_img
[
$kk
][
'house_id'
]
=
$house
->
id
;
$insert_img
[
$kk
][
'img_type'
]
=
3
;
$insert_img
[
$kk
][
'img_name'
]
=
$vv
;
$insert_img
[
$kk
][
'create_time'
]
=
$params
[
'create_time'
];
$insert_img
[
$kk
][
'update_time'
]
=
$params
[
'update_time'
];
}
}
$house_img
->
saveAll
(
$insert_img
);
/***保存图片 hujun 2018.1.19 end***/
if
(
$house
->
id
&&
count
(
$house_img
)
>
0
&&
$house_ext
->
id
)
{
$house
->
commit
();
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
]);
}
else
{
$house
->
rollback
();
$return
=
$this
->
response
(
101
,
$result
[
'msg'
]);
}
}
elseif
(
$this
->
request
->
param
(
'id'
)){
$house
=
new
GHouses
();
$result
[
'data'
]
=
$house
->
find
();
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$result
[
'data'
]);
}
else
{
$return
=
view
(
'edit'
);
}
return
$return
;
}
}
public
function
del
()
{
public
function
del
()
{
...
...
application/model/GHouses.php
0 → 100644
View file @
6df84c14
<?php
namespace
app\model
;
class
GHouses
extends
BaseModel
{
protected
$table
=
'g_houses'
;
}
application/model/GHousesExt.php
0 → 100644
View file @
6df84c14
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/1/18
* Time: 17:39
*/
namespace
app\model
;
class
GHousesExt
extends
BaseModel
{
protected
$table
=
'g_houses_ext'
;
}
\ No newline at end of file
application/model/GHousesImgs.php
0 → 100644
View file @
6df84c14
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/1/19
* Time: 11:33
*/
namespace
app\model
;
class
GHousesImgs
extends
BaseModel
{
protected
$table
=
'g_houses_imgs'
;
}
\ No newline at end of file
application/route.php
View file @
6df84c14
...
@@ -81,9 +81,9 @@ Route::group('index', [
...
@@ -81,9 +81,9 @@ Route::group('index', [
'delBusinessDistrict'
=>
[
'index/BusinessDistrict/del'
,
[
'method'
=>
'post'
]],
//删除商圈列表
'delBusinessDistrict'
=>
[
'index/BusinessDistrict/del'
,
[
'method'
=>
'post'
]],
//删除商圈列表
'BusinessList'
=>
[
'index/BusinessDistrict/getBusiness'
,
[
'method'
=>
'get'
]],
//获取商铺列表数据
'BusinessList'
=>
[
'index/BusinessDistrict/getBusiness'
,
[
'method'
=>
'get'
]],
//获取商铺列表数据
'houseList'
=>
[
'index/Houses/index'
,
[
'method'
=>
'get'
]],
//商铺列表
'houseList'
=>
[
'index/Houses/index'
,
[
'method'
=>
'get'
]],
//商铺列表
'houseEdit'
=>
[
'index/Houses/edit'
,
[
'method'
=>
'get'
]],
//编辑商铺
'houseEdit'
=>
[
'index/Houses/edit'
,
[
'method'
=>
'get
|post
'
]],
//编辑商铺
'houseDel'
=>
[
'index/Houses/del'
,
[
'method'
=>
'get'
]],
//删除商铺
'houseDel'
=>
[
'index/Houses/del'
,
[
'method'
=>
'get'
]],
//删除商铺
'regions'
=>
[
'index/BusinessDistrict/regions'
,
[
'method'
=>
'get'
]],
//
删除商铺
'regions'
=>
[
'index/BusinessDistrict/regions'
,
[
'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