add partly goods logic
This commit is contained in:
parent
770553b4c5
commit
657663c9d0
|
@ -3,7 +3,8 @@ APP_ENV=local
|
|||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
NOTICE_URL=
|
||||
GOODS_URL=
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
|
23
Dockerfile
Normal file
23
Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
FROM php:8.3-cli
|
||||
|
||||
RUN pecl install redis \
|
||||
&& pecl install xdebug \
|
||||
&& docker-php-ext-enable redis xdebug
|
||||
|
||||
|
||||
RUN curl -sSLf \
|
||||
-o /usr/local/bin/install-php-extensions \
|
||||
https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions && \
|
||||
chmod +x /usr/local/bin/install-php-extensions && \
|
||||
install-php-extensions mongodb igbinary imagick gd
|
||||
|
||||
RUN install-php-extensions zip
|
||||
RUN apt update && apt install git -y
|
||||
|
||||
|
||||
RUN echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
RUN echo "xdebug.client_host=\"host.docker.internal\"" >> /usr/local/etc/php/conf
|
||||
RUN echo "xdebug.start_with_request=default" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
RUN curl -o composer-setup.php https://getcomposer.org/installer
|
||||
RUN php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer
|
||||
RUN install-php-extensions pdo_mysql
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\helpers\apiRequest;
|
||||
use App\Models\Notice;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Console\Isolatable;
|
||||
|
||||
|
@ -28,7 +29,7 @@ class HandleNotice extends Command implements Isolatable
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public Client $client)
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();;
|
||||
}
|
||||
|
@ -37,44 +38,52 @@ public function __construct(public Client $client)
|
|||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
$this->line('开始消息队列');
|
||||
$url = env('NOTICE_URL');
|
||||
$res = json_decode($this->client->post($url)->getBody()->getContents(), true);
|
||||
$res = apiRequest::request($url);
|
||||
if (!$res['result'] || $res['errCode'] != '0000') {
|
||||
$this->error('request err: ' . $res['desc'] ?? '');
|
||||
return 1;
|
||||
}
|
||||
$arr = $res['data']['notice_list'] ?? [];
|
||||
while ($items = array_splice($arr, 0, 1)) {
|
||||
while ($items = array_splice($arr, 0, 500)) {
|
||||
$ids = array_column($items, 'notice_id');
|
||||
$data = array_column($items, null, 'notice_id');
|
||||
if (!$ids) {
|
||||
continue;
|
||||
}
|
||||
$hadIds = Notice::query()->select('id')->whereIn('id', $ids)->get()->toArray();
|
||||
$data = array_column($items, null, 'notice_id');
|
||||
|
||||
$hadIds = array_column($hadIds, 'id');
|
||||
$hadIds = Notice::query()->select('notice_id')->whereIn('notice_id', $ids)->get()->toArray();
|
||||
|
||||
$hadIds = array_column($hadIds, 'notice_id');
|
||||
$newIds = array_diff($ids, $hadIds);
|
||||
if (!$newIds) {
|
||||
continue;
|
||||
}
|
||||
$notices = [];
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$queue = [];
|
||||
foreach ($newIds as $id) {
|
||||
$notices[] = [
|
||||
'notice_id' => $id,
|
||||
'notice_type'=>$data[$id]['type'],
|
||||
'raw_content' => json_encode($data[$id]),
|
||||
'created_at' => $time,
|
||||
];
|
||||
$queue[$data[$id]['type']][] = $data[$id];
|
||||
}
|
||||
try{
|
||||
try {
|
||||
Notice::insert($notices);
|
||||
}catch (\Exception $exception){
|
||||
$this->error('insert err:'. $exception->getMessage());
|
||||
} catch (\Exception $exception) {
|
||||
$this->error('insert err:' . $exception->getMessage());
|
||||
continue;
|
||||
}
|
||||
//todo 入队
|
||||
foreach ($newIds as $id){
|
||||
\App\Jobs\notice::dispatch($data[$id]);
|
||||
foreach ($queue as $type => $item) {
|
||||
\App\Jobs\notice::dispatch($type, $item);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\helpers\apiRequest;
|
||||
use App\helpers\FormType;
|
||||
use App\Models\Good;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
@ -12,19 +17,57 @@ class notice implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public Client $client;
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(public int $type,public mixed $data)
|
||||
{
|
||||
//
|
||||
$this->goodsUrl=env('GOODS_URL');
|
||||
}
|
||||
|
||||
public string $goodsUrl ;
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
//
|
||||
switch ($this->type) {
|
||||
case 1:
|
||||
$this->addGoods();
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws GuzzleException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addGoods(): void
|
||||
{
|
||||
$goods = [];
|
||||
$this->client = new Client();
|
||||
foreach ($this->data as $item) {
|
||||
$product = apiRequest::requests($this->client,$this->goodsUrl,[
|
||||
'itemId' =>$item['result']['itemId'],
|
||||
],FormType::json);
|
||||
if($product['errCode']!='0000'){
|
||||
throw new \Exception('request item '. $item['item_id'].' err:' .$product['desc'] ?? '');
|
||||
}
|
||||
$product = $product['data']['product'];
|
||||
$product['itemid'] = $product['itemId'];
|
||||
$good = new Good();
|
||||
$good->fill($product);
|
||||
$goods[]=$good->toArray();
|
||||
}
|
||||
Good::insert($goods);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
10
app/Models/Base.php
Normal file
10
app/Models/Base.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Base extends Model
|
||||
{
|
||||
public $timestamps = true;
|
||||
}
|
|
@ -9,10 +9,12 @@
|
|||
/**
|
||||
* @property GoodItem $goodItem
|
||||
*/
|
||||
class Good extends Model
|
||||
class Good extends Base
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $fillable = [
|
||||
'itemid','typeid','product_name','product_code','product_group',
|
||||
'market_price','settlement','category_id', 'category_name'
|
||||
];
|
||||
public function GoodItem() :HasOne {
|
||||
return $this->hasOne(GoodItem::class,'item_id');
|
||||
}
|
||||
|
|
|
@ -10,10 +10,8 @@
|
|||
/**
|
||||
* @property Good $good
|
||||
*/
|
||||
class GoodItem extends Model
|
||||
class GoodItem extends Base
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function Good () : BelongsTo{
|
||||
return $this->belongsTo(Good::class,'item_id');
|
||||
}
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Notice extends Model
|
||||
class Notice extends Base
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = true;
|
||||
}
|
||||
|
|
11
app/helpers/FormType.php
Normal file
11
app/helpers/FormType.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\helpers;
|
||||
|
||||
enum FormType
|
||||
{
|
||||
case urlencoded;
|
||||
case json;
|
||||
case formData;
|
||||
case query;
|
||||
}
|
81
app/helpers/apiRequest.php
Normal file
81
app/helpers/apiRequest.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\helpers;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
class apiRequest
|
||||
{
|
||||
|
||||
public static Client|null $client=null;
|
||||
|
||||
public static function getClient(): Client
|
||||
{
|
||||
if (!self::$client) {
|
||||
self::$client = new Client();
|
||||
}
|
||||
return self::$client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function request(string $url, mixed $param=[], FormType $type = FormType::urlencoded, bool $isJson = true, int $timeout = 5, array $extern = []):mixed
|
||||
{
|
||||
return self::requests(self::getClient(),$url,$param,$type,$isJson,$timeout,$extern);
|
||||
}
|
||||
|
||||
/**
|
||||
* json请求api
|
||||
* @param Client $client
|
||||
* @param string $url
|
||||
* @param mixed $param
|
||||
* @param FormType $type 1 x-www-form-urlencoded,2 json, 3 multipart/form-data 4 get query
|
||||
* @param bool $isJson
|
||||
* @param int $timeout
|
||||
* @param int[] $extern
|
||||
* @return mixed
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function requests(Client $client,string $url, mixed $param=[], FormType $type = FormType::urlencoded, bool $isJson = true, int $timeout = 5, array $extern = []): mixed
|
||||
{
|
||||
$params = [
|
||||
'timeout' => $timeout
|
||||
];
|
||||
switch ($type) {
|
||||
case FormType::urlencoded:
|
||||
$params['form_params'] = $param;
|
||||
$type = 'POST';
|
||||
break;
|
||||
case FormType::json:
|
||||
$params['json'] = $param;
|
||||
$type = 'POST';
|
||||
break;
|
||||
case FormType::formData:
|
||||
$params['multipart'] = $param;
|
||||
$type = 'POST';
|
||||
break;
|
||||
default:
|
||||
$params['query'] = $param;
|
||||
$type = 'GET';
|
||||
break;
|
||||
}
|
||||
if ($extern) {
|
||||
$params = array_merge($params, $extern);
|
||||
}
|
||||
$r = $client->request($type, $url, $params);
|
||||
$res = $r->getBody()->getContents();
|
||||
if ($isJson) {
|
||||
$data = json_decode($res, true);
|
||||
if ($data === false) {
|
||||
throw new Exception($res, 0);
|
||||
}
|
||||
} else {
|
||||
$data = $res;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
"laravel/tinker": "^2.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-ide-helper": "^3.0",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
|
|
497
composer.lock
generated
497
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "9c491b8531eec05ba41a11d9276a5749",
|
||||
"content-hash": "6f4cd8c4286fcd65009ebc43750ac48f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
|
@ -5678,6 +5678,343 @@
|
|||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "barryvdh/laravel-ide-helper",
|
||||
"version": "v3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
|
||||
"reference": "bc1d67f01ce8c77e3f97d48ba51fa1d81874f622"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/bc1d67f01ce8c77e3f97d48ba51fa1d81874f622",
|
||||
"reference": "bc1d67f01ce8c77e3f97d48ba51fa1d81874f622",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"barryvdh/reflection-docblock": "^2.1.1",
|
||||
"composer/class-map-generator": "^1.0",
|
||||
"ext-json": "*",
|
||||
"illuminate/console": "^10 || ^11",
|
||||
"illuminate/database": "^10.38 || ^11",
|
||||
"illuminate/filesystem": "^10 || ^11",
|
||||
"illuminate/support": "^10 || ^11",
|
||||
"nikic/php-parser": "^4.18 || ^5",
|
||||
"php": "^8.1",
|
||||
"phpdocumentor/type-resolver": "^1.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-pdo_sqlite": "*",
|
||||
"friendsofphp/php-cs-fixer": "^3",
|
||||
"illuminate/config": "^9 || ^10 || ^11",
|
||||
"illuminate/view": "^9 || ^10 || ^11",
|
||||
"mockery/mockery": "^1.4",
|
||||
"orchestra/testbench": "^8 || ^9",
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
|
||||
"vimeo/psalm": "^5.4"
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10|^11)."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Barryvdh\\LaravelIdeHelper\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Barry vd. Heuvel",
|
||||
"email": "barryvdh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.",
|
||||
"keywords": [
|
||||
"autocomplete",
|
||||
"codeintel",
|
||||
"helper",
|
||||
"ide",
|
||||
"laravel",
|
||||
"netbeans",
|
||||
"phpdoc",
|
||||
"phpstorm",
|
||||
"sublime"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/barryvdh/laravel-ide-helper/issues",
|
||||
"source": "https://github.com/barryvdh/laravel-ide-helper/tree/v3.0.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://fruitcake.nl",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/barryvdh",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-03-01T12:53:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "barryvdh/reflection-docblock",
|
||||
"version": "v2.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/barryvdh/ReflectionDocBlock.git",
|
||||
"reference": "e6811e927f0ecc37cc4deaa6627033150343e597"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/e6811e927f0ecc37cc4deaa6627033150343e597",
|
||||
"reference": "e6811e927f0ecc37cc4deaa6627033150343e597",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.14|^9"
|
||||
},
|
||||
"suggest": {
|
||||
"dflydev/markdown": "~1.0",
|
||||
"erusev/parsedown": "~1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Barryvdh": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mike van Riel",
|
||||
"email": "mike.vanriel@naenius.com"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/barryvdh/ReflectionDocBlock/tree/v2.1.1"
|
||||
},
|
||||
"time": "2023-06-14T05:06:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/class-map-generator",
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/class-map-generator.git",
|
||||
"reference": "8286a62d243312ed99b3eee20d5005c961adb311"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/class-map-generator/zipball/8286a62d243312ed99b3eee20d5005c961adb311",
|
||||
"reference": "8286a62d243312ed99b3eee20d5005c961adb311",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer/pcre": "^2.1 || ^3.1",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"symfony/finder": "^4.4 || ^5.3 || ^6 || ^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.6",
|
||||
"phpstan/phpstan-deprecation-rules": "^1",
|
||||
"phpstan/phpstan-phpunit": "^1",
|
||||
"phpstan/phpstan-strict-rules": "^1.1",
|
||||
"symfony/filesystem": "^5.4 || ^6",
|
||||
"symfony/phpunit-bridge": "^5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Composer\\ClassMapGenerator\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "https://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Utilities to scan PHP code and generate class maps.",
|
||||
"keywords": [
|
||||
"classmap"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/class-map-generator/issues",
|
||||
"source": "https://github.com/composer/class-map-generator/tree/1.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-03-15T12:53:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/pcre",
|
||||
"version": "3.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/pcre.git",
|
||||
"reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8",
|
||||
"reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.3",
|
||||
"phpstan/phpstan-strict-rules": "^1.1",
|
||||
"symfony/phpunit-bridge": "^5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Composer\\Pcre\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "http://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "PCRE wrapping library that offers type-safe preg_* replacements.",
|
||||
"keywords": [
|
||||
"PCRE",
|
||||
"preg",
|
||||
"regex",
|
||||
"regular expression"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/pcre/issues",
|
||||
"source": "https://github.com/composer/pcre/tree/3.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-03-19T10:26:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/deprecations",
|
||||
"version": "1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/deprecations.git",
|
||||
"reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
|
||||
"reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^9",
|
||||
"phpstan/phpstan": "1.4.10 || 1.10.15",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
||||
"psalm/plugin-phpunit": "0.18.4",
|
||||
"psr/log": "^1 || ^2 || ^3",
|
||||
"vimeo/psalm": "4.30.0 || 5.12.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
|
||||
"homepage": "https://www.doctrine-project.org/",
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/deprecations/issues",
|
||||
"source": "https://github.com/doctrine/deprecations/tree/1.1.3"
|
||||
},
|
||||
"time": "2024-01-30T19:34:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fakerphp/faker",
|
||||
"version": "v1.23.1",
|
||||
|
@ -6348,6 +6685,164 @@
|
|||
},
|
||||
"time": "2022-02-21T01:04:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
"version": "2.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
|
||||
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
|
||||
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-2.x": "2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"phpDocumentor\\Reflection\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jaap van Otterdijk",
|
||||
"email": "opensource@ijaap.nl"
|
||||
}
|
||||
],
|
||||
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
|
||||
"homepage": "http://www.phpdoc.org",
|
||||
"keywords": [
|
||||
"FQSEN",
|
||||
"phpDocumentor",
|
||||
"phpdoc",
|
||||
"reflection",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
|
||||
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
|
||||
},
|
||||
"time": "2020-06-27T09:03:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
"version": "1.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
||||
"reference": "153ae662783729388a584b4361f2545e4d841e3c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c",
|
||||
"reference": "153ae662783729388a584b4361f2545e4d841e3c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/deprecations": "^1.0",
|
||||
"php": "^7.3 || ^8.0",
|
||||
"phpdocumentor/reflection-common": "^2.0",
|
||||
"phpstan/phpdoc-parser": "^1.13"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-tokenizer": "*",
|
||||
"phpbench/phpbench": "^1.2",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"rector/rector": "^0.13.9",
|
||||
"vimeo/psalm": "^4.25"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-1.x": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"phpDocumentor\\Reflection\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mike van Riel",
|
||||
"email": "me@mikevanriel.com"
|
||||
}
|
||||
],
|
||||
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2"
|
||||
},
|
||||
"time": "2024-02-23T11:10:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc",
|
||||
"reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "^2.0",
|
||||
"nikic/php-parser": "^4.15",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^1.5",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symfony/process": "^5.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0"
|
||||
},
|
||||
"time": "2024-05-06T12:04:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "10.1.14",
|
||||
|
|
|
@ -15,10 +15,10 @@ public function up()
|
|||
{
|
||||
Schema::create('notices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->text('raw_content')->comment('原始消息内容');
|
||||
$table->string('err_message')->default('')->comment('处理时错误信息');
|
||||
$table->tinyInteger('state')->default(1)->comment('消息状态,1待消费,2消费进行中,3处理完成');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ public function up()
|
|||
{
|
||||
Schema::create('goods', function (Blueprint $table) {
|
||||
$table->id('itemid')->comment('商品id');
|
||||
$table->timestamps();
|
||||
$table->integer('typeid')->comment('');
|
||||
$table->string('product_name')->comment('商品名');
|
||||
$table->string('product_code')->index()->comment('商品code');
|
||||
|
@ -25,7 +24,7 @@ public function up()
|
|||
$table->integer('category_id')->index()->comment('分类id');
|
||||
$table->string('category_name')->comment('分类名');
|
||||
$table->tinyInteger('state')->default(10)->comment('状态 1正常 2 下架');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ public function up()
|
|||
Schema::create('goods_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('item_id')->index();
|
||||
$table->timestamps();
|
||||
$table->string('brand')->default('')->comment('品牌');
|
||||
$table->string('color_name')->default('')->comment('颜色');
|
||||
$table->string('sell_point')->default('')->comment('卖点');
|
||||
|
@ -27,6 +26,7 @@ public function up()
|
|||
$table->string('product_infos')->default('')->comment('图文信息');
|
||||
$table->string('app_introduce')->default('')->comment('app信息');
|
||||
$table->string('applet_introduce')->default('详情图片地址');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('notices', function (Blueprint $table) {
|
||||
$table->integer('notice_type')->comment('通知type')->after('notice_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('notices', function (Blueprint $table) {
|
||||
$table->dropColumn('notice_type');
|
||||
});
|
||||
}
|
||||
};
|
28
database/migrations/2024_05_25_135703_modify_goods_table.php
Normal file
28
database/migrations/2024_05_25_135703_modify_goods_table.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('goods', function (Blueprint $table) {
|
||||
$table->renameColumn('itemid','id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('goods', function (Blueprint $table) {
|
||||
$table->renameColumn('id','itemid');
|
||||
});
|
||||
}
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('goods', function (Blueprint $table) {
|
||||
$table->integer('itemId')->after('id')->index()->comment('商品id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('goods', function (Blueprint $table) {
|
||||
$table->dropColumn('itemId');
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user