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
c425cae8
Commit
c425cae8
authored
Sep 19, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店验证
parent
b2e8efe3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
Store.php
application/index/controller/Store.php
+11
-0
StoreValidate.php
application/index/validate/StoreValidate.php
+60
-0
No files found.
application/index/controller/Store.php
View file @
c425cae8
...
...
@@ -10,6 +10,7 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\index\validate\StoreValidate
;
use
app\model\AStore
;
class
Store
extends
Basic
...
...
@@ -81,6 +82,16 @@ class Store extends Basic
return
$this
->
response
(
101
,
'参数错误,修改失败!'
);
}
$store_validate
=
new
StoreValidate
();
if
(
empty
(
$this
->
params
[
'id'
]))
{
if
(
!
$store_validate
->
scene
(
'add'
)
->
check
(
$this
->
params
))
{
return
$this
->
response
(
101
,
$store_validate
->
getError
());
}
}
else
{
if
(
!
$store_validate
->
scene
(
'edit'
)
->
check
(
$this
->
params
))
{
return
$this
->
response
(
101
,
$store_validate
->
getError
());
}
}
$store
=
new
AStore
();
$this
->
data
=
$store
->
addStoreAgents
(
$this
->
params
,
$this
->
params
[
'agents_id'
]);
...
...
application/index/validate/StoreValidate.php
0 → 100644
View file @
c425cae8
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/9/19
* Time: 16:02
*/
namespace
app\index\validate
;
use
think\Validate
;
class
StoreValidate
extends
Validate
{
protected
$rule
=
[
'id'
=>
'require|between:1,9999999999'
,
'agents_id'
=>
'require|between:1,9999999999'
,
'province'
=>
'require|length:1,60'
,
'city'
=>
'require|length:1,125'
,
'district'
=>
'require|length:1,125'
,
'address'
=>
'require|length:1,125'
,
'longitude'
=>
'require|length:1,125'
,
'latitude'
=>
'require|length:1,125'
,
'store_name'
=>
'require|length:1,125'
,
'scale'
=>
'require|length:1,12 5'
,
'district_id'
=>
'require|between:1,9999999999'
,
];
protected
$message
=
[
'id.require'
=>
'门店id必填'
,
'id.between'
=>
'门店id参数错误'
,
'agents_id.require'
=>
'经纪人id必填'
,
'agents_id.between'
=>
'经纪人id参数错误'
,
'province.require'
=>
'省份必填'
,
'province.length'
=>
'省份字数太长'
,
'city.require'
=>
'城市必填'
,
'city.length'
=>
'城市字数太长'
,
'district.require'
=>
'区域必填'
,
'district.length'
=>
'区域字数太长'
,
'address.require'
=>
'地址必填'
,
'address.length'
=>
'地址字数太长'
,
'longitude.require'
=>
'经纬度必填'
,
'longitude.length'
=>
'经纬度字数太长'
,
'latitude.require'
=>
'经纬度必填'
,
'latitude.length'
=>
'经纬度字数太长'
,
'store_name.require'
=>
'门店名必填'
,
'store_name.length'
=>
'门店名字数太长'
,
'scale.require'
=>
'门店规模必填'
,
'scale.length'
=>
'门店规模字数太长'
,
'district_id.require'
=>
'部门必选'
,
'district_id.length'
=>
'部门字数太长'
,
];
protected
$scene
=
[
'add'
=>
[
'agents_id'
,
'province'
,
'city'
,
'district'
,
'address'
,
'longitude'
,
'latitude'
,
'store_name'
,
'scale'
,
'district_id'
],
'edit'
=>
[
'id'
,
'agents_id'
,
'province'
,
'city'
,
'district'
,
'address'
,
'longitude'
,
'latitude'
,
'store_name'
,
'scale'
,
'district_id'
]
];
}
\ No newline at end of file
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