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
b87e86ef
Commit
b87e86ef
authored
Apr 18, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
委托找铺
parent
55efd415
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
230 additions
and
0 deletions
+230
-0
FindShop.php
application/api/controller/FindShop.php
+83
-0
FindShopValidate.php
application/api/validate/FindShopValidate.php
+61
-0
UFindShop.php
application/model/UFindShop.php
+83
-0
route.php
application/route.php
+3
-0
No files found.
application/api/controller/FindShop.php
0 → 100644
View file @
b87e86ef
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\model\UFindShop
;
use
think\Request
;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/4/18
* Time: 10:55
* Intro: 委托找铺
*/
class
FindShop
extends
Basic
{
public
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
}
/**
* @return \think\Response
*/
public
function
updateFindShop
()
{
$params
=
$this
->
params
;
/* $params = array(
"id"=> 1,
"user_id" => 116,
"user_name" => "111",
"site_id" => 10001,
"city" => "上海市",
"disc" => "徐汇区",
"business_district_id" => 111,
"business_district_name" => "121",
"status" => 0,//状态 0已提交 1取消 2已完成
"area_start" => 30,
"area_end" => 50,
"price_type" => 0,//0月租金 1日租金
"price_start" => 30,
"price_end" => 100,
);*/
$checkResult
=
$this
->
validate
(
$params
,
"FindShopValidate.add"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$updateParams
=
array
(
"user_id"
=>
$params
[
"user_id"
],
"user_name"
=>
$params
[
"user_name"
],
"site_id"
=>
$params
[
"site_id"
],
"city"
=>
$params
[
"city"
],
"disc"
=>
$params
[
"disc"
],
"business_district_id"
=>
$params
[
"business_district_id"
],
"business_district_name"
=>
$params
[
"business_district_name"
],
"area_start"
=>
$params
[
"area_start"
],
"area_end"
=>
$params
[
"area_end"
],
"price_type"
=>
$params
[
"price_type"
],
"price_start"
=>
$params
[
"price_start"
],
"price_end"
=>
$params
[
"price_end"
],
"status"
=>
empty
(
$params
[
"status"
])
?
0
:
$params
[
"status"
],
"update_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
);
//修改数据
if
(
!
empty
(
$params
[
"id"
])
&&
$params
[
"id"
]
>
0
)
{
$updateParams
[
"id"
]
=
$params
[
"id"
];
}
else
{
//新增数据
$updateParams
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
$findShopModel
=
new
UFindShop
();
$id
=
$findShopModel
->
addFindShop
(
$updateParams
);
if
(
$id
>
0
)
{
return
$this
->
response
(
"200"
,
"数据保存成功"
,
[
"id"
=>
$id
]);
}
else
{
return
$this
->
response
(
"101"
,
"数据保存失败"
);
}
}
}
\ No newline at end of file
application/api/validate/FindShopValidate.php
0 → 100644
View file @
b87e86ef
<?php
namespace
app\api\validate
;
use
think\Validate
;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/4/18
* Time: 16:58
*/
class
FindShopValidate
extends
Validate
{
protected
$rule
=
[
'user_id'
=>
'require|number|gt:0'
,
'user_name'
=>
'require'
,
'site_id'
=>
'require|number'
,
'city'
=>
'require'
,
'disc'
=>
'require'
,
'business_district_id'
=>
'require|number'
,
'business_district_name'
=>
'require'
,
'area_start'
=>
'require|number'
,
'area_end'
=>
'require|number'
,
'price_type'
=>
'require|in:0,1'
,
'price_start'
=>
'require|number'
,
'price_end'
=>
'require|number'
,
];
protected
$message
=
[
'user_id.require'
=>
'用户id必传'
,
'user_id.number'
=>
'用户id只能为数字'
,
'user_id.gt'
=>
'用户id错误'
,
'user_name'
=>
'用户姓名必传'
,
'site_id.require'
=>
"站点id必传"
,
'site_id.number'
=>
"站点id只能是数字"
,
'city.require'
=>
"城市必传"
,
'disc.require'
=>
"区域必传"
,
'business_district_id.require'
=>
"商圈必传"
,
'business_district_id.number'
=>
"商圈id只能是数字"
,
'business_district_name.require'
=>
"商圈必传"
,
'area_start.require'
=>
"面积需求必传"
,
'area_start.number'
=>
"面积需求必传"
,
'area_end.require'
=>
"面积需求必传"
,
'area_end.number'
=>
"面积需求必传"
,
'price_type.require'
=>
"租金模式必传"
,
'price_type.in'
=>
"租金模式错误"
,
'price_start.require'
=>
"价格需求必传"
,
'price_start.number'
=>
"价格需求必传"
,
'price_end.require'
=>
"价格需求必传"
,
'price_end.number'
=>
"价格需求必传"
,
];
protected
$scene
=
[
'add'
=>
[
'user_id'
,
'user_name'
,
'site_id'
,
'city'
,
'disc'
,
'business_district_id'
,
'business_district_name'
,
'area_start'
,
'area_end'
,
'price_type'
,
'price_start'
,
'price_end'
],
];
}
\ No newline at end of file
application/model/UFindShop.php
0 → 100644
View file @
b87e86ef
<?php
namespace
app\model
;
use
think\Db
;
use
Think\Model
;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/4/18
* Time: 15:10
*/
class
UFindShop
extends
Model
{
protected
$table
=
"u_find_shop"
;
private
$db_
;
public
function
__construct
(
$data
=
[])
{
parent
::
__construct
(
$data
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* @param $field
* @param $params
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getFindShopList
(
$field
,
$params
,
$page_no
,
$page_size
)
{
$where_
=
[];
if
(
isset
(
$params
[
'id'
]))
{
$where_
[
"id"
]
=
$params
[
'id'
];
}
$where_
[
"is_del"
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where_
)
->
page
(
$page_no
)
->
limit
(
$page_size
)
->
select
();
}
/**
* @param $params
* @return int
*/
public
function
addFindShop
(
$params
)
{
Db
::
startTrans
();
try
{
$this
->
db_
->
insert
(
$params
);
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* @param $where
* @param $params
* @return int
*/
public
function
updateFindShop
(
$where
,
$params
)
{
Db
::
startTrans
();
try
{
$this
->
db_
->
where
(
$where
)
->
update
(
$params
);
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
}
\ No newline at end of file
application/route.php
View file @
b87e86ef
...
@@ -547,6 +547,9 @@ Route::group('api', [
...
@@ -547,6 +547,9 @@ Route::group('api', [
'applyForWithdraw'
=>
[
'api/AccountBalance/applyForWithdraw'
,
[
'method'
=>
'post'
]],
'applyForWithdraw'
=>
[
'api/AccountBalance/applyForWithdraw'
,
[
'method'
=>
'post'
]],
'updateFindShop'
=>
[
'api/FindShop/updateFindShop'
,
[
'method'
=>
'get|post'
]],
]);
]);
Route
::
group
(
'chat'
,
[
Route
::
group
(
'chat'
,
[
...
...
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