mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-18 13:54:01 +08:00
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()) {
|
||||
foreach ($results as $result) {
|
||||
if ($result->type == $t->type) {
|
||||
return json([
|
||||
'errno' => 0,
|
||||
'msg' => trans('skinlib.upload.repeated'),
|
||||
// if the texture already uploaded was setted to private,
|
||||
// then allow to re-upload it.
|
||||
if ($result->type == $t->type && $result->public == "1") {
|
||||
return json(trans('skinlib.upload.repeated'), 0, [
|
||||
'tid' => $result->tid
|
||||
]);
|
||||
}
|
||||
@ -166,9 +166,7 @@ class SkinlibController extends Controller
|
||||
$this->user->setScore($cost, 'minus');
|
||||
|
||||
if ($this->user->closet->add($t->tid, $t->name)) {
|
||||
return json([
|
||||
'errno' => 0,
|
||||
'msg' => trans('skinlib.upload.success', ['name' => $request->input('name')]),
|
||||
return json(trans('skinlib.upload.success', ['name' => $request->input('name')]), 0, [
|
||||
'tid' => $t->tid
|
||||
]);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
if (! function_exists('get_real_ip')) {
|
||||
|
||||
@ -70,15 +71,20 @@ if (! function_exists('json')) {
|
||||
|
||||
function json()
|
||||
{
|
||||
@header('Content-type: application/json; charset=utf-8');
|
||||
$args = func_get_args();
|
||||
|
||||
if (count($args) == 1 && is_array($args[0])) {
|
||||
return Response::json($args[0]);
|
||||
} elseif(count($args) == 2) {
|
||||
return Response::json([
|
||||
} elseif (count($args) == 3 && is_array($args[2])) {
|
||||
// the third argument is array of extra fields
|
||||
return Response::json(array_merge([
|
||||
'errno' => $args[1],
|
||||
'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