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 { }