activity_helper.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 16/8/14
  6. * Time: 下午5:27
  7. */
  8. require_once (BASE_ROOT_PATH . '/helper/activity/groupbuy.php');
  9. require_once (BASE_ROOT_PATH . '/helper/activity/limitime.php');
  10. require_once (BASE_ROOT_PATH . '/helper/activity/bundling.php');
  11. require_once (BASE_ROOT_PATH . '/helper/activity/recommend_combo.php');
  12. require_once (BASE_ROOT_PATH . '/helper/activity/full_sent.php');
  13. require_once (BASE_ROOT_PATH . '/helper/activity/recommend_goods.php');
  14. require_once (BASE_ROOT_PATH . '/helper/activity/goods_gift.php');
  15. require_once (BASE_ROOT_PATH . '/helper/activity/version_checker.php');
  16. require_once (BASE_ROOT_PATH . '/helper/algorithm.php');
  17. //抢,限,推,套装,三个信息会出现在商品的summary 中,其余的出现在商品的详细信息中
  18. class activity_helper
  19. {
  20. const ACTIVITY_NONE = 0;
  21. const ACTIVITY_GROUPBUY = 1; //抢
  22. const ACTIVITY_LIMITTIME = 2; //限
  23. const ACTIVITY_BUNDLING = 3; //套装
  24. public static function take_parted($goods_id,&$act_type)
  25. {
  26. if(activity\groupbuy::instance()->isTakepart($goods_id,$act_id)) { //抢购
  27. $act_type = self::ACTIVITY_GROUPBUY;
  28. return $act_id;
  29. }
  30. elseif(activity\limitime::instance()->isTakepart($goods_id,$act_id)) { //
  31. $act_type = self::ACTIVITY_LIMITTIME;
  32. return $act_id;
  33. }
  34. else {
  35. $act_type = self::ACTIVITY_NONE;
  36. return false;
  37. }
  38. }
  39. public static function have_recommend($goods_id)
  40. {
  41. if (activity\recommend_goods::instance()->isTakepart($goods_id)) {
  42. return true;
  43. } else {
  44. return false;
  45. }
  46. }
  47. public static function have_bundling($goods_id) {
  48. return activity\bundling::instance()->have_bundling($goods_id);
  49. }
  50. public static function bundling_goods($bl_id) {
  51. return activity\bundling::instance()->bundling_goods($bl_id);
  52. }
  53. //赠品信息
  54. public static function have_gift($goods_id) {
  55. return activity\goods_gift::instance()->have_gift($goods_id);
  56. }
  57. public static function goods_gifts($goods_id) {
  58. return activity\goods_gift::instance()->gifts($goods_id);
  59. }
  60. //商品组合
  61. public static function have_combo($goods_id) {
  62. return activity\recommend_combo::instance()->have_combo($goods_id);
  63. }
  64. public static function combo_goods($goods_id) {
  65. return activity\recommend_combo::instance()->combo_goods($goods_id);
  66. }
  67. //满赠活动
  68. public static function fullsent_contents() {
  69. return activity\full_sent::instance()->contents();
  70. }
  71. //推荐商品列表
  72. public static function recomoned_goodsids()
  73. {
  74. return \activity\recommend_goods::instance()->goods_ids();
  75. }
  76. }