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.

48 lines
1.6 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Service;
  3. use Hyperf\Di\Annotation\Inject;
  4. use Hyperf\DbConnection\Db;
  5. use App\Model\Goods;
  6. use App\Model\Combination;
  7. use App\Model\ShopCar;
  8. use App\Constants\LogLabel;
  9. use App\Commons\Log;
  10. use Hyperf\Utils\ApplicationContext;
  11. use App\TaskWorker\SSDBTask;
  12. use App\Constants\SsdbKeysPrefix;
  13. class PurchaseLimitService implements PurchaseLimitServiceInterface
  14. {
  15. public function getStoreIdByMarketId($params)
  16. {
  17. $res = [
  18. 'id' => 7,
  19. 'item' => 1,
  20. 'item_text' => 'page',
  21. 'logo' => 'http://lanzutest.lanzulive.com/attachment/images/2/2020/08/PY55Y3Mz17yJo17rv1Z7vImX1V5159.jpg',
  22. 'redirect_url' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=123',
  23. 'src' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=123',
  24. 'src2' => '/zh_cjdianc/pages/takeout/takeoutindex?storeid=123',
  25. ];
  26. return $res;
  27. }
  28. public function ssdbPurchaseRecord($params)
  29. {
  30. $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
  31. $ssdb->exec('set', SsdbKeysPrefix::PURCHASE_RECORD. date('Ymd') .'_'.$params['user_id'].'_'.$params['good_id'], $params['order_id']);
  32. $ssdb->exec('expire', SsdbKeysPrefix::PURCHASE_RECORD. date('Ymd') .'_'.$params['user_id'].'_'.$params['good_id'],60);
  33. }
  34. public function test($params)
  35. {
  36. $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
  37. //添加领取记录到ssdb
  38. $data = [
  39. '620',1561,
  40. ];
  41. $test = $ssdb->exec('multi_hset', SsdbKeysPrefix::PURCHASE_RECORD. date('Ymd') .'_620', $data);
  42. return $test;
  43. }
  44. }