ActivitySwitchService.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Modules\Activity\Services;
  3. use App\Modules\Activity\Models\Activity;
  4. use App\Modules\Activity\Models\ActivitySwitch;
  5. use App\Modules\Statistic\Services\WapVisitStatService;
  6. use App\Modules\Subscribe\Models\Order;
  7. use App\Modules\Trade\Services\OrderService;
  8. use DB;
  9. use Redis;
  10. class ActivitySwitchService
  11. {
  12. /**
  13. * 更新活动控制开关
  14. * @param $activity_id
  15. * @param $params
  16. * @return mixed
  17. */
  18. static function updateShowSwitch($activity_id, $distribution_channel_id, $is_reader_page_show, $is_sign_message_show)
  19. {
  20. return ActivitySwitch::updateShowSwitch($activity_id, $distribution_channel_id, $is_reader_page_show, $is_sign_message_show);
  21. }
  22. /**
  23. * 更新活动控制开关
  24. * @param $activity_id
  25. * @param $params
  26. * @return mixed
  27. */
  28. static function add($data)
  29. {
  30. return ActivitySwitch::add($data);
  31. }
  32. /**
  33. * 获取活动开关信息
  34. * @param $activity_id
  35. * @param $distribution_channel_id
  36. * @return mixed
  37. */
  38. static function getInfo($activity_id, $distribution_channel_id)
  39. {
  40. return ActivitySwitch::getInfo($activity_id, $distribution_channel_id);
  41. }
  42. /**
  43. * 活动展示情况
  44. * @param $activity_id
  45. * @param $distribution_channel_id
  46. * @param string $type
  47. * @return int
  48. */
  49. static function isShowInPage($activity_id,$distribution_channel_id,$type='reader'){
  50. $info = self::getInfo($activity_id,$distribution_channel_id);
  51. if(!$info){
  52. //默认显示
  53. return 1;
  54. }
  55. if($type == 'reader'){
  56. return $info->is_reader_page_show;
  57. }
  58. if($type == 'sign'){
  59. return $info->is_sign_message_show;
  60. }
  61. return 1;
  62. }
  63. }