optimize fail status
This commit is contained in:
parent
2ea6cdd49b
commit
1cbf9af4a4
|
|
@ -63,7 +63,7 @@ class ProductController
|
||||||
* 创建商品
|
* 创建商品
|
||||||
*
|
*
|
||||||
* @param ProductRequest $request
|
* @param ProductRequest $request
|
||||||
* @return array
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function store(ProductRequest $request)
|
public function store(ProductRequest $request)
|
||||||
{
|
{
|
||||||
|
|
@ -88,7 +88,7 @@ class ProductController
|
||||||
*
|
*
|
||||||
* @param ProductRequest $request
|
* @param ProductRequest $request
|
||||||
* @param Product $product
|
* @param Product $product
|
||||||
* @return array
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function update(ProductRequest $request, Product $product)
|
public function update(ProductRequest $request, Product $product)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ use Beike\Repositories\CurrencyRepo;
|
||||||
use Beike\Repositories\LanguageRepo;
|
use Beike\Repositories\LanguageRepo;
|
||||||
use Beike\Services\CurrencyService;
|
use Beike\Services\CurrencyService;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
|
|
@ -520,26 +521,28 @@ function quantity_format($quantity)
|
||||||
/**
|
/**
|
||||||
* 返回json序列化结果
|
* 返回json序列化结果
|
||||||
*/
|
*/
|
||||||
function json_success($message, $data = [], $status=422): \Illuminate\Http\JsonResponse
|
function json_success($message, $data = [])
|
||||||
{
|
{
|
||||||
$data = [
|
return [
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
];
|
];
|
||||||
return response()->json($data, $status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回json序列化结果
|
* 返回json序列化结果
|
||||||
*/
|
*/
|
||||||
function json_fail($message, $data = []): array
|
function json_fail($message, $data = [], $status = 422): JsonResponse
|
||||||
{
|
{
|
||||||
return [
|
$data = [
|
||||||
'status' => 'fail',
|
'status' => 'fail',
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
return response()->json($data, $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! function_exists('sub_string')) {
|
if (! function_exists('sub_string')) {
|
||||||
|
|
|
||||||
|
|
@ -10,29 +10,29 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'file_sorting' => '文件排序',
|
'file_sorting' => '文件排序',
|
||||||
'text_type' => '类型',
|
'text_type' => '类型',
|
||||||
'text_created' => '创建时间',
|
'text_created' => '创建时间',
|
||||||
'file_name' => '文件名称',
|
'file_name' => '文件名称',
|
||||||
'to_sort' => '排序',
|
'to_sort' => '排序',
|
||||||
'text_desc' => '倒序',
|
'text_desc' => '倒序',
|
||||||
'text_asc' => '顺序',
|
'text_asc' => '顺序',
|
||||||
'file_manager_create' => '创建目录/文件',
|
'file_manager_create' => '创建目录/文件',
|
||||||
'file_manager_show' => '查看目录/文件',
|
'file_manager_show' => '查看目录/文件',
|
||||||
'file_manager_update' => '重命名',
|
'file_manager_update' => '重命名',
|
||||||
'file_manager_delete' => '删除目录/文件',
|
'file_manager_delete' => '删除目录/文件',
|
||||||
'directory_already_exist' => '目录已存在',
|
'directory_already_exist' => '目录已存在',
|
||||||
'directory_not_empty' => '该目录不为空',
|
'directory_not_empty' => '该目录不为空',
|
||||||
'target_not_exist' => '原始文件或者文件夹不存在',
|
'target_not_exist' => '原始文件或者文件夹不存在',
|
||||||
'create_folder' => '创建文件夹',
|
'create_folder' => '创建文件夹',
|
||||||
'rename' => '重命名',
|
'rename' => '重命名',
|
||||||
'download' => '下载',
|
'download' => '下载',
|
||||||
'upload_files' => '上传文件',
|
'upload_files' => '上传文件',
|
||||||
'click_upload' => '点击上传,或将图片拖到此处',
|
'click_upload' => '点击上传,或将图片拖到此处',
|
||||||
'image_uploading' => '图片上传中',
|
'image_uploading' => '图片上传中',
|
||||||
'no_file' => '没有文件',
|
'no_file' => '没有文件',
|
||||||
'picture_space' => '图片空间',
|
'picture_space' => '图片空间',
|
||||||
'show_pc' => '请到PC端操作',
|
'show_pc' => '请到PC端操作',
|
||||||
'verify_select_image' => '请选择图片',
|
'verify_select_image' => '请选择图片',
|
||||||
'verify_select_video' => '请选择视频',
|
'verify_select_video' => '请选择视频',
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue