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.

39 lines
1.1 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Constants\v3\SsdbKeys;
  4. use App\Model\v3\SystemConfig;
  5. use App\Service\v3\Interfaces\InitialDeliveryServiceInterface;
  6. use Hyperf\Utils\ApplicationContext;
  7. use App\TaskWorker\SSDBTask;
  8. class InitialDeliveryService implements InitialDeliveryServiceInterface
  9. {
  10. public function do()
  11. {
  12. // TODO: Implement do() method.
  13. }
  14. public function check()
  15. {
  16. // TODO: Implement check() method.
  17. }
  18. public function undo()
  19. {
  20. // TODO: Implement undo() method.
  21. }
  22. public function get()
  23. {
  24. $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
  25. $intialDelivery = $ssdb->exec('get',SsdbKeys::INTIAL_DELIVERY_AMOUNT);
  26. if($intialDelivery === false || empty($intialDelivery)) {
  27. $systemConfig = SystemConfig::query()->where('menu_name','initial_delivery_amount')->first();
  28. $intialDelivery = number_format($systemConfig->value,2);
  29. $ssdb->exec('setnx',SsdbKeys::INTIAL_DELIVERY_AMOUNT,$intialDelivery);
  30. return $intialDelivery;
  31. }
  32. return $intialDelivery;
  33. }
  34. }