120 lines
3.6 KiB
PHP
120 lines
3.6 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\validate;
|
||
|
||
|
||
use app\common\validate\BaseValidate;
|
||
|
||
|
||
/**
|
||
* Goods验证器
|
||
* Class GoodsValidate
|
||
* @package app\adminapi\validate
|
||
*/
|
||
class GoodsValidate extends BaseValidate
|
||
{
|
||
|
||
/**
|
||
* 设置校验规则
|
||
* @var string[]
|
||
*/
|
||
protected $rule = [
|
||
'id' => 'require',
|
||
'name' => 'require',
|
||
'first_category_id' => 'require',
|
||
'second_category_id' => 'require',
|
||
'third_category_id' => 'require',
|
||
'status' => 'require',
|
||
'image' => 'require',
|
||
'is_show_stock' => 'require',
|
||
'free_shipping_type' => 'require',
|
||
'is_commission' => 'require',
|
||
'is_share_bouns' => 'require',
|
||
'is_team' => 'require',
|
||
'is_integral' => 'require',
|
||
'is_member' => 'require',
|
||
'give_integral_type' => 'require',
|
||
];
|
||
|
||
|
||
/**
|
||
* 参数描述
|
||
* @var string[]
|
||
*/
|
||
protected $field = [
|
||
'id' => 'id',
|
||
'name' => '商品名称',
|
||
'first_category_id' => '一级分类id',
|
||
'status' => '商品状态:-1-回收站;0-下架;1-上架',
|
||
'image' => '商品主图',
|
||
'is_show_stock' => '是否显示库存:1-是;0-否',
|
||
'free_shipping_type' => '运费类型:1-包邮;2-统一运费;3-运费模板',
|
||
'is_commission' => '分销佣金:1-开启;0-不开启',
|
||
'is_share_bouns' => '区域股东分红:1-开启;0-不开启',
|
||
'is_team' => '是否开启拼团[0=否, 1=是]',
|
||
'is_integral' => '积分抵扣:1-开启;0-不开启',
|
||
'is_member' => '会员价:1-开启;0-不开启',
|
||
'give_integral_type' => '赠送积分类型:0-不赠送;1-赠送固定积分;2-按比例赠送积分',
|
||
];
|
||
|
||
|
||
/**
|
||
* @notes 添加场景
|
||
* @return GoodsValidate
|
||
* @author likeadmin
|
||
* @date 2025/05/08 15:34
|
||
*/
|
||
public function sceneAdd()
|
||
{
|
||
return $this->only(['name','first_category_id','status','image','is_show_stock','free_shipping_type','is_commission','is_share_bouns','is_team','is_integral','is_member','give_integral_type']);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 编辑场景
|
||
* @return GoodsValidate
|
||
* @author likeadmin
|
||
* @date 2025/05/08 15:34
|
||
*/
|
||
public function sceneEdit()
|
||
{
|
||
return $this->only(['id','name','first_category_id','status','image','is_show_stock','free_shipping_type','is_commission','is_share_bouns','is_team','is_integral','is_member','give_integral_type']);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 删除场景
|
||
* @return GoodsValidate
|
||
* @author likeadmin
|
||
* @date 2025/05/08 15:34
|
||
*/
|
||
public function sceneDelete()
|
||
{
|
||
return $this->only(['id']);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 详情场景
|
||
* @return GoodsValidate
|
||
* @author likeadmin
|
||
* @date 2025/05/08 15:34
|
||
*/
|
||
public function sceneDetail()
|
||
{
|
||
return $this->only(['id']);
|
||
}
|
||
|
||
} |