mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
Merge branch 'feature' into yezhenman
This commit is contained in:
commit
5a013dce53
@ -8,6 +8,8 @@ use Illuminate\Http\Request;
|
||||
use App\Models\GoodsSku;
|
||||
use App\Http\Resources\GoodsSkuResource;
|
||||
use App\Imports\GoodsSkusImport;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
@ -30,12 +32,118 @@ class GoodsSkusController extends Controller
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return new GoodsSkuResource(GoodsSku::query()->with(['goods', 'brand'])->find($id));
|
||||
return new GoodsSkuResource(GoodsSku::query()
|
||||
->with(['goods' => function ($query) {
|
||||
$query->with(['type:id,name', 'brand:id,name']);
|
||||
}])
|
||||
->find($id));
|
||||
}
|
||||
|
||||
public function update($id, Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$this->validateUpdate($data);
|
||||
$sku = GoodsSku::query()->find($id);
|
||||
$this->setBeforeUpdate($sku->toArray());
|
||||
$sku->update($data);
|
||||
$this->setAfterUpdate($sku->toArray());
|
||||
$this->addLog($id, 'update');
|
||||
|
||||
return new GoodsSkuResource($sku);
|
||||
}
|
||||
|
||||
public function batchUpdate(Request $request)
|
||||
{
|
||||
$appendRules = [
|
||||
'*.id' => [
|
||||
'required',
|
||||
Rule::exists('goods_skus', 'id'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function updateField($id, Request $request)
|
||||
{
|
||||
$appendRules = [
|
||||
'updateField' => [
|
||||
'required',
|
||||
Rule::in(['reference_price', 'reserve', 'loss_num', 'status'])
|
||||
],
|
||||
];
|
||||
if ($request->has('loss_num')) {
|
||||
$appendRules['reason'] = ['required', 'string'];
|
||||
}
|
||||
$this->validateUpdate($request->all(), $appendRules);
|
||||
$updateField = \request('updateField');
|
||||
$sku = GoodsSku::query()->find($id);
|
||||
$this->setBeforeUpdate($sku->$updateField);
|
||||
$sku->$updateField = $request->$updateField;
|
||||
$sku->save();
|
||||
$this->setAfterUpdate($sku->$updateField);
|
||||
$this->addLog($id, $updateField);
|
||||
|
||||
return new GoodsSkuResource($sku);
|
||||
}
|
||||
|
||||
public function updateStock($id, Request $request)
|
||||
{
|
||||
$this->validateUpdate($request->all());
|
||||
$sku = GoodsSku::query()->where('id', $id)->get(['id', 'two_days_ago_num', 'yesterday_num']);
|
||||
if ($sku->two_days_ago_num != \request('t wo_days_ago_num') || $sku->yesterday_num != \request('yesterday_num')) {
|
||||
$this->setBeforeUpdate($sku->toArray());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function validateUpdate($data, $appendRules = [])
|
||||
{
|
||||
$rules = [
|
||||
'*.two_days_ago_num' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
],
|
||||
'*.yesterday_num' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
],
|
||||
'*.arrived_today_num' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
],
|
||||
'*.cost' => [
|
||||
'sometimes',
|
||||
'numeric',
|
||||
'gt:0'
|
||||
],
|
||||
'*.reference_price' => [
|
||||
'sometimes',
|
||||
'numeric',
|
||||
'gt:0'
|
||||
],
|
||||
'*.reserve' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
],
|
||||
'*.loss_num' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
],
|
||||
'*.inventory' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
],
|
||||
'*.status' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
Rule::in([0, 1, 2])
|
||||
],
|
||||
];
|
||||
$validator = Validator::make($data, array_merge($rules, $appendRules));
|
||||
if ($validator->fails()) {
|
||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
|
||||
@ -45,7 +45,7 @@ class RolesController extends Controller
|
||||
$this->setAfterUpdate($role->name);
|
||||
$this->addLog($role->id, 'add');
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
return new RolesResource($role);
|
||||
}
|
||||
|
||||
public function addPermissions($id, Request $request)
|
||||
|
||||
45
app/Http/Controllers/Shop/ShopsController.php
Normal file
45
app/Http/Controllers/Shop/ShopsController.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Shop;
|
||||
use App\Http\Resources\ShopsResource;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class ShopsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$shops = Shop::query()->paginate();
|
||||
|
||||
return ShopsResource::collection($shops);
|
||||
}
|
||||
|
||||
public function getPlatList()
|
||||
{
|
||||
$shop = new Shop();
|
||||
|
||||
return new ShopsResource($shop->getPlatList());
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|string|max:255|unique:shops,name',
|
||||
'plat_id' => 'required|integer',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
$shop = new Shop();
|
||||
$shop->name = $request->name;
|
||||
$shop->plat_id = $request->plat_id;
|
||||
$shop->save();
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
}
|
||||
34
app/Http/Controllers/UploadController.php
Normal file
34
app/Http/Controllers/UploadController.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Log as LogModel;
|
||||
use App\Utils\UploadUtils;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UploadController extends Controller
|
||||
{
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->log = new LogModel([
|
||||
'module' => 'file',
|
||||
'action' => $request->getMethod(),
|
||||
'target_type' => 'upload',
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
if (!$request->hasFile('uploadFile')) {
|
||||
$this->res = [
|
||||
'httpCode' => 404,
|
||||
'errorCode' => 404404,
|
||||
'errorMessage' => 'not found file',
|
||||
];
|
||||
}
|
||||
$this->addLog(0, 'add');
|
||||
$this->res['resource'] = UploadUtils::putForUploadedFile('image', $request->uploadFile);
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Http\Resources\UsersResource;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
@ -24,7 +25,7 @@ class UsersController extends Controller
|
||||
|
||||
public function index()
|
||||
{
|
||||
$users = User::query()->where('id', '<>', 1)->paginate();
|
||||
$users = User::query()->where('id', '<>', 1)->with('roles:id,name,guard_name')->paginate();
|
||||
|
||||
return UsersResource::collection($users);
|
||||
}
|
||||
@ -32,9 +33,10 @@ class UsersController extends Controller
|
||||
public function store(Request $request, Faker $faker)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|string|unique:users,name|max:255',
|
||||
'name' => 'required|string|max:255|unique:users,name',
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
'email' => 'email',
|
||||
'role_name' => 'required|string|exists:roles,name'
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||
@ -49,22 +51,58 @@ class UsersController extends Controller
|
||||
$user->save();
|
||||
$this->setAfterUpdate($user->toArray());
|
||||
$this->addLog($user->id, 'add');
|
||||
$user->assignRole($request->role_name);
|
||||
|
||||
return new UsersResource($user);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return new UsersResource(User::query()->find($id));
|
||||
return new UsersResource(User::query()->with('roles:id,name,guard_name')->find($id));
|
||||
}
|
||||
|
||||
public function update()
|
||||
public function update($id, Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
Rule::unique('users')->ignore($id),
|
||||
],
|
||||
// 'old_password' => 'sometimes|required|string|min:8',
|
||||
'password' => 'sometimes|string|min:8|confirmed',
|
||||
'email' => 'sometimes|email',
|
||||
'role_name' => 'sometimes|required|string|exists:roles,name'
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
$user = User::query()->find($id);
|
||||
$user->update($request->toArray());
|
||||
if ($request->has('role_name')) {
|
||||
$user->syncRoles($request->role_name);
|
||||
}
|
||||
|
||||
public function destory()
|
||||
{
|
||||
return new UsersResource($user);
|
||||
}
|
||||
|
||||
public function destory($id)
|
||||
{
|
||||
$user = User::query()->find($id);
|
||||
try {
|
||||
$user->delete();
|
||||
$this->addLog($id, 'status');
|
||||
} catch (\Exception $e) {
|
||||
$this->res = [
|
||||
'httpCode' => 500,
|
||||
'errorCode' => 500416,
|
||||
'errorMessage' => $e->getMessage(),
|
||||
];
|
||||
}
|
||||
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
}
|
||||
}
|
||||
|
||||
19
app/Http/Resources/ShopsResource.php
Normal file
19
app/Http/Resources/ShopsResource.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ShopsResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
42
app/Models/Shop.php
Normal file
42
app/Models/Shop.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Shop extends Model
|
||||
{
|
||||
protected $hidden = [
|
||||
'access_token',
|
||||
'expires_at',
|
||||
'expires_in',
|
||||
'refresh_token',
|
||||
'refresh_token_expires_at',
|
||||
'refresh_token_expires_in',
|
||||
'pop_auth_token_create_response',
|
||||
];
|
||||
|
||||
public function getStatusAttribute($value)
|
||||
{
|
||||
$map = [
|
||||
0 => '未授权',
|
||||
1 => '已授权',
|
||||
2 => '无需授权',
|
||||
3 => '停用',
|
||||
];
|
||||
|
||||
return $map[$value];
|
||||
}
|
||||
|
||||
public function getPlatList()
|
||||
{
|
||||
return ['妙选', '快团团'];
|
||||
}
|
||||
|
||||
public function getPlatIdAttribute($value)
|
||||
{
|
||||
$map = $this->getPlatList();
|
||||
|
||||
return $map[$value];
|
||||
}
|
||||
}
|
||||
123
app/Utils/UploadUtils.php
Normal file
123
app/Utils/UploadUtils.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Intervention\Image\Facades\Image;
|
||||
use OSS\Core\OssException;
|
||||
use OSS\OssClient;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UploadUtils
|
||||
{
|
||||
private static $ossClient;
|
||||
private static $bucket = 'ct-upimg';
|
||||
private static $prefix = 'ju8hn6/erp/shop/';
|
||||
|
||||
|
||||
public static function init()
|
||||
{
|
||||
if (static::$ossClient === null) {
|
||||
static::$ossClient = new OssClient(config('filesystems.disks.aliyun.access_id'), config('filesystems.disks.aliyun.access_key'), config('filesystems.disks.aliyun.endpoint'));
|
||||
}
|
||||
|
||||
if (static::$bucket === null) {
|
||||
static::$bucket = config('filesystems.disks.aliyun.bucket');
|
||||
}
|
||||
}
|
||||
|
||||
public static function putForUploadedResizeImage($bucketPath, UploadedFile $upload, $width = 800, $extension = null)
|
||||
{
|
||||
if ($upload->extension() != 'gif') {
|
||||
// 压缩图片
|
||||
$originalName = static::randomFileName($extension ?: $upload->getClientOriginalExtension());
|
||||
$storagePath = storage_path('app/public/file/') . $originalName;
|
||||
$img = Image::make($upload->getRealPath());
|
||||
|
||||
// 未传宽度 大于800压缩至800 否则按照原宽度
|
||||
$width = $img->width() >= 800 ? 800 : $img->width();
|
||||
// 高度自适应
|
||||
$img->resize($width, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
$img->save($storagePath);
|
||||
$upload = new UploadedFile($storagePath, $originalName);
|
||||
}
|
||||
|
||||
// 上传并删除压缩图片
|
||||
try {
|
||||
$filePath = static::put($bucketPath, $upload->getRealPath(), $upload->getClientOriginalExtension());
|
||||
} catch (OssException $e) {
|
||||
throw $e;
|
||||
} finally {
|
||||
if (isset($storagePath)) {
|
||||
unlink($storagePath);
|
||||
}
|
||||
}
|
||||
|
||||
return $filePath;
|
||||
}
|
||||
|
||||
//上传图片
|
||||
public static function putForUploadedFile($bucketPath, UploadedFile $upload)
|
||||
{
|
||||
return static::put($bucketPath, $upload->getRealPath(), $upload->getClientOriginalExtension());
|
||||
}
|
||||
|
||||
public static function put($bucketPath, $filepath, $ext)
|
||||
{
|
||||
static::init();
|
||||
try {
|
||||
$filePath = static::$prefix . $bucketPath . '/' . static::randomFileName($ext);
|
||||
static::$ossClient->uploadFile(static::$bucket, $filePath, $filepath);
|
||||
} catch (OssException $e) {
|
||||
throw $e;
|
||||
}
|
||||
return $filePath;
|
||||
}
|
||||
|
||||
public static function buildFilePath()
|
||||
{
|
||||
return date('Y') . '/' . date('m') . '/' . date('d');
|
||||
}
|
||||
|
||||
public static function randomFileName($ext, $len = 40)
|
||||
{
|
||||
return Str::random($len) . '.' . $ext;
|
||||
}
|
||||
|
||||
//删除修改前,上传修改后图片
|
||||
public static function delAndUploadImage($file, $filePath, UploadedFile $upload)
|
||||
{
|
||||
static::delFile($file);
|
||||
return static::putForUploadedFile($filePath, $upload);
|
||||
}
|
||||
|
||||
//删除修改前,上传修改后视频
|
||||
public static function delAndUploadVideo($file, $filePath, UploadedFile $upload)
|
||||
{
|
||||
static::delFile($file);
|
||||
return static::putForUploadedFile($filePath, $upload);
|
||||
}
|
||||
|
||||
public static function delFile($file)
|
||||
{
|
||||
static::init();
|
||||
if (static::exist($file)) {
|
||||
return static::$ossClient->deleteObject(static::$bucket, $file);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function exist($file)
|
||||
{
|
||||
static::init();
|
||||
return static::$ossClient->doesObjectExist(static::$bucket, $file);
|
||||
}
|
||||
|
||||
public static function getFullImgUrl($filePath)
|
||||
{
|
||||
return config('filesystems.disks.aliyun.url') . $filePath;
|
||||
}
|
||||
|
||||
}
|
||||
@ -9,7 +9,9 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.2.5|^8.0",
|
||||
"aliyuncs/oss-sdk-php": "^2.5",
|
||||
"fideloper/proxy": "^4.4",
|
||||
"intervention/image": "^2.7",
|
||||
"laravel/framework": "^6.20.26",
|
||||
"laravel/tinker": "^2.5",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
|
||||
290
composer.lock
generated
290
composer.lock
generated
@ -4,8 +4,53 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "486f251784470138e7bd835f6ea84ce3",
|
||||
"content-hash": "87b78d5c6e1dfc1285abb501c7eb8372",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aliyuncs/oss-sdk-php",
|
||||
"version": "v2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
||||
"reference": "f0413667d765855eb0aaa728b596801464ffdb06"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/f0413667d765855eb0aaa728b596801464ffdb06",
|
||||
"reference": "f0413667d765855eb0aaa728b596801464ffdb06",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "*",
|
||||
"satooshi/php-coveralls": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OSS\\": "src/OSS"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Aliyuncs",
|
||||
"homepage": "http://www.aliyun.com"
|
||||
}
|
||||
],
|
||||
"description": "Aliyun OSS SDK for PHP",
|
||||
"homepage": "http://www.aliyun.com/product/oss/",
|
||||
"support": {
|
||||
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
|
||||
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.5.0"
|
||||
},
|
||||
"time": "2022-05-13T07:41:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
"version": "2.0.4",
|
||||
@ -414,6 +459,205 @@
|
||||
},
|
||||
"time": "2022-02-09T13:33:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "2.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "13388f00956b1503577598873fffb5ae994b5737"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/13388f00956b1503577598873fffb5ae994b5737",
|
||||
"reference": "13388f00956b1503577598873fffb5ae994b5737",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"psr/http-factory": "^1.0",
|
||||
"psr/http-message": "^1.0",
|
||||
"ralouphie/getallheaders": "^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-factory-implementation": "1.0",
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.4.1",
|
||||
"http-interop/http-factory-tests": "^0.9",
|
||||
"phpunit/phpunit": "^8.5.8 || ^9.3.10"
|
||||
},
|
||||
"suggest": {
|
||||
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Psr7\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
},
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "George Mponos",
|
||||
"email": "gmponos@gmail.com",
|
||||
"homepage": "https://github.com/gmponos"
|
||||
},
|
||||
{
|
||||
"name": "Tobias Nyholm",
|
||||
"email": "tobias.nyholm@gmail.com",
|
||||
"homepage": "https://github.com/Nyholm"
|
||||
},
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com",
|
||||
"homepage": "https://github.com/sagikazarmark"
|
||||
},
|
||||
{
|
||||
"name": "Tobias Schultze",
|
||||
"email": "webmaster@tubo-world.de",
|
||||
"homepage": "https://github.com/Tobion"
|
||||
},
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com",
|
||||
"homepage": "https://sagikazarmark.hu"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation that also provides common utility methods",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response",
|
||||
"stream",
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/psr7/issues",
|
||||
"source": "https://github.com/guzzle/psr7/tree/2.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/GrahamCampbell",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/Nyholm",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-20T21:43:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "intervention/image",
|
||||
"version": "2.7.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Intervention/image.git",
|
||||
"reference": "04be355f8d6734c826045d02a1079ad658322dad"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad",
|
||||
"reference": "04be355f8d6734c826045d02a1079ad658322dad",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
"guzzlehttp/psr7": "~1.1 || ^2.0",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9.2",
|
||||
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "to use GD library based image processing.",
|
||||
"ext-imagick": "to use Imagick based image processing.",
|
||||
"intervention/imagecache": "Caching extension for the Intervention Image library"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.4-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Intervention\\Image\\ImageServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Image": "Intervention\\Image\\Facades\\Image"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Intervention\\Image\\": "src/Intervention/Image"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Oliver Vogel",
|
||||
"email": "oliver@intervention.io",
|
||||
"homepage": "https://intervention.io/"
|
||||
}
|
||||
],
|
||||
"description": "Image handling and manipulation library with support for Laravel integration",
|
||||
"homepage": "http://image.intervention.io/",
|
||||
"keywords": [
|
||||
"gd",
|
||||
"image",
|
||||
"imagick",
|
||||
"laravel",
|
||||
"thumbnail",
|
||||
"watermark"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Intervention/image/issues",
|
||||
"source": "https://github.com/Intervention/image/tree/2.7.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://paypal.me/interventionio",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/Intervention",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-05-21T17:30:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v6.20.44",
|
||||
@ -2131,6 +2375,50 @@
|
||||
},
|
||||
"time": "2022-07-07T13:49:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ralouphie/getallheaders",
|
||||
"version": "3.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ralouphie/getallheaders.git",
|
||||
"reference": "120b605dfeb996808c31b6477290a714d356e822"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
|
||||
"reference": "120b605dfeb996808c31b6477290a714d356e822",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.1",
|
||||
"phpunit/phpunit": "^5 || ^6.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/getallheaders.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ralph Khattar",
|
||||
"email": "ralph.khattar@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A polyfill for getallheaders.",
|
||||
"support": {
|
||||
"issues": "https://github.com/ralouphie/getallheaders/issues",
|
||||
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
|
||||
},
|
||||
"time": "2019-03-08T08:55:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
"version": "3.9.6",
|
||||
|
||||
@ -64,7 +64,18 @@ return [
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
],
|
||||
|
||||
'aliyun' => [
|
||||
'driver' => 'oss',
|
||||
'access_id' => 'LTAI6do39W9jINpe',
|
||||
'access_key' => 'XLhp5w4WnRcqji204GYOm7hZsoXSB6',
|
||||
'bucket' => 'ct-upimg',
|
||||
'endpoint' => 'oss-cn-hangzhou.aliyuncs.com', // OSS 外网节点或自定义外部域名
|
||||
// 'cdnDomain' => 'cdn-xiangma.yx090.com', // 如果isCName为true, getUrl会判断cdnDomain是否设定来决定返回的url,如果cdnDomain未设置,则使用endpoint来生成url,否则使用cdn
|
||||
'url' => 'https://ct-upimg.yx090.com/',
|
||||
'ssl' => true,
|
||||
'isCName' => false, // 是否使用自定义域名,true: 则Storage.url()会使用自定义的cdn或域名生成文件url, false: 则使用外部节点生成url
|
||||
'debug' => true
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@ -20,6 +20,7 @@ class CreateUsersTable extends Migration
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('api_token', 80)->unique()->nullable(false);
|
||||
$table->softDeletes();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
45
database/migrations/2022_08_02_022448_create_shops_table.php
Normal file
45
database/migrations/2022_08_02_022448_create_shops_table.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateShopsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shops', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name')->unique();
|
||||
$table->unsignedTinyInteger('plat_id')->comment('平台id');
|
||||
$table->string('access_token')->nullable();
|
||||
$table->unsignedMediumInteger('expires_at')->nullable()->comment('access_token过期时间点');
|
||||
$table->unsignedInteger('expires_in')->nullable()->comment('access_token过期时间段,10(表示10秒后过期)');
|
||||
$table->string('owner_id')->nullable()->comment('商家店铺id');
|
||||
$table->string('owner_name')->nullable()->comment('商家账号名称');
|
||||
$table->string('refresh_token')->nullable()->comment('refresh token,可用来刷新access_token');
|
||||
$table->unsignedMediumInteger('refresh_token_expires_at')->nullable()->comment('Refresh token过期时间点');
|
||||
$table->unsignedInteger('refresh_token_expires_in')->nullable()->comment('refresh_token过期时间段,10表示10秒后过期');
|
||||
$table->text('scope')->nullable()->comment('接口列表');
|
||||
$table->text('pop_auth_token_create_response')->nullable()->comment('授权认证信息');
|
||||
$table->string('status')->default(0)->comment('状态');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('shops');
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,6 @@ class MenusTableSeeder extends Seeder
|
||||
['parent_id' => $id,'code' => 'PERMISSION_MANAGE', 'name' => '权限管理', 'seq' => 1],
|
||||
]);
|
||||
// 系统日志
|
||||
DB::table('menus')->insertGetId(['parent_id' => 0,'code' => 'SYSTEM_LOG', 'name' => '系统管理', 'seq' => 4]);
|
||||
DB::table('menus')->insertGetId(['parent_id' => 0,'code' => 'SYSTEM_LOG', 'name' => '系统日志', 'seq' => 4]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Controllers\Role\RolesController;
|
||||
use App\Http\Controllers\UploadController;
|
||||
use App\Http\Controllers\Shop\ShopsController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -28,6 +30,7 @@ Route::middleware('auth:api')->group(function () {
|
||||
Route::resource('goods_skus', 'Goods\GoodsSkusController', ['only' => ['index', 'show', 'update', 'store']]);
|
||||
// 店铺
|
||||
Route::resource('shops', 'Shop\ShopsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]);
|
||||
Route::get('shop_platforms', [ShopsController::class, 'getPlatList'])->name('plat.list');
|
||||
// 角色
|
||||
Route::resource('roles', 'Role\RolesController', ['only' => ['index', 'store', 'show', 'update']]);
|
||||
Route::post('roles/{id}/permissions', [RolesController::class, 'addPermissions'])->name('role.permission');
|
||||
@ -37,6 +40,7 @@ Route::middleware('auth:api')->group(function () {
|
||||
Route::resource('menus', 'Menu\MenusController', ['only' => ['index',
|
||||
// 'store', 'show', 'update', 'destroy'
|
||||
]]);
|
||||
Route::post('upload', [UploadController::class, 'store'])->name('upload.file');
|
||||
});
|
||||
|
||||
Route::post('/auth/login', [LoginController::class, 'login'])->name('auth.login');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user