Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ypl_mobile_web
Overview
Overview
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邓丽
ypl_mobile_web
Commits
3c8d3aa1
Commit
3c8d3aa1
authored
Apr 19, 2016
by
庄欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增了验证类以及修改部分逻辑
parent
df751eb6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
167 additions
and
21 deletions
+167
-21
app/config/service.php
+2
-2
app/controller/SetsController.php
+8
-0
app/model/Sets.php
+3
-1
app/model/SetsAttachment.php
+3
-0
app/validation/SetsValidation.php
+120
-2
app/validation/WorksValidation.php
+9
-2
app/view/sets/edit.html
+10
-6
runtime/data/ImgCloud_sign.dat
+2
-2
runtime/view/-var-www-user.yuepai.com-app-view-sets-edit.html.php
+10
-6
No files found.
app/config/service.php
View file @
3c8d3aa1
...
...
@@ -50,9 +50,9 @@ $di->set('view', function () use($config){
return
$view
;
});
$isHttps
=
$_SERVER
[
'HTTPS'
]
;
$isHttps
=
isset
(
$_SERVER
[
'HTTPS'
])
;
$http
=
"http://"
;
if
(
$isHttps
!=
=
"Off"
)
if
(
$isHttps
&&
$_SERVER
[
'HTTPS'
]
!
=
"Off"
)
{
$http
=
"https://"
;
}
...
...
app/controller/SetsController.php
View file @
3c8d3aa1
...
...
@@ -41,6 +41,11 @@ class SetsController extends BaseController
}
else
{
$model
=
new
Sets
();
$this
->
_post
[
'uid'
]
=
UID
;
$validator
=
new
\validattion\SetsValidation
();
$errors
=
$validator
->
validate
(
$this
->
_post
);
if
(
$errors
->
count
()
>
0
)
{
$this
->
error
(
"操作失败:"
.
$validator
->
getMessages
());
}
$status
=
$model
->
save
(
$this
->
_post
);
if
(
$status
)
{
$this
->
success
(
"操作成功"
,
$this
->
url
->
getStatic
(
"sets/index"
));
...
...
@@ -95,4 +100,6 @@ class SetsController extends BaseController
{
}
}
\ No newline at end of file
app/model/Sets.php
View file @
3c8d3aa1
...
...
@@ -25,10 +25,12 @@ class Sets extends Base
$this
->
skipAttributes
([
'order_count'
]);
}
public
function
beforeCreate
()
public
function
before
ValidationOn
Create
()
{
parent
::
beforeValidationOnCreate
();
$this
->
order_count
=
0
;
$this
->
photographers_count
=
0
;
$this
->
collect_count
=
0
;
}
public
function
save
(
$data
=
null
,
$whiteList
=
null
)
...
...
app/model/SetsAttachment.php
View file @
3c8d3aa1
...
...
@@ -11,4 +11,6 @@ class SetsAttachment extends Base
{
$this
->
belongsTo
(
"sets_id"
,
"Sets"
,
"id"
);
}
}
\ No newline at end of file
app/validation/SetsValidation.php
View file @
3c8d3aa1
<?php
namespace
validattion
;
use
Phalcon\Validation
;
use
Phalcon\Validation\Validator\StringLength
;
use
Phalcon\Validation\Validator\PresenceOf
;
use
Phalcon\Validation\Validator\Between
;
use
Phalcon\Validation\Validator\Numericality
;
//套系验证
class
SetsValidation
extends
Validation
class
SetsValidation
extends
Base
Validation
{
public
function
initialize
()
{
...
...
@@ -34,7 +35,123 @@ class SetsValidation extends Validation
'maximum'
=>
100000
,
'message'
=>
'价格须在1元以上,100,000以下'
]));
//人员配备
$this
->
add
(
"photographers_count"
,
new
PresenceOf
([
'message'
=>
'您还未填写人员配备人数'
]));
$this
->
add
(
"photographers_count"
,
new
Numericality
([
'message'
=>
'人数必须是数字'
]));
$this
->
add
(
"makeup_count"
,
new
PresenceOf
([
'message'
=>
'您还未填写化妆人员人数'
]));
$this
->
add
(
"makeup_count"
,
new
Numericality
([
'message'
=>
'人数必须是数字'
]));
$this
->
add
(
"logistics_count"
,
new
PresenceOf
([
'message'
=>
'您还未填写后勤人数'
]));
$this
->
add
(
"logistics_count"
,
new
Numericality
([
'message'
=>
'人数必须是数字'
]));
//最多拍摄人数
$this
->
add
(
"join_count"
,
new
PresenceOf
([
'message'
=>
'您还未填写最多拍摄人数'
]));
$this
->
add
(
"join_count"
,
new
Numericality
([
'message'
=>
'人数必须是数字'
]));
//拍摄时长
$this
->
add
(
"duration"
,
new
PresenceOf
([
'message'
=>
'您还未填写最多拍摄时长'
]));
$this
->
add
(
"duration"
,
new
Numericality
([
'message'
=>
'人数必须是数字'
]));
//底片
$this
->
add
(
"negative_count"
,
new
PresenceOf
([
'message'
=>
'您还未填写底片数量'
]));
$this
->
add
(
"negative_count"
,
new
Numericality
([
'message'
=>
'底片数量必须是数字'
]));
//精修片数量
$this
->
add
(
"modification_count"
,
new
PresenceOf
([
'message'
=>
'您还未填写精修片数量'
]));
$this
->
add
(
"modification_count"
,
new
Numericality
([
'message'
=>
'精修片数量必须是数字'
]));
//额外精修
$this
->
add
(
"modification_price"
,
new
PresenceOf
([
'message'
=>
'您还未填写额外精修数量'
]));
$this
->
add
(
"modification_price"
,
new
Numericality
([
'message'
=>
'精修片数量必须是数字'
]));
//造型
$this
->
add
(
"modeling_count"
,
new
PresenceOf
([
'message'
=>
'您还未填写造型数量'
]));
$this
->
add
(
"modeling_count"
,
new
Numericality
([
'message'
=>
'造型数量必须是数字'
]));
//拍摄完成交图天数
$this
->
add
(
"deadline_of_day"
,
new
PresenceOf
([
'message'
=>
'您还未填写交图天数'
]));
$this
->
add
(
"deadline_of_day"
,
new
Numericality
([
'message'
=>
'交图天数必须是数字'
]));
}
public
function
validate
(
$data
=
null
,
$entity
=
null
)
{
//使用积分
if
(
$data
[
"is_use_score"
]
==
1
)
{
$this
->
add
(
"use_score"
,
new
PresenceOf
([
'message'
=>
'您还未填写积分抵扣上限'
]));
$this
->
add
(
"use_score"
,
new
Numericality
([
'message'
=>
'积分是数字'
]));
}
if
(
isset
(
$data
[
"allow_self_take"
]))
{
$this
->
add
(
"modeling_count_from_user"
,
new
PresenceOf
([
'message'
=>
'您还未填写允许用户自带数量'
]));
$this
->
add
(
"modeling_count_from_user"
,
new
Numericality
([
'message'
=>
'自带数量是数字'
]));
}
if
(
$data
[
"is_promotion"
])
{
$validator
=
new
PromotionValidation
();
$res
=
$validator
->
validate
(
$data
[
'promotion'
]);
if
(
$res
->
count
()
>
0
)
{
$this
->
appendMessage
(
$validator
->
getMessages
());
}
unset
(
$validator
);
}
if
(
count
(
$data
[
"attachment"
])
>
0
&&
trim
(
$data
[
"attachment"
][
0
][
'title'
])
!=
""
)
{
$validator
=
new
AttachmentValidation
();
foreach
(
$data
[
"attachment"
]
as
$item
)
{
$res
=
$validator
->
validate
(
$item
);
if
(
$res
->
count
()
>
0
)
{
$this
->
appendMessage
(
$validator
->
getMessages
());
break
;
}
}
unset
(
$validator
);
}
return
parent
::
validate
(
$data
,
$entity
);
}
}
\ No newline at end of file
app/validation/WorksValidation.php
View file @
3c8d3aa1
...
...
@@ -5,9 +5,10 @@ use Phalcon\Validation;
use
Phalcon\Validation\Validator\StringLength
;
use
Phalcon\Validation\Validator\PresenceOf
;
use
Phalcon\Validation\Validator\Between
;
use
Phalcon\Validation\Validator\Numericality
;
//相册验证
class
WorksValidation
extends
Validation
class
WorksValidation
extends
Base
Validation
{
public
function
initialize
()
{
...
...
@@ -34,7 +35,12 @@ class WorksValidation extends Validation
'maximum'
=>
100000
,
'message'
=>
'价格须在1元以上,100,000以下'
]));
//使用积分
$this
->
add
(
"price"
,
new
Numericality
([
'message'
=>
'价格必须是数字'
]));
}
}
\ No newline at end of file
app/view/sets/edit.html
View file @
3c8d3aa1
...
...
@@ -37,10 +37,10 @@
<div
class=
"form-group"
>
<label>
允许积分折扣
<span
class=
"red"
>
*
</span></label>
<div
class=
"clear"
></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"1"
name=
"use_score"
/>
是
</label></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"0"
name=
"use_score"
checked
/>
否
</label></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"1"
name=
"
is_
use_score"
/>
是
</label></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"0"
name=
"
is_
use_score"
checked
/>
否
</label></div>
<div
class=
"clear"
></div>
最多使用
<input
type=
"text"
data-type=
"number"
value=
"{{info.use_score|default('0')}}"
class=
"form-control"
/>
积分
最多使用
<input
type=
"text"
data-type=
"number"
name=
"use_score"
value=
"{{info.use_score|default('0')}}"
class=
"form-control"
/>
积分
</div>
<div
class=
"form-inline"
>
...
...
@@ -205,7 +205,11 @@
<div
class=
"clear"
></div>
<div
class=
"checkbox"
>
<input
type=
"checkbox"
/>
<input
type=
"checkbox"
name=
"allow_self_take"
value=
"1"
{%
if
info
.
modeling_count_from_user
|
default
('
0
')
>
0%}
checked
{%endif%}
/>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
...
@@ -458,7 +462,7 @@
<div
class=
"clear"
></div>
<div
class=
"form-group"
>
<label
class=
"sr-only"
></label>
<input
type=
"text"
value=
"{{promotion.start_time|default('')}}"
name=
"promotion[start_time]"
class=
"form-control form_date"
placeholder=
"促销开始时间"
/>
<input
type=
"text"
value=
"{{promotion.start_time|default('
0000-00-00 00:00:00
')}}"
name=
"promotion[start_time]"
class=
"form-control form_date"
placeholder=
"促销开始时间"
/>
</div>
<div
class=
"form-group"
>
<label
class=
"sr-only"
></label>
...
...
@@ -466,7 +470,7 @@
</div>
<div
class=
"form-group"
>
<label
class=
"sr-only"
></label>
<input
type=
"text"
value=
"{{promotion.end_time|default('')}}"
name=
"promotion[end_time]"
class=
"form-control form_date"
placeholder=
"促销结束时间"
/>
<input
type=
"text"
value=
"{{promotion.end_time|default('
0000-00-00 00:00:00
')}}"
name=
"promotion[end_time]"
class=
"form-control form_date"
placeholder=
"促销结束时间"
/>
</div>
</div>
</div>
...
...
runtime/data/ImgCloud_sign.dat
View file @
3c8d3aa1
{"to_time":1465813762,"data":"J8KsLYy392cY7FV+B1l+8nSQ2O5hPTEwMDMyOTQ3JmI9ZGV2eXVlcGFpJms9QUtJRGtsUUhJSVVHZVcwNW03Nmt3OTNPbktyQkk0QWtIRk55JmU9MTQ2NTgxMzc2MiZ0PTE0NjA2Mjk3NjImcj00NjU2JnU9JmY9"}
\ No newline at end of file
{"to_time":1466160607,"data":"UvL8Boar8eQZtJ4PcgsePOuWMZ1hPTEwMDMyOTQ3JmI9ZGV2eXVlcGFpJms9QUtJRGtsUUhJSVVHZVcwNW03Nmt3OTNPbktyQkk0QWtIRk55JmU9MTQ2NjE2MDYwNyZ0PTE0NjA5NzY2MDcmcj04NDU5JnU9JmY9"}
\ No newline at end of file
runtime/view/-var-www-user.yuepai.com-app-view-sets-edit.html.php
View file @
3c8d3aa1
...
...
@@ -311,10 +311,10 @@
<div
class=
"form-group"
>
<label>
允许积分折扣
<span
class=
"red"
>
*
</span></label>
<div
class=
"clear"
></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"1"
name=
"use_score"
/>
是
</label></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"0"
name=
"use_score"
checked
/>
否
</label></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"1"
name=
"
is_
use_score"
/>
是
</label></div>
<div
class=
"radio"
><label><input
type=
"radio"
value=
"0"
name=
"
is_
use_score"
checked
/>
否
</label></div>
<div
class=
"clear"
></div>
最多使用
<input
type=
"text"
data-type=
"number"
value=
"
<?php
echo
(
empty
(
$info
->
use_score
)
?
(
'0'
)
:
(
$info
->
use_score
));
?>
"
class=
"form-control"
/>
积分
最多使用
<input
type=
"text"
data-type=
"number"
name=
"use_score"
value=
"
<?php
echo
(
empty
(
$info
->
use_score
)
?
(
'0'
)
:
(
$info
->
use_score
));
?>
"
class=
"form-control"
/>
积分
</div>
<div
class=
"form-inline"
>
...
...
@@ -479,7 +479,11 @@
<div
class=
"clear"
></div>
<div
class=
"checkbox"
>
<input
type=
"checkbox"
/>
<input
type=
"checkbox"
name=
"allow_self_take"
value=
"1"
<?php
if
((
empty
(
$info
->
modeling_count_from_user
)
?
(
'0'
)
:
(
$info
->
modeling_count_from_user
))
>
0
)
{
?>
checked
<?php
}
?>
/>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
...
@@ -732,7 +736,7 @@
<div
class=
"clear"
></div>
<div
class=
"form-group"
>
<label
class=
"sr-only"
></label>
<input
type=
"text"
value=
"
<?php
echo
(
empty
(
$promotion
->
start_time
)
?
(
''
)
:
(
$promotion
->
start_time
));
?>
"
name=
"promotion[start_time]"
class=
"form-control form_date"
placeholder=
"促销开始时间"
/>
<input
type=
"text"
value=
"
<?php
echo
(
empty
(
$promotion
->
start_time
)
?
(
'
0000-00-00 00:00:00
'
)
:
(
$promotion
->
start_time
));
?>
"
name=
"promotion[start_time]"
class=
"form-control form_date"
placeholder=
"促销开始时间"
/>
</div>
<div
class=
"form-group"
>
<label
class=
"sr-only"
></label>
...
...
@@ -740,7 +744,7 @@
</div>
<div
class=
"form-group"
>
<label
class=
"sr-only"
></label>
<input
type=
"text"
value=
"
<?php
echo
(
empty
(
$promotion
->
end_time
)
?
(
''
)
:
(
$promotion
->
end_time
));
?>
"
name=
"promotion[end_time]"
class=
"form-control form_date"
placeholder=
"促销结束时间"
/>
<input
type=
"text"
value=
"
<?php
echo
(
empty
(
$promotion
->
end_time
)
?
(
'
0000-00-00 00:00:00
'
)
:
(
$promotion
->
end_time
));
?>
"
name=
"promotion[end_time]"
class=
"form-control form_date"
placeholder=
"促销结束时间"
/>
</div>
</div>
</div>
...
...
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