ClearanceCalc.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace tw\async\activities;
  3. use think\facade\Config;
  4. // use crmeb\services\async\ActivityCalc;
  5. /**
  6. * 抢清仓活动
  7. *
  8. * 玩法:
  9. * 指定一个清仓分类. 该分类下的所有商品在一个周期内一起开奖,
  10. * 中奖的退款并赔款, 未中奖的安排发货.
  11. *
  12. * 在宣传中, 抢到的发货, 未抢到的退款并赔款.
  13. *
  14. * Class ClearanceCalc
  15. * @package crmeb\services\async
  16. */
  17. class ClearanceCalc extends ActivityCalc
  18. {
  19. // 活动代号
  20. protected static $NAME = 'clr';
  21. protected function getId()
  22. {
  23. return Config::get('activity.clearance_cate_id');
  24. }
  25. protected function getName()
  26. {
  27. return self::$NAME;
  28. }
  29. protected function getNameCN()
  30. {
  31. return '神抢手';
  32. }
  33. // 赔款比例, 为利润的比例
  34. protected function repRate()
  35. {
  36. return 0.3;
  37. }
  38. protected function getMinimalProductNum()
  39. {
  40. return 1;
  41. }
  42. protected function getResult($leftwin = true)
  43. {
  44. return 0;
  45. }
  46. /**
  47. * 分边函数,返回 true 分到左边
  48. *
  49. */
  50. protected function leaningJudge($index, $product, $attr)
  51. {
  52. return $index % 2 != 0;
  53. }
  54. }