feat: #20220815 商品图片返回,增加文件上传权限

This commit is contained in:
赵世界 2022-08-16 18:24:56 +08:00
parent 10685ca9d7
commit 6ad85f359d
9 changed files with 19 additions and 7 deletions

View File

@ -70,7 +70,7 @@ class Inventory extends Command
$log->message = '成功';
DB::commit();
} catch (\Exception $exception) {
$log->message = '失败';
$log->message = '失败' . $exception->getMessage();
DB::rollBack();
}
$log->save();

View File

@ -19,7 +19,7 @@ class ShopsController extends Controller
$shops = Shop::query()->paginate();
foreach ($shops as $shop) {
$shop->authUrl = '';
if ('妙选' !== $shop->plat_id && '未授权' === $shop->status) {
if ('妙选' !== $shop->plat_id && ('未授权' === $shop->status || '重新授权' === $shop->status)) {
$shop->authUrl = BusinessFactory::init()->make($shop->plat_id)->getAuthUrl($shop->id, $shop->getOriginal('plat_id'));
}
}

View File

@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
use App\Models\Log as LogModel;
use App\Models\User;
use Illuminate\Http\Request;
use Faker\Generator as Faker;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use App\Http\Resources\UsersResource;
@ -30,7 +29,7 @@ class UsersController extends Controller
return UsersResource::collection($users);
}
public function store(Request $request, Faker $faker)
public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:191|unique:users,name',
@ -45,7 +44,6 @@ class UsersController extends Controller
}
$user = new User();
$user->name = $request->name;
$user->email = \request('email', $faker->unique()->safeEmail);
$user->password = $request->password;
$user->api_token = Str::random(60);
$user->save();

View File

@ -38,7 +38,7 @@ class Kernel extends HttpKernel
],
'api' => [
'throttle:60,1',
// 'throttle:60,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

View File

@ -23,6 +23,15 @@ class Goods extends Model
'goods_code',
];
public function getImgUrlAttribute($value)
{
if (false !== strpos($value, 'ju8hn6/erp/shop')) {
$value = config('filesystems.disks.aliyun.url') . $value;
}
return $value;
}
/**
* 多规格
*/

0
artisan Executable file → Normal file
View File

View File

@ -17,7 +17,7 @@ class CreateUsersTable extends Migration
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->string('email')->nullable()->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('api_token', 80)->unique()->nullable(false);

View File

@ -225,6 +225,11 @@ return [
'name' => '列表',
'parent_id' => 9,
],
'upload.file' => [
'id' => 11,
'name' => '文件上传',
'parent_id' => 7,
],
// 系统日志
'SYSTEM_LOG' => [
'id' => 10,

0
resources/templates/goods_skus_import.xlsx Executable file → Normal file
View File