From 9529d68d38655784bf8d98d45741755b765e826f Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Thu, 6 Jul 2023 18:05:54 +0800 Subject: [PATCH] Publish JD product. --- beike/Admin/Services/ProductService.php | 8 +-- composer.json | 1 + composer.lock | 81 ++++++++++++++++++++++++- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/beike/Admin/Services/ProductService.php b/beike/Admin/Services/ProductService.php index b03e36ad..ef13f809 100644 --- a/beike/Admin/Services/ProductService.php +++ b/beike/Admin/Services/ProductService.php @@ -26,10 +26,10 @@ class ProductService try { DB::beginTransaction(); - $data['brand_id'] = (int) $data['brand_id']; - $data['position'] = (int) $data['position']; - $data['weight'] = (float) $data['weight']; - $data['variables'] = json_decode($data['variables']); + $data['brand_id'] = (int) ($data['brand_id'] ?? 0); + $data['position'] = (int) ($data['position'] ?? 0); + $data['weight'] = (float) ($data['weight'] ?? 0); + $data['variables'] = json_decode($data['variables'] ?? ''); $product->fill($data); $product->updated_at = now(); $product->save(); diff --git a/composer.json b/composer.json index 05a86d22..547a3eac 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "spatie/laravel-permission": "^5.5", "srmklive/paypal": "^3.0", "stripe/stripe-php": "^8.8", + "symfony/dom-crawler": "^6.0", "tormjens/eventy": "^0.8.0", "tymon/jwt-auth": "^2.0", "ultrono/laravel-sitemap": "^9.1", diff --git a/composer.lock b/composer.lock index d9e2d03a..57825179 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "1c71b8ebdb3694859ad0a09bc3798d35", + "content-hash": "dc9edf92dba52d6800988b3ed8a5a69c", "packages": [ { "name": "brick/math", @@ -5346,6 +5346,85 @@ ], "time": "2022-01-02T09:55:41+00:00" }, + { + "name": "symfony/dom-crawler", + "version": "v6.0.19", + "source": { + "type": "git", + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "622578ff158318b1b49d95068bd6b66c713601e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/622578ff158318b1b49d95068bd6b66c713601e9", + "reference": "622578ff158318b1b49d95068bd6b66c713601e9", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=8.0.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "masterminds/html5": "<2.6" + }, + "require-dev": { + "masterminds/html5": "^2.6", + "symfony/css-selector": "^5.4|^6.0" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases DOM navigation for HTML and XML documents", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/dom-crawler/tree/v6.0.19" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-20T17:44:14+00:00" + }, { "name": "symfony/error-handler", "version": "v6.0.19",