Commit c6e8af7f by 宁成龙

Merge remote-tracking branch 'origin/master'

parents 97ab17fe 522599f3
......@@ -64,3 +64,4 @@ PERM_GOURL=http://perm.semourdev.net
ADMIN_GROUP=1000,20000
MENU_ID=2
MENU_URL=http://data.semourdev.net/api/config/
......@@ -2,15 +2,22 @@
namespace App\Admin\Controllers\Api;
use App\Admin\Controllers\BaseController;
use App\Admin\Service\OrderService;
use App\Exceptions\InvalidRequestException;
use App\Http\Utils\ValidatorMsg;
use App\Models\Increasid;
use App\Models\Order;
use App\Models\OrderAddress;
use App\Models\OrderReturnItems;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Arr;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Support\Facades\Validator;
class OrderApiController extends Controller
class OrderApiController extends BaseController
{
public function orderDownloadShow(Request $request){
......@@ -56,29 +63,31 @@ class OrderApiController extends Controller
public function orderList(Request $request){
$arr=[];
$arr[0]["goods_id"]="123456";
$arr[0]["goods_name"]="商品型号";
$arr[0]["standard_brand_name"]="标准品牌";
$arr[0]["supplier_name"]="应商";
$arr[0]["raw_goods_sn"]="供应商物料唯一编码";
$arr[0]["raw_brand_name"]="供应商物料品牌";
$arr[0]["purchase_name"]="采购员";
$arr[0]["currency_cn"]="美金";
$arr[0]["goods_price"]="0.12344";//单价
$arr[0]["goods_number"]="66";//购买数量
$arr[0]["total_amount"]="100";//小计
$arr[0]["discount_amount"]="0.2";//折扣金额
$arr[0]["other_amount"]="0.1";//其它费用
$arr[0]["delivery_time"]="1-200年";//货期
$arr[0]["batch"]="1-200年";//批次
$arr[0]["remarks"]="客户备注";//客户备注
return response()->json(["code"=>0,"msg"=>"ok","data"=>["list"=>$arr],"count"=>0]);
$params = request()->all();
$order_id = arrayGet($params,"order_id",0,"intval");
$orderInfo = Order::getOneAndRelationList($order_id);
$orderItems = $orderInfo["order_items"]??[];
$orderInfo["orderItemList"] = $orderItems;
foreach($orderInfo["orderItemList"] as $k=>$item){
$orderInfo["orderItemList"][$k]["goods_price_format"] = decimal_number_format_usd($item["goods_price"]);
$orderInfo["orderItemList"][$k]["total_amount"] = decimal_number_format($item["goods_price"]*$item["goods_number"]);
$orderInfo["orderItemList"][$k]["total_amount_format"] = decimal_number_format_usd($item["goods_price"]*$item["goods_number"]);
$returnItems = OrderReturnItems::getOrderReturnItem($item["rec_id"]);
$orderInfo["orderItemList"][$k]["return_num"] = $returnItems["return_num"] ?? "";
$orderInfo["orderItemList"][$k]["return_price"] = $returnItems["return_price"] ?? "";
$orderInfo["orderItemList"][$k]["return_amount"] = $returnItems["return_amount"] ?? "";
$orderInfo["orderItemList"][$k]["type"] = $returnItems["type"] ?? "";
$orderInfo["orderItemList"][$k]["type_cn"] = Arr::get(OrderReturnItems::$TYPE,$returnItems["type"] ?? 0,"");
}
return response()->json(["code"=>0,"msg"=>"ok","data"=>["list"=>$orderInfo["orderItemList"]],"count"=>count($orderInfo["orderItemList"] )]);
}
//订单明细修改
public function orderDownload(Request $request){
$params = $request->all();
......@@ -100,4 +109,34 @@ class OrderApiController extends Controller
"info"=>$info
]),'PI.xlsx');
}
//订单明细修改
public function editOrderItems(Request $request){
$params = $request->all();
$order_id = arrayGet($params,"order_id",0,"intval");
$orderItems = arrayGet($params,"order_items","","trim");
$validator = Validator::make($params, [
'order_id' => 'required',
'order_items.*.order_items_id' => 'required',
'order_items' => 'required',
], [
'order_id.required' => admin_trans("order.validator.order_id_required"),
'order_items.required' => admin_trans("order.validator.order_items_required"),
], [
// 'order_id' => '订单id',
// 'order_items' => '订单明细',
]);
if ($validator->fails()) {
$errors = $validator->errors()->toArray();
$err_msg = ValidatorMsg::getMsg($errors);
throw new InvalidRequestException($err_msg);
}
OrderService::editOrderItems($order_id,$orderItems);
return $this->setSuccess();
}
}
<?php
namespace App\Admin\Controllers;
use App\Http\ApiHelper\ApiCode;
use Illuminate\Routing\Controller;
class BaseController extends Controller
{
public function setSuccessData($data = [], $count = 0, $code = ApiCode::API_CODE_SUCCESS, $msg = 'ok')
{
$res_data = [
"code" => $code,
"data" => $data,
];
if ($msg) {
$res_data['msg'] = $msg;
}
if ($count) {
$res_data['count'] = $count;
}
return response()->json($res_data);
}
public function setSuccess($msg = 'Operation succeeded', $code = ApiCode::API_CODE_SUCCESS, $data = [])
{
$res_data = [
"code" => $code,
"msg" => $msg,
'data' => (object)$data,
];
return response()->json($res_data);
}
public function setError($msg, $code = ApiCode::API_CODE_ERROR, $data = [])
{
$res_data = [
"code" => $code,
"msg" => $msg,
];
if ($data) {
$res_data['data'] = $data;
}
$this->logErr($msg, $code = ApiCode::API_CODE_ERROR, $data = null);
return response()->json($res_data);
}
}
......@@ -24,7 +24,7 @@ class InquiryController extends AdminController
*/
protected function grid()
{
return Grid::make(new Inquiry(['user','sales_user']), function (Grid $grid) {
return Grid::make(new Inquiry(['user', 'sales_user']), function (Grid $grid) {
$grid->showFilter();
$grid->disableActions();
$grid->disableFilterButton();
......@@ -39,13 +39,14 @@ class InquiryController extends AdminController
})->datetime()->width(3);
$filter->startWith('user.company_name')->width(3);
$filter->startWith('user.id')->width(3);
$filter->equal('inquiry_id')->width(3);
// $filter->equal('inquiry_id')->width(3);
$filter->startWith('user.email')->width(3);
$filter->startWith('user.phone')->width(3);
$filter->like('inquiry_sn')->width(3);
$filter->equal('priority')->select(admin_trans('inquiry.options.priority'))->width(3);
$filter->equal('status')->select(admin_trans('inquiry.options.status'))->width(3);
$filter->equal('sales_id',trans('inquiry.fields.sales_name'))->select(CmsUser::pluck('name', 'userId')->toArray())->width(3);
$filter->equal('sales_id', trans('inquiry.fields.sales_name'))->select(CmsUser::pluck('name',
'userId')->toArray())->width(3);
});
......@@ -63,6 +64,9 @@ class InquiryController extends AdminController
return new Card($detail) . new Card($list);
});
$grid->column('task_type')->display(admin_trans('inquiry.options.task_type.1'));
$grid->column('user.user_sn')->display(function ($value) {
return '<a target="_blank" iframe-extends=true iframe-tab=true href="/admin/users/'.$this->user->id.'" style="color:#1224cc">'.$value.'</a>';
});
$grid->column('user.phone')->copyable();
$grid->column('user.email')->copyable();
$grid->column('status')->using(admin_trans('inquiry.options.status'))->dot([
......@@ -85,9 +89,10 @@ class InquiryController extends AdminController
$grid->column('create_time')->display(function ($time) {
return date('Y-m-d H:i:s', $time);
})->sortable();
$grid->column('update_time')->display(function ($time) {
return $time ? date('Y-m-d H:i:s', $time) : '';
})->sortable();
// $grid->column('update_time')->display(function ($time) {
// return $time ? date('Y-m-d H:i:s', $time) : '';
// })->sortable();
$grid->column('source')->using(admin_trans('inquiry.options.source'));
});
}
......
......@@ -32,7 +32,6 @@ class OrderController extends AdminController
*/
public function index(Content $content)
{
return $content
->translation($this->translation())
->title($this->title())
......@@ -53,7 +52,7 @@ class OrderController extends AdminController
return Grid::make(new Order(), function (Grid $grid) {
$grid->model()->with("scmUser")->orderBy('order_id', 'desc');
$grid->fixColumns(1,2);//固定列
$grid->showColumnSelector();//开启字段选择器功能
// $grid->showColumnSelector();//开启字段选择器功能
// 在 display 回调中使用
$grid->column('序号')->display(function () {
return $this->_index + 1;
......@@ -245,8 +244,7 @@ JS
$order_id = arrayGet($params,"order_id",0,"intval");
$orderInfo = Order::getOneAndRelationList($order_id);
$orderItems = $orderInfo["orderItems"]??[];
dump($orderInfo);
$orderItems = $orderInfo["order_items"]??[];
$info=[];
// $info["orderInfo"] = $orderInfo;
......@@ -290,7 +288,7 @@ JS
$info["settlementInfo"]["order_freight_amount_format"] = "";
$info["settlementInfo"]["order_pay_commission_amount"] = 0;//手续费
$info["settlementInfo"]["order_pay_commission_amount_format"] = "";
$orderItemsId = Arr::pluck($orderItems,"rec_id");
// $orderItemsId = Arr::pluck($orderItems,"rec_id");
foreach($orderPrice as $orderPriceItem){
switch ($orderPriceItem["price_type"]){
......@@ -313,6 +311,5 @@ dump($info);
return view('admin.pages.order-page',["info"=>$info]);
// return $content->body(new OrderDetailPage());
}
}
......@@ -48,7 +48,8 @@ class HandleInquiry extends Form implements LazyRenderable
{
$this->hidden('inquiry_id')->attribute('id', 'inquiry_id');
$this->radio('status')->options(admin_trans('inquiry.options.status'))->default(0)->required();
$this->textarea('handle_result', admin_trans('global.labels.handle_result'))->rows(5)->required();
$this->textarea('handle_result', admin_trans('global.labels.handle_result'))->rows(5)
->required()->rules('required|max:255');
}
/**
......
......@@ -37,7 +37,7 @@ class InquiryDetail extends LazyRenderable
$show->width(4)->field('priority')->using(admin_trans('inquiry.options.priority'));
});
$show->row(function (Show\Row $show) {
$show->width(4)->field('user.id');
$show->width(4)->field('user.user_sn');
$show->width(4)->field('user.company_name');
});
$show->row(function (Show\Row $show) {
......
<?php
namespace App\Admin\Service;
use App\Admin\Actions\User\UserAssignAction;
use App\Admin\Actions\User\UserStatusAction;
use App\Admin\Actions\User\UserTransferAction;
use App\Models\Inquiry;
use App\Models\User;
use Dcat\Admin\Grid;
class InquiryService
{
public static function batchUpdateSalesId($salesId, $userIds = [])
{
return Inquiry::batchUpdateSalesId($salesId, $userIds);
}
}
......@@ -9,7 +9,9 @@ use App\Models\Order;
use App\Models\OrderAddress;
use App\Models\OrderItem;
use App\Models\OrderPrice;
use App\Models\OrderReturnItems;
use Dcat\Admin\Grid;
use Illuminate\Support\Arr;
class OrderService extends BaseService
{
......@@ -90,11 +92,72 @@ class OrderService extends BaseService
OrderItem::canelOrder($order_id);
}catch (\Exception $e){
(new self)->rollBackTransaction();
throw new InvalidRequestException(sprintf("取消订单失败:%s",$e->getMessage()));
throw new InvalidRequestException(sprintf("%s:%s",admin_trans("order.return_msg.50002"),$e->getMessage()));
}
(new self)->commitTransaction();
}
public static function editOrderItems($order_id,$orderItems){
(new self)->startTransaction();
try{
// $orderItemids = Arr::pluck($orderItems,"order_items_id");
// $orderItemsInfo = OrderItem::getItemsInfo($orderItemids);
// $orderItemsInfo = arrayChangeKeyByField($orderItemsInfo,"rec_id");
// $returnItems = OrderReturnItems::getOrderReturnItem($orderItemids);
// $returnItems = arrayChangeKeyByField($returnItems,"rec_id");
// dd($returnItems);
foreach ($orderItems as $orderItem){
OrderItem::updateOrderItem(["rec_id"=>$orderItem["order_items_id"]],[
"goods_price"=>$orderItem["goods_price"],
"goods_number"=>$orderItem["goods_number"],
]);
$returnItems = OrderReturnItems::getOrderReturnItem($orderItem["order_items_id"]);
$insertReturnItemData = [
"type"=>$orderItem["return_type"],
"order_id"=>$order_id,
"rec_id"=>$orderItem["order_items_id"],
"return_num"=>$orderItem["return_goods_number"],
"return_price"=>$orderItem["return_goods_price"],
"return_amount"=> decimal_number_format($orderItem["return_goods_number"] * $orderItem["return_goods_price"]),
];
$createOrEdit = false;
if(!empty($returnItems)){
foreach($insertReturnItemData as $field=>$val){
if(empty($returnItems[$field]) || $returnItems[$field] != $val){
$createOrEdit = true;//新增
break;
}
}
}
$createOrEdit && OrderReturnItems::create(array_merge($insertReturnItemData,["create_time"=>time()]));
}
//修改订单总金额
self::pullOrderAmount($order_id);
}catch (\Throwable $e){
(new self)->rollBackTransaction();
throw new InvalidRequestException(sprintf("%s:%s",admin_trans("order.return_msg.50003"),$e->getMessage()));
}
(new self)->commitTransaction();
}
public static function pullOrderAmount($order_id=0){
$amount = OrderItem::getOrderTotalAmount($order_id);
Order::updateOrder(["order_id"=>$order_id],[
"order_amount"=>$amount,
]);
}
}
......@@ -7,7 +7,6 @@ use Dcat\Admin\Admin;
Admin::routes();
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
......@@ -24,9 +23,10 @@ Route::group([
$router->resource('users', 'UserController');
$router->resource('country', 'CountryController');
//下载pdf
Route::get('/api/order_download', '\App\Admin\Controllers\Api\OrderApiController@orderDownload');
Route::get('/api/orderList', '\App\Admin\Controllers\Api\OrderApiController@orderList');
Route::get('/api/orderDownloadShow', '\App\Admin\Controllers\Api\OrderApiController@orderDownloadShow');
Route::get('/api/order_download', '\App\Admin\Controllers\Api\OrderApiController@orderDownload');//下载订单pdf
Route::get('/api/orderList', '\App\Admin\Controllers\Api\OrderApiController@orderList');//订单详情获取明细数据
Route::get('/api/orderDownloadShow', '\App\Admin\Controllers\Api\OrderApiController@orderDownloadShow');//订单下载
Route::match(['get', 'post'],'/api/order/editOrderItems', '\App\Admin\Controllers\Api\OrderApiController@editOrderItems');//订单修改明细数据
});
......
<?php
namespace App\Http\ApiHelper;
interface ApiCode
{
const API_CODE_SUCCESS = 0;//接口请求正常
const API_CODE_ERROR = 1;//接口请求异常 可预测失败
const API_CODE_NEED_LOGIN = 101; //需要登录
const API_CODE_LOGIN_ERROR = 102; // 登录信息错误
const API_CODE_MOBILE_NOTFOUND_ERROR = 103; // 手机号不存在
const API_CODE_PASSWD_NOTFOUND_ERROR = 104; // 密码错误
const API_CODE_USER_DISABLE_ERROR = 105; // 账号被封禁
}
<?php
/**
* Created by PhpStorm.
* User: duwenjun
* Date: 2021/8/11
* Time: 2:52 PM
*/
namespace App\Http\ApiHelper;
class Response
{
public static function setError($errMsg, $errCode = ApiCode::API_CODE_ERROR, $data = [])
{
return json_encode(['code' => $errCode, 'msg' => $errMsg, 'data' => $data],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
public static function setSuccess($data, $code = ApiCode::API_CODE_SUCCESS, $msg = "")
{
return json_encode(['code' => $code, 'msg' => $msg, 'data' => $data],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
}
\ No newline at end of file
......@@ -39,7 +39,7 @@ class Kernel extends HttpKernel
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
// \App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
......
<?php
/**
* Created by PhpStorm.
* User: duwenjun
* Date: 2021/9/1
* Time: 9:40 AM
*/
namespace App\Http\Utils;
use Illuminate\Support\Facades\Validator;
class ValidatorMsg
{
// 只返回错误的第一条错误
public static function getMsg($error_list)
{
$err_msg = '';
foreach ($error_list as $err_key => $err_msgs) {
foreach ($err_msgs as $msg) {
$err_msg .= "{$err_key}|{$msg}";
break;
}
break;
}
return $err_msg;
}
public static function checkValidateParamThrowException($validateRule,$params)
{
$validator = Validator::make($params, $validateRule);
if ($validator->fails()) {
$errors = $validator->errors()->toJson(JSON_UNESCAPED_UNICODE);
throw new \InvalidArgumentException($errors);
}
return true;
}
}
......@@ -32,4 +32,13 @@ class Inquiry extends Model
return $this->hasOne(CmsUser::class, 'userId', 'sales_id');
}
public static function batchUpdateSalesId($salesId, $userIds = [])
{
return self::whereIn('user_id', $userIds)
->where('status', self::STATUS_PENDING)->update([
'sales_id' => $salesId,
'update_time' => time(),
]);
}
}
......@@ -36,4 +36,18 @@ class OrderItem extends Model
]);
}
//修改订单
public static function updateOrderItem($where,$update){
return self::where($where)->update($update);
}
public static function getItemsInfo($rec_id=[]){
return self::whereIn("rec_id",$rec_id)->get()->toArray();
}
public static function getOrderTotalAmount($order_id){
$info = self::where("order_id",$order_id)->where("status",self::$STATUS_FORMAT["正常"])->selectRaw("sum(goods_price*goods_number) as total_amount")->first();
return $info ? decimal_number_format($info->total_amount) : 0;
}
}
......@@ -14,12 +14,25 @@ class OrderReturnItems extends Model
protected $table = 'order_return_items';
protected $primaryKey = 'return_items_id';
protected $guarded = ['return_items_id']; //设置字段黑名单
public $timestamps = false;
public static function getOrderReturnItemList($rec_ids=[]){
self::whereIn("rec_id")
public static $TYPE=[
"1" => "退货退款",
"2" => "仅退款",
];
public static function getOrderReturnItem($rec_id){
$info = self::where("rec_id",$rec_id)->orderBy("return_items_id","desc")->limit(1)->first();
return $info ? $info->toArray() : [];
}
}
......@@ -28,9 +28,9 @@ return [
],
'options' => [
'status' => [
-1 => 'closed',
0 => 'pending',
1 => 'processed'
1 => 'processed',
-1 => 'not_need_deal'
],
'priority' => [
0 => 'low',
......@@ -44,6 +44,10 @@ return [
'task_type' => [
1 => 'Inquiry',
2 => 'Bom'
],
'source' => [
1 => 'Web',
2 => 'Admin Web'
]
],
];
......@@ -20,11 +20,12 @@ return [
'create_time' => '添加时间',
'update_time' => '修改时间',
'task_type' => '任务类型',
'user' =>[
'user' => [
'id' => '客户编码',
'email' => '邮箱',
'phone' => '电话',
'company_name' => '公司名称'
'company_name' => '公司名称',
'user_sn' => '用户编码',
],
'sales_user' => [
'name' => '业务员',
......@@ -32,9 +33,9 @@ return [
],
'options' => [
'status' => [
-1 => '已关闭',
0 => '待处理',
1 => '已处理'
1 => '已处理',
-1 => '无需处理',
],
'priority' => [
0 => '低',
......@@ -48,6 +49,10 @@ return [
'task_type' => [
1 => '询价',
2 => 'bom'
],
'source' => [
1 => '网站前台',
2 => '后台'
]
],
];
......@@ -25,7 +25,13 @@ return [
],
"return_msg"=>[
"50000"=>"操作成功",
"50001"=>"只能修改不是待审核的订单状态"
"50001"=>"只能修改不是待审核的订单状态",
"50002"=>"取消订单失败",
"50003"=>"修改订单失败",
],
"validator"=>[
'order_id_required' => '订单id必填',
'order_items_required' => '订单明细数据错误',
],
'options' => [
"status"=>[
......
<?php
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
return [
'accepted' => '您必须接受 :attribute。',
'accepted_if' => '当 :other 为 :value 时,必须接受 :attribute。',
'active_url' => ':attribute 不是一个有效的网址。',
'after' => ':attribute 必须要晚于 :date。',
'after_or_equal' => ':attribute 必须要等于 :date 或更晚。',
'alpha' => ':attribute 只能由字母组成。',
'alpha_dash' => ':attribute 只能由字母、数字、短划线(-)和下划线(_)组成。',
'alpha_num' => ':attribute 只能由字母和数字组成。',
'array' => ':attribute 必须是一个数组。',
'attached' => '这个 :attribute 已经连接。',
'before' => ':attribute 必须要早于 :date。',
'before_or_equal' => ':attribute 必须要等于 :date 或更早。',
'between' => [
'array' => ':attribute 必须只有 :min - :max 个单元。',
'file' => ':attribute 必须介于 :min - :max KB 之间。',
'numeric' => ':attribute 必须介于 :min - :max 之间。',
'string' => ':attribute 必须介于 :min - :max 个字符之间。',
],
'boolean' => ':attribute 必须为布尔值。',
'confirmed' => ':attribute 两次输入不一致。',
'current_password' => '密码错误。',
'date' => ':attribute 不是一个有效的日期。',
'date_equals' => ':attribute 必须要等于 :date。',
'date_format' => ':attribute 的格式必须为 :format。',
'different' => ':attribute 和 :other 必须不同。',
'digits' => ':attribute 必须是 :digits 位数字。',
'digits_between' => ':attribute 必须是介于 :min 和 :max 位的数字。',
'dimensions' => ':attribute 图片尺寸不正确。',
'distinct' => ':attribute 已经存在。',
'email' => ':attribute 不是一个合法的邮箱。',
'ends_with' => ':attribute 必须以 :values 为结尾。',
'exists' => ':attribute 不存在。',
'file' => ':attribute 必须是文件。',
'filled' => ':attribute 不能为空。',
'gt' => [
'array' => ':attribute 必须多于 :value 个元素。',
'file' => ':attribute 必须大于 :value KB。',
'numeric' => ':attribute 必须大于 :value。',
'string' => ':attribute 必须多于 :value 个字符。',
],
'gte' => [
'array' => ':attribute 必须多于或等于 :value 个元素。',
'file' => ':attribute 必须大于或等于 :value KB。',
'numeric' => ':attribute 必须大于或等于 :value。',
'string' => ':attribute 必须多于或等于 :value 个字符。',
],
'image' => ':attribute 必须是图片。',
'in' => '已选的属性 :attribute 无效。',
'in_array' => ':attribute 必须在 :other 中。',
'integer' => ':attribute 必须是整数。',
'ip' => ':attribute 必须是有效的 IP 地址。',
'ipv4' => ':attribute 必须是有效的 IPv4 地址。',
'ipv6' => ':attribute 必须是有效的 IPv6 地址。',
'json' => ':attribute 必须是正确的 JSON 格式。',
'lt' => [
'array' => ':attribute 必须少于 :value 个元素。',
'file' => ':attribute 必须小于 :value KB。',
'numeric' => ':attribute 必须小于 :value。',
'string' => ':attribute 必须少于 :value 个字符。',
],
'lte' => [
'array' => ':attribute 必须少于或等于 :value 个元素。',
'file' => ':attribute 必须小于或等于 :value KB。',
'numeric' => ':attribute 必须小于或等于 :value。',
'string' => ':attribute 必须少于或等于 :value 个字符。',
],
'max' => [
'array' => ':attribute 最多只有 :max 个单元。',
'file' => ':attribute 不能大于 :max KB。',
'numeric' => ':attribute 不能大于 :max。',
'string' => ':attribute 不能大于 :max 个字符。',
],
'mimes' => ':attribute 必须是一个 :values 类型的文件。',
'mimetypes' => ':attribute 必须是一个 :values 类型的文件。',
'min' => [
'array' => ':attribute 至少有 :min 个单元。',
'file' => ':attribute 大小不能小于 :min KB。',
'numeric' => ':attribute 必须大于等于 :min。',
'string' => ':attribute 至少为 :min 个字符。',
],
'multiple_of' => ':attribute 必须是 :value 中的多个值。',
'not_in' => '已选的属性 :attribute 非法。',
'not_regex' => ':attribute 的格式错误。',
'numeric' => ':attribute 必须是一个数字。',
'password' => '密码错误',
'present' => ':attribute 必须存在。',
'prohibited' => ':attribute 字段被禁止。',
'prohibited_if' => '当 :other 为 :value 时,禁止 :attribute 字段。',
'prohibited_unless' => ':attribute 字段被禁止,除非 :other 位于 :values 中。',
'prohibits' => ':attribute 字段禁止出现 :other。',
'regex' => ':attribute 格式不正确。',
'relatable' => '此 :attribute 可能与此资源不相关联。',
'required' => ':attribute 不能为空。',
'required_if' => '当 :other 为 :value 时 :attribute 不能为空。',
'required_unless' => '当 :other 不为 :values 时 :attribute 不能为空。',
'required_with' => '当 :values 存在时 :attribute 不能为空。',
'required_with_all' => '当 :values 存在时 :attribute 不能为空。',
'required_without' => '当 :values 不存在时 :attribute 不能为空。',
'required_without_all' => '当 :values 都不存在时 :attribute 不能为空。',
'same' => ':attribute 和 :other 必须相同。',
'size' => [
'array' => ':attribute 必须为 :size 个单元。',
'file' => ':attribute 大小必须为 :size KB。',
'numeric' => ':attribute 大小必须为 :size。',
'string' => ':attribute 必须是 :size 个字符。',
],
'starts_with' => ':attribute 必须以 :values 为开头。',
'string' => ':attribute 必须是一个字符串。',
'timezone' => ':attribute 必须是一个合法的时区值。',
'unique' => ':attribute 已经存在。',
'uploaded' => ':attribute 上传失败。',
'url' => ':attribute 格式不正确。',
'uuid' => ':attribute 必须是有效的 UUID。',
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
'attributes' => [
'email' => '邮箱',
'attr_name' => '参数名称',
'class_name' => '分类名称',
'class_id' => '分类',
'attr_unit_name' => '单位名称',
],
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment