ZLW-PC\Administrator
6 years ago
59 changed files with 772 additions and 262 deletions
-
22app/Common/Helper.php
-
7app/Http/Controllers/Admin/ArticleController.php
-
31app/Http/Controllers/Admin/BonusController.php
-
4app/Http/Controllers/Admin/CategoryController.php
-
110app/Http/Controllers/Admin/FeedbackController.php
-
104app/Http/Controllers/Admin/FriendlinkController.php
-
102app/Http/Controllers/Admin/SlideController.php
-
2app/Http/Controllers/Api/OrderController.php
-
5app/Http/Logic/ArctypeLogic.php
-
6app/Http/Logic/ArticleLogic.php
-
4app/Http/Logic/BonusLogic.php
-
12app/Http/Logic/CartLogic.php
-
12app/Http/Logic/CollectGoodsLogic.php
-
12app/Http/Logic/CommentLogic.php
-
13app/Http/Logic/FeedbackLogic.php
-
12app/Http/Logic/FriendlinkLogic.php
-
12app/Http/Logic/GoodsBrandLogic.php
-
13app/Http/Logic/GoodsImgLogic.php
-
21app/Http/Logic/GoodsLogic.php
-
13app/Http/Logic/GoodsSearchwordLogic.php
-
13app/Http/Logic/GoodsTypeLogic.php
-
13app/Http/Logic/GuestbookLogic.php
-
12app/Http/Logic/KeywordLogic.php
-
12app/Http/Logic/KuaidiLogic.php
-
12app/Http/Logic/MenuLogic.php
-
12app/Http/Logic/OrderGoodsLogic.php
-
16app/Http/Logic/OrderLogic.php
-
14app/Http/Logic/PageLogic.php
-
12app/Http/Logic/PaymentLogic.php
-
12app/Http/Logic/RegionLogic.php
-
13app/Http/Logic/SearchwordLogic.php
-
6app/Http/Logic/SlideLogic.php
-
12app/Http/Logic/SmsLogLogic.php
-
12app/Http/Logic/SysconfigLogic.php
-
13app/Http/Logic/TagindexLogic.php
-
12app/Http/Logic/TaglistLogic.php
-
12app/Http/Logic/TokenLogic.php
-
12app/Http/Logic/UserAddressLogic.php
-
15app/Http/Logic/UserBonusLogic.php
-
12app/Http/Logic/UserGoodsHistoryLogic.php
-
6app/Http/Logic/UserLogic.php
-
12app/Http/Logic/UserMessageLogic.php
-
12app/Http/Logic/UserMoneyLogic.php
-
12app/Http/Logic/UserPointLogic.php
-
15app/Http/Logic/UserRechargeLogic.php
-
12app/Http/Logic/UserRoleLogic.php
-
4app/Http/Logic/UserWithdrawLogic.php
-
12app/Http/Logic/VerifyCodeLogic.php
-
13app/Http/Logic/WeixinMenuLogic.php
-
14app/Http/Model/Slide.php
-
2app/Http/Requests/FeedbackRequest.php
-
112app/Http/Requests/SlideRequest.php
-
4public/css/admin.css
-
2public/css/style.css
-
BINpublic/images/off.png
-
BINpublic/images/on.png
-
4resources/views/admin/friendlink/edit.blade.php
-
26resources/views/admin/slide/edit.blade.php
-
8resources/views/home/index/index.blade.php
@ -1,24 +1,104 @@ |
|||
<?php |
|||
namespace app\common\validate; |
|||
namespace App\Http\Requests; |
|||
|
|||
use think\Validate; |
|||
|
|||
class Slide extends Validate |
|||
class SlideRequest extends BaseRequest |
|||
{ |
|||
// 验证规则
|
|||
protected $rule = [ |
|||
['id', 'require|number','ID必填|ID必须是数字'], |
|||
['title', 'require|max:150','标题必填|标题不能超过150个字符'], |
|||
['url', 'max:100','跳转链接不能超过100个字符'], |
|||
['target', 'number', '跳转方式必须是数字'], |
|||
['group_id', 'number', '分组ID必须是数字'], |
|||
['rank', 'number','排序必须是数字'], |
|||
['pic', 'max:100','图片地址不能超过100个字符'], |
|||
['is_show', 'in:0,1','是否显示,默认0显示'], |
|||
//总的验证规则
|
|||
protected $rules = [ |
|||
'id' => 'required|integer', |
|||
'title' => 'required|max:150', |
|||
'url' => 'max:100', |
|||
'target' => 'integer|between:0,5', |
|||
'group_id' => 'integer', |
|||
'listorder' => 'integer', |
|||
'pic' => 'required|max:100', |
|||
'is_show' => 'integer|between:0,2', |
|||
'type' => 'integer|between:0,5' |
|||
]; |
|||
|
|||
//总的自定义错误信息
|
|||
protected $messages = [ |
|||
'id.required' => 'ID必填', |
|||
'id.integer' => 'ID必须为数字', |
|||
'title.required' => '标题必填', |
|||
'title.max' => '标题不能超过150个字符', |
|||
'url.max' => 'url不能超过100个字符', |
|||
'target.integer' => 'target必须为数字', |
|||
'target.between' => '跳转方式,0_blank,1_self,2_parent,3_top,4framename', |
|||
'group_id.integer' => '分组ID必须是数字', |
|||
'listorder.integer' => '排序必须是数字', |
|||
'pic.required' => '图片', |
|||
'pic.max' => '图片地址不能超过100个字符', |
|||
'is_show.integer' => '是否显示必须为数字', |
|||
'is_show.between' => '是否显示,默认0显示', |
|||
'type.integer' => '类型必须为数字', |
|||
'type.between' => '类型0pc,1weixin,2app,3wap', |
|||
]; |
|||
|
|||
//场景验证规则
|
|||
protected $scene = [ |
|||
'add' => ['title', 'url', 'target', 'group_id', 'rank', 'pic', 'is_show'], |
|||
'del' => ['id'], |
|||
'add' => ['title', 'url', 'target', 'group_id', 'listorder', 'pic', 'is_show', 'type'], |
|||
'edit' => ['title', 'url', 'target', 'group_id', 'listorder', 'pic', 'is_show', 'type'], |
|||
'del' => ['id'], |
|||
]; |
|||
|
|||
/** |
|||
* Determine if the user is authorized to make this request. |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function authorize() |
|||
{ |
|||
return true; //修改为true
|
|||
} |
|||
|
|||
/** |
|||
* Get the validation rules that apply to the request. |
|||
* |
|||
* @return array |
|||
*/ |
|||
public function rules() |
|||
{ |
|||
return $this->rules; |
|||
} |
|||
|
|||
/** |
|||
* 获取被定义验证规则的错误消息. |
|||
* |
|||
* @return array |
|||
*/ |
|||
public function messages() |
|||
{ |
|||
return $this->messages; |
|||
} |
|||
|
|||
//获取场景验证规则
|
|||
public function getSceneRules($name, $fields = null) |
|||
{ |
|||
$res = array(); |
|||
|
|||
if(!isset($this->scene[$name])) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
$scene = $this->scene[$name]; |
|||
if($fields != null && is_array($fields)) |
|||
{ |
|||
$scene = $fields; |
|||
} |
|||
|
|||
foreach($scene as $k=>$v) |
|||
{ |
|||
if(isset($this->rules[$v])){$res[$v] = $this->rules[$v];} |
|||
} |
|||
|
|||
return $res; |
|||
} |
|||
|
|||
//获取场景验证规则自定义错误信息
|
|||
public function getSceneRulesMessages() |
|||
{ |
|||
return $this->messages; |
|||
} |
|||
} |
Binary file not shown.
After Width: 28 | Height: 19 | Size: 280 B |
Binary file not shown.
After Width: 28 | Height: 19 | Size: 215 B |
Write
Preview
Loading…
Cancel
Save
Reference in new issue