<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 店铺管理
 */
namespace app\allwin\validate;
use think\Validate;

class Card extends Validate{

    protected $rule = [
        'id'                => 'require|number',
        'member_miniapp_id' => 'require|number',
        'store_id'          => 'require|number',
        'theme'             => 'require',
        'name'              => 'require',
        'amount'            => 'require|number',
        'price'             => 'require|float',
        'discount'          => 'require|number',
        'locktime'          => 'require',
        'tips'              => 'require',
        'relation_l1'       => 'require|number',
        'relation_l2'       => 'require|number',
        'coupon_ids'        => 'require|array',
    ];
    
    protected $message = [
        'id'                => '编辑ID丢失',
        'member_miniapp_id' => '当前应用APP_ID丢失',
        'store_id'          => '当前店铺不存在',
        'theme'             => '会员卡主题色必须选择',
        'name'              => '会员卡名称必须填写',
        'amount'            => '金额必须输入',
        'price'             => '付款金额必须输入',
        'locktime'          => '有效期必须输入',
        'discount'          => '消费优惠折扣必须输入',
        'tips'              => '使用须知必须输入',
        'relation_l1'       => '直推奖励必须是整数',
        'relation_l2'       => '简推奖励必须是整数',
        'coupon_ids'        => '必须选择优惠券',
    ];

    protected $scene = [
        'sort'      => ['id','sort'],
        'apiedit'   => ['id','name','price','tips','relation_l1','relation_l2'],
        'apicreate' => ['member_miniapp_id','store_id','name','price','tips','relation_l1','relation_l2'],
        'regcard'   => ['id','member_miniapp_id','store_id'],
    ];
}