feat(cronjob): implement CronJobProcessor and CronJobRepository for job scheduling and processing
- Added CronJobProcessor class to handle job creation and queue processing. - Implemented CronJobRepository for database interactions related to cron jobs. - Introduced CronJobType class to define job types, priorities, and statuses. - Created ApiloLogger for logging actions related to job processing. - Initialized apilo-sync-queue.json for job queue management.
This commit is contained in:
@@ -177,9 +177,10 @@ class App
|
||||
'ShopOrder' => function() {
|
||||
global $mdb;
|
||||
$orderRepo = new \Domain\Order\OrderRepository( $mdb );
|
||||
$cronJobRepo = new \Domain\CronJob\CronJobRepository( $mdb );
|
||||
return new \front\Controllers\ShopOrderController(
|
||||
$orderRepo,
|
||||
new \Domain\Order\OrderAdminService( $orderRepo )
|
||||
new \Domain\Order\OrderAdminService( $orderRepo, null, null, null, $cronJobRepo )
|
||||
);
|
||||
},
|
||||
'ShopProducer' => function() {
|
||||
|
||||
@@ -132,6 +132,11 @@ class ShopBasketController
|
||||
$attributes[] = $val;
|
||||
}
|
||||
|
||||
// Sort by attribute ID to match permutation_hash order (generated with ksort)
|
||||
usort( $attributes, function ( $a, $b ) {
|
||||
return (int) explode( '-', $a )[0] - (int) explode( '-', $b )[0];
|
||||
} );
|
||||
|
||||
foreach( $values as $key => $val )
|
||||
{
|
||||
if ( strpos( $key, 'custom_field' ) !== false )
|
||||
@@ -372,7 +377,9 @@ class ShopBasketController
|
||||
'transport_id' => \Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' ),
|
||||
'transport_methods' => \Shared\Tpl\Tpl::view( 'shop-basket/basket-transport-methods', [
|
||||
'transports_methods' => ( new \Domain\Transport\TransportRepository( $GLOBALS['mdb'] ) )->transportMethodsFront( $basket, $coupon ),
|
||||
'transport_id' => $basket_transport_method_id
|
||||
'transport_id' => $basket_transport_method_id,
|
||||
'free_delivery' => (float)($settings['free_delivery'] ?? 0),
|
||||
'basket_summary' => (float)\Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon )
|
||||
] ),
|
||||
'payment_method_id' => $payment_method_id,
|
||||
'basket_details' => \Shared\Tpl\Tpl::view( 'shop-basket/basket-details', [
|
||||
@@ -387,6 +394,8 @@ class ShopBasketController
|
||||
|
||||
private function jsonBasketResponse( $basket, $coupon, $lang_id, $basket_transport_method_id )
|
||||
{
|
||||
global $settings;
|
||||
|
||||
echo json_encode( [
|
||||
'basket' => \Shared\Tpl\Tpl::view( 'shop-basket/basket-details', [
|
||||
'basket' => $basket,
|
||||
@@ -398,7 +407,9 @@ class ShopBasketController
|
||||
'products_count' => count( $basket ),
|
||||
'transport_methods' => \Shared\Tpl\Tpl::view( 'shop-basket/basket-transport-methods', [
|
||||
'transports_methods' => ( new \Domain\Transport\TransportRepository( $GLOBALS['mdb'] ) )->transportMethodsFront( $basket, $coupon ),
|
||||
'transport_id' => $basket_transport_method_id
|
||||
'transport_id' => $basket_transport_method_id,
|
||||
'free_delivery' => (float)($settings['free_delivery'] ?? 0),
|
||||
'basket_summary' => (float)\Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon )
|
||||
] )
|
||||
] );
|
||||
exit;
|
||||
|
||||
@@ -80,16 +80,17 @@ class ShopProductController
|
||||
{
|
||||
global $lang_id;
|
||||
|
||||
$combination = '';
|
||||
$selected_values = \Shared\Helpers\Helpers::get( 'selected_values' );
|
||||
|
||||
foreach ( $selected_values as $value )
|
||||
{
|
||||
$combination .= $value;
|
||||
if ( $value != end( $selected_values ) )
|
||||
$combination .= '|';
|
||||
// Sort by attribute ID to match permutation_hash order (generated with ksort)
|
||||
if ( is_array( $selected_values ) ) {
|
||||
usort( $selected_values, function ( $a, $b ) {
|
||||
return (int) explode( '-', $a )[0] - (int) explode( '-', $b )[0];
|
||||
} );
|
||||
}
|
||||
|
||||
$combination = is_array( $selected_values ) ? implode( '|', $selected_values ) : '';
|
||||
|
||||
$product_id = \Shared\Helpers\Helpers::get( 'product_id' );
|
||||
$productRepo = new \Domain\Product\ProductRepository( $GLOBALS['mdb'] );
|
||||
$product = $productRepo->findCached( $product_id, $lang_id );
|
||||
@@ -102,6 +103,10 @@ class ShopProductController
|
||||
private static function getPermutation( $attributes )
|
||||
{
|
||||
if ( !is_array( $attributes ) || !count( $attributes ) ) return null;
|
||||
// Sort by attribute ID to match permutation_hash order (generated with ksort)
|
||||
usort( $attributes, function ( $a, $b ) {
|
||||
return (int) explode( '-', $a )[0] - (int) explode( '-', $b )[0];
|
||||
} );
|
||||
return implode( '|', $attributes );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user