feat: Update product name handling in API and Cron classes to improve data consistency
This commit is contained in:
8
.vscode/ftp-kr.sync.cache.json
vendored
8
.vscode/ftp-kr.sync.cache.json
vendored
@@ -9,8 +9,8 @@
|
||||
},
|
||||
"api.php": {
|
||||
"type": "-",
|
||||
"size": 14061,
|
||||
"lmtime": 1773062440871,
|
||||
"size": 18156,
|
||||
"lmtime": 1773088345243,
|
||||
"modified": false
|
||||
},
|
||||
"autoload": {
|
||||
@@ -302,8 +302,8 @@
|
||||
"docs": {
|
||||
"api-public-product-management.md": {
|
||||
"type": "-",
|
||||
"size": 9285,
|
||||
"lmtime": 1773062594801,
|
||||
"size": 12452,
|
||||
"lmtime": 1773088360435,
|
||||
"modified": false
|
||||
},
|
||||
"class-methods.md": {
|
||||
|
||||
@@ -415,13 +415,6 @@ class Api
|
||||
else
|
||||
{
|
||||
$offer_id = $mdb -> get( 'products', 'id', [ 'AND' => [ 'client_id' => $data['client_id'], 'offer_id' => $offer['OfferId'] ] ] );
|
||||
|
||||
$offer_current_name = $mdb -> get( 'products', 'name', [ 'AND' => [ 'client_id' => $data['client_id'], 'offer_id' => $offer['OfferId'] ] ] );
|
||||
|
||||
if ( $offer_current_name != $offer['ProductTitle'] and $data['date'] == date( 'Y-m-d', strtotime( '-1 days', time() ) ) )
|
||||
{
|
||||
$mdb -> update( 'products', [ 'name' => $offer['ProductTitle'] ], [ 'AND' => [ 'client_id' => $data['client_id'], 'offer_id' => $offer['OfferId'] ] ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $offer_id )
|
||||
@@ -539,12 +532,6 @@ class Api
|
||||
else
|
||||
{
|
||||
$product_id = $mdb -> get( 'products', 'id', [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
|
||||
$offer_current_name = $mdb -> get( 'products', 'name', [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
|
||||
|
||||
if ( $offer_current_name != $product_title and $date == date( 'Y-m-d', strtotime( '-1 days', time() ) ) )
|
||||
{
|
||||
$mdb -> update( 'products', [ 'name' => $product_title ], [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$product_id )
|
||||
|
||||
@@ -1379,13 +1379,6 @@ class Cron
|
||||
else
|
||||
{
|
||||
$product_id = (int) ( $existing_product['id'] ?? 0 );
|
||||
$offer_current_name = (string) ( $existing_product['name'] ?? '' );
|
||||
|
||||
if ( $offer_current_name != $product_title and $date == date( 'Y-m-d', strtotime( '-1 days' ) ) )
|
||||
{
|
||||
$mdb -> update( 'products', [ 'name' => $product_title ], [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
|
||||
$products_by_offer_id[ $offer_external_id ]['name'] = $product_title;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$product_id )
|
||||
|
||||
Reference in New Issue
Block a user