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.

109 lines
3.9 KiB

  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Constants\v3\ActivityType;
  4. use App\Model\v3\GoodsActivity;
  5. use App\Service\v3\Interfaces\ActivityServiceInterface;
  6. class ActivityService implements ActivityServiceInterface
  7. {
  8. public function do()
  9. {
  10. // TODO: Implement do() method.
  11. }
  12. public function check()
  13. {
  14. // TODO: Implement check() method.
  15. }
  16. public function undo()
  17. {
  18. // TODO: Implement undo() method.
  19. }
  20. public function allForAppletIndex($type, $marketId)
  21. {
  22. return GoodsActivity::query()
  23. ->where(['type' => $type, 'market_id' => $marketId])
  24. ->addSelect('sales as total_sales')
  25. ->get()->toArray();
  26. return [
  27. 'type' => ActivityType::FLASH_SALE,
  28. 'goods' => [
  29. [
  30. 'id' => 1,
  31. 'store_id' => 111,
  32. 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png',
  33. 'name' => '【优质】大白菜',
  34. 'spec' => [
  35. ['key' => '净含量', 'value' => '500g']
  36. ],
  37. 'original_price' => 50.5,
  38. 'price' => 25.25,
  39. 'inventory' => 0,
  40. 'month_sales' => 20,
  41. 'total_sales' => 20,
  42. 'cart_num' => 0,
  43. 'is_effective' => 1,
  44. 'noneffective_note' => '已抢光',
  45. 'total_seconds' => $seconds,
  46. ],[
  47. 'id' => 1,
  48. 'store_id' => 111,
  49. 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png',
  50. 'name' => '【优质】大白菜',
  51. 'spec' => [
  52. ['key' => '净含量', 'value' => '500g']
  53. ],
  54. 'original_price' => 50.5,
  55. 'price' => 25.25,
  56. 'inventory' => 0,
  57. 'month_sales' => 20,
  58. 'total_sales' => 20,
  59. 'cart_num' => 0,
  60. 'is_effective' => 1,
  61. 'noneffective_note' => '已抢光',
  62. 'total_seconds' => $seconds,
  63. ],[
  64. 'id' => 1,
  65. 'store_id' => 111,
  66. 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png',
  67. 'name' => '【优质】大白菜',
  68. 'spec' => [
  69. ['key' => '净含量', 'value' => '500g']
  70. ],
  71. 'original_price' => 50.5,
  72. 'price' => 25.25,
  73. 'inventory' => 0,
  74. 'month_sales' => 20,
  75. 'total_sales' => 20,
  76. 'cart_num' => 0,
  77. 'is_effective' => 1,
  78. 'noneffective_note' => '已抢光',
  79. 'total_seconds' => $seconds,
  80. ],[
  81. 'id' => 1,
  82. 'store_id' => 111,
  83. 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png',
  84. 'name' => '【优质】大白菜',
  85. 'spec' => [
  86. ['key' => '净含量', 'value' => '500g']
  87. ],
  88. 'original_price' => 50.5,
  89. 'price' => 25.25,
  90. 'inventory' => 0,
  91. 'month_sales' => 20,
  92. 'total_sales' => 20,
  93. 'cart_num' => 0,
  94. 'is_effective' => 1,
  95. 'noneffective_note' => '已抢光',
  96. 'total_seconds' => $seconds,
  97. ],
  98. ]
  99. ];
  100. }
  101. }