Publish JD product.

This commit is contained in:
Edward Yang 2023-07-06 18:05:54 +08:00
parent ef14e65e31
commit 9529d68d38
3 changed files with 85 additions and 5 deletions

View File

@ -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();

View File

@ -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",

81
composer.lock generated
View File

@ -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",