From 35e0df7d33b755d12c22185a776eb0656f08f3fd Mon Sep 17 00:00:00 2001 From: zhouchangcheng Date: Mon, 27 May 2024 16:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/HandleNotice.php | 7 ++++--- app/Jobs/notice.php | 4 ++++ app/Models/Good.php | 12 ++++++++++++ app/Models/GoodsItem.php | 13 +++++++++++++ app/Models/Notice.php | 11 ++++++++--- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/HandleNotice.php b/app/Console/Commands/HandleNotice.php index b37c541..2a7cb46 100644 --- a/app/Console/Commands/HandleNotice.php +++ b/app/Console/Commands/HandleNotice.php @@ -4,6 +4,7 @@ use App\helpers\apiRequest; use App\Models\Notice; +use Exception; use GuzzleHttp\Exception\GuzzleException; use Illuminate\Console\Command; use Illuminate\Contracts\Console\Isolatable; @@ -32,7 +33,7 @@ class HandleNotice extends Command implements Isolatable */ public function __construct() { - parent::__construct();; + parent::__construct(); } /** @@ -45,7 +46,7 @@ public function handle(): int { $chunk = $this->argument('chunk'); $this->info(date('Y-m-d H:i:s') . ' 开始消息队列'); - $res = apiRequest::api('/Notic/getNotics', []); + $res = apiRequest::api('/Notic/getNotics'); if (!$res['result'] || $res['errCode'] != '0000') { $this->error('request err: ' . $res['desc'] ?? ''); return 1; @@ -84,7 +85,7 @@ public function handle(): int } try { Notice::insert($notices); - } catch (\Exception $exception) { + } catch (Exception $exception) { $this->error('insert err:' . $exception->getMessage()); continue; } diff --git a/app/Jobs/notice.php b/app/Jobs/notice.php index 0d48dde..5e140d3 100644 --- a/app/Jobs/notice.php +++ b/app/Jobs/notice.php @@ -144,6 +144,10 @@ public function addGoods(): void } } + /** + * @throws GuzzleException + * @throws Exception + */ public function updateGoods(): void { $this->client = new Client(); diff --git a/app/Models/Good.php b/app/Models/Good.php index 9f8ff93..b9ae3d0 100644 --- a/app/Models/Good.php +++ b/app/Models/Good.php @@ -5,6 +5,18 @@ use Illuminate\Database\Eloquent\Relations\HasOne; /** + * @property int $itemid + * @property int $typeid + * @property string $product_name + * @property string $product_code + * @property string $product_group + * @property float $market_price + * @property float $settlement + * @property int $category_id + * @property string $category_name + * @property int $state + * @property string $created_at + * @property string $updated_at * @property GoodsItem $item */ class Good extends Base diff --git a/app/Models/GoodsItem.php b/app/Models/GoodsItem.php index 29f91d9..0f64678 100644 --- a/app/Models/GoodsItem.php +++ b/app/Models/GoodsItem.php @@ -6,6 +6,19 @@ /** + * @property int $item_id + * @property string $brand + * @property string $color_name + * @property string $sell_point + * @property string $specifications + * @property string $shop_url + * @property string $product_images + * @property string $images + * @property string $product_infos + * @property string $app_introduce + * @property string $applet_introduce + * @property string $created_at + * @property string $updated_at * @property Good $good */ class GoodsItem extends Base diff --git a/app/Models/Notice.php b/app/Models/Notice.php index f22a939..1ea9d4f 100644 --- a/app/Models/Notice.php +++ b/app/Models/Notice.php @@ -2,9 +2,14 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; - +/** + * @property int $notice_id + * @property int $notice_type + * @property string $raw_content + * @property int $state + * @property string $created_at + * @property string $updated_at + */ class Notice extends Base { }