You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.1 KiB

<?php
namespace App\Service\v3\Implementations;
use App\Constants\v3\SsdbKeys;
use App\Model\v3\SystemConfig;
use App\Service\v3\Interfaces\InitialDeliveryServiceInterface;
use Hyperf\Utils\ApplicationContext;
use App\TaskWorker\SSDBTask;
class InitialDeliveryService implements InitialDeliveryServiceInterface
{
public function do()
{
// TODO: Implement do() method.
}
public function check()
{
// TODO: Implement check() method.
}
public function undo()
{
// TODO: Implement undo() method.
}
public function get()
{
$ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
$intialDelivery = $ssdb->exec('get',SsdbKeys::INTIAL_DELIVERY_AMOUNT);
if($intialDelivery === false || empty($intialDelivery)) {
$systemConfig = SystemConfig::query()->where('menu_name','initial_delivery_amount')->first();
$intialDelivery = number_format($systemConfig->value,2);
$ssdb->exec('setnx',SsdbKeys::INTIAL_DELIVERY_AMOUNT,$intialDelivery);
return $intialDelivery;
}
return $intialDelivery;
}
}