allow to re-upload textures which were setted to private
This commit is contained in:
parent
ee4cbd2092
commit
975e34db95
|
|
@ -151,10 +151,10 @@ class SkinlibController extends Controller
|
||||||
|
|
||||||
if (!$results->isEmpty()) {
|
if (!$results->isEmpty()) {
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
if ($result->type == $t->type) {
|
// if the texture already uploaded was setted to private,
|
||||||
return json([
|
// then allow to re-upload it.
|
||||||
'errno' => 0,
|
if ($result->type == $t->type && $result->public == "1") {
|
||||||
'msg' => trans('skinlib.upload.repeated'),
|
return json(trans('skinlib.upload.repeated'), 0, [
|
||||||
'tid' => $result->tid
|
'tid' => $result->tid
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
@ -166,9 +166,7 @@ class SkinlibController extends Controller
|
||||||
$this->user->setScore($cost, 'minus');
|
$this->user->setScore($cost, 'minus');
|
||||||
|
|
||||||
if ($this->user->closet->add($t->tid, $t->name)) {
|
if ($this->user->closet->add($t->tid, $t->name)) {
|
||||||
return json([
|
return json(trans('skinlib.upload.success', ['name' => $request->input('name')]), 0, [
|
||||||
'errno' => 0,
|
|
||||||
'msg' => trans('skinlib.upload.success', ['name' => $request->input('name')]),
|
|
||||||
'tid' => $t->tid
|
'tid' => $t->tid
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
if (! function_exists('get_real_ip')) {
|
if (! function_exists('get_real_ip')) {
|
||||||
|
|
||||||
|
|
@ -70,15 +71,20 @@ if (! function_exists('json')) {
|
||||||
|
|
||||||
function json()
|
function json()
|
||||||
{
|
{
|
||||||
@header('Content-type: application/json; charset=utf-8');
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
|
||||||
if (count($args) == 1 && is_array($args[0])) {
|
if (count($args) == 1 && is_array($args[0])) {
|
||||||
return Response::json($args[0]);
|
return Response::json($args[0]);
|
||||||
} elseif(count($args) == 2) {
|
} elseif (count($args) == 3 && is_array($args[2])) {
|
||||||
return Response::json([
|
// the third argument is array of extra fields
|
||||||
|
return Response::json(array_merge([
|
||||||
'errno' => $args[1],
|
'errno' => $args[1],
|
||||||
'msg' => $args[0]
|
'msg' => $args[0]
|
||||||
|
], $args[2]));
|
||||||
|
} else {
|
||||||
|
return Response::json([
|
||||||
|
'errno' => Arr::get($args, 1, 1),
|
||||||
|
'msg' => $args[0]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user