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
370ea896
Commit
370ea896
authored
Mar 15, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app添加商铺
parent
efea196f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
Shop.php
application/api_broker/controller/Shop.php
+39
-0
Houses.php
application/index/controller/Houses.php
+1
-0
GHouses.php
application/model/GHouses.php
+2
-2
No files found.
application/api_broker/controller/Shop.php
View file @
370ea896
...
...
@@ -226,4 +226,43 @@ class Shop extends Basic
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
}
/**
* 新增和编辑商铺
*
* @return \think\Response
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public
function
edit
()
{
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
''
;
$result
[
'data'
]
=
[];
if
(
$this
->
request
->
isPost
())
{
$this
->
gHousesModel
->
startTrans
();
$this
->
params
[
'userId'
]
=
$this
->
agentId
;
$house_id
=
$this
->
gHousesModel
->
add
(
$this
->
params
);
//添加或编辑商铺
if
(
$house_id
)
{
$this
->
gHousesModel
->
commit
();
$result
[
'data'
][
'house_id'
]
=
$house_id
;
}
else
{
$this
->
gHousesModel
->
rollback
();
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Add houses failure'
;
}
}
else
{
if
(
empty
(
$this
->
params
[
'id'
]))
{
//获取商铺详情
$result
[
'data'
]
=
$this
->
gHousesModel
->
getHouseById
(
$this
->
params
[
'id'
]);
}
else
{
$result
[
'code'
]
=
101
;
$result
[
'msg'
]
=
'Id is null'
;
}
}
return
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$result
[
'data'
]);;
}
}
application/index/controller/Houses.php
View file @
370ea896
...
...
@@ -47,6 +47,7 @@ class Houses extends Basic
if
(
$this
->
request
->
isPost
())
{
$this
->
house
->
startTrans
();
$this
->
params
[
'userId'
]
=
$this
->
userId
;
$house_id
=
$this
->
house
->
add
(
$this
->
params
);
//添加或编辑商铺
if
(
$house_id
)
{
$this
->
house
->
commit
();
...
...
application/model/GHouses.php
View file @
370ea896
...
...
@@ -269,11 +269,11 @@ class GHouses extends BaseModel
//新增或编辑
if
(
$params
[
'id'
]
==
''
)
{
$params
[
'upload_id'
]
=
Session
::
get
(
'userId'
)
;
$params
[
'upload_id'
]
=
$params
[
'userId'
]
;
$this
->
allowField
(
true
)
->
save
(
$params
);
$house_id
=
$this
->
id
;
}
else
{
$params
[
'operation_id'
]
=
Session
::
get
(
'userId'
)
;
$params
[
'operation_id'
]
=
$params
[
'userId'
]
;
$this
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]
]);
$house_id
=
$this
->
id
;
}
...
...
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