OrangeSiteReportSettingService.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Modules\OrangeSite\Services;
  3. use Redis;
  4. class OrangeSiteReportSettingService
  5. {
  6. public static function isEnableReport($channelId)
  7. {
  8. return Redis::hget('channel:setting:' . $channelId, 'orange_site_report');
  9. }
  10. public static function judgeRechargeAmountRange($orderPrice, $rechargeAmountRange)
  11. {
  12. return $orderPrice >= $rechargeAmountRange['min'] && $orderPrice <= $rechargeAmountRange['max'];
  13. }
  14. /**
  15. * 站点回传配置关于金额区间的提取
  16. * 1, 如果没有设置回传配置,默认 30-PHP_INT_MAX
  17. * 2, 如果 设置的上限为0 ,那么默认为 PHP_INT_MAX
  18. * @param $channelCallBackConfig 站点回传配置信息
  19. * @return array
  20. */
  21. public static function buildRechargeAmountRange($channelCallBackConfig)
  22. {
  23. if (!$channelCallBackConfig) {
  24. $min = 30;
  25. $max = PHP_INT_MAX;
  26. $maxStr = '不限';
  27. } else {
  28. $min = max(0, $channelCallBackConfig->min_callback_money);
  29. if (0 >= $channelCallBackConfig->max_callback_money) {
  30. $max = PHP_INT_MAX;
  31. $maxStr = '不限';
  32. } else {
  33. $max = $channelCallBackConfig->max_callback_money;
  34. $maxStr = $max . '元';
  35. }
  36. }
  37. $minStr = $min . '元';
  38. return compact('min', 'max', 'minStr', 'maxStr');
  39. }
  40. }