'requireIf:type,' . PayDict::ALIPAY, 'app_secret_cert' => 'requireIf:type,' . PayDict::ALIPAY, 'app_public_cert_path' => 'requireIf:type,' . PayDict::ALIPAY, 'alipay_public_cert_path' => 'requireIf:type,' . PayDict::ALIPAY, 'alipay_root_cert_path' => 'requireIf:type,' . PayDict::ALIPAY, //微信 'mch_id' => 'requireIf:type,' . PayDict::WECHATPAY, 'mch_secret_key' => 'requireIf:type,' . PayDict::WECHATPAY, 'mch_secret_cert' => 'requireIf:type,' . PayDict::WECHATPAY, 'mch_public_cert_path' => 'requireIf:type,' . PayDict::WECHATPAY, //支付方式 'type' => 'require|checkPayType', ]; protected $message = [ 'app_id.requireIf' => 'validate_pay.app_id_requireif', 'app_secret_cert.requireIf' => 'validate_pay.app_secret_cert_requireif', 'app_public_cert_path.requireIf' => 'validate_pay.app_public_cert_path_requireif', 'alipay_public_cert_path.requireIf' => 'validate_pay.alipay_public_cert_path_requireif', 'alipay_root_cert_path.requireIf' => 'validate_pay.alipay_root_cert_path_requireif', 'mch_id.requireIf' => 'validate_pay.mch_id_requireif', 'mch_secret_key.requireIf' => 'validate_pay.mch_secret_key_requireif', 'mch_secret_cert.requireIf' => 'validate_pay.mch_secret_cert_requireif', 'mch_public_cert_path.requireIf' => 'validate_pay.mch_public_cert_path_requireif', ]; protected $scene = [ 'set' => [ 'app_id', 'app_secret_cert', 'app_public_cert_path', 'alipay_public_cert_path', 'alipay_root_cert_path', 'mch_id', 'mch_secret_key', 'mch_secret_cert', 'mch_public_cert_path', 'type', ], ]; /** * 自定义验证 支付类型 * @param $value * @param $rule * @param array $data * @return Lang|true */ protected function checkPayType($value, $rule, $data = []) { return isset(PayDict::getPayType()[$value]) ? true : get_lang("validate_pay.not_exit_pay_type"); } }