LewaimaiPaotui.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. class LewaimaiPaotui {
  3. //设置二维码推广下单的用户
  4. //paotui_type 1:代买 2:代送 3:代炮队 4:代办事
  5. public static function GetPaotuiMinFee($stationrunModel, $paotui_type)
  6. {
  7. $is_time_paotui = false;
  8. if ($paotui_type == 1)
  9. {
  10. $min_fee = $stationrunModel->buy;
  11. $timelist = $stationrunModel->buylist;
  12. if ($stationrunModel->is_timebuy)
  13. {
  14. $is_time_paotui = true;
  15. }
  16. }
  17. elseif ($paotui_type == 2)
  18. {
  19. $min_fee = $stationrunModel->send;
  20. $timelist = $stationrunModel->sendlist;
  21. if ($stationrunModel->is_timesend)
  22. {
  23. $is_time_paotui = true;
  24. }
  25. }
  26. elseif ($paotui_type == 3)
  27. {
  28. $min_fee = $stationrunModel->queue;
  29. $timelist = $stationrunModel->queuelist;
  30. if ($stationrunModel->is_timequeue)
  31. {
  32. $is_time_paotui = true;
  33. }
  34. }
  35. elseif ($paotui_type == 4)
  36. {
  37. $min_fee = $stationrunModel->acting;
  38. $timelist = $stationrunModel->actinglist;
  39. if ($stationrunModel->is_timeacting)
  40. {
  41. $is_time_paotui = true;
  42. }
  43. }
  44. else
  45. {
  46. $min_fee = 5;
  47. $timelist = "[]";
  48. }
  49. if (!$is_time_paotui)
  50. {
  51. return $min_fee;
  52. }
  53. $snow = strtotime(date("H:i"));
  54. //Yii::log("snow:" . $snow);
  55. //Yii::log("snow cur:" . time());
  56. //Yii::log("start:" . strtotime("22:00") . " stop:" . strtotime("23:59"));
  57. //Yii::log("test:" . strtotime("23:14"));
  58. $timelistarray = json_decode($timelist, true);
  59. foreach ($timelistarray as $time)
  60. {
  61. $begintime = $time["start"];
  62. $endtime = $time["stop"];
  63. $isInTimeRange = false;
  64. $sst1 = strtotime($begintime);
  65. $set1 = strtotime($endtime);
  66. //Yii::log("begintime:" . $begintime . " endtime:" . $endtime . " sst1:" . $sst1 . " set1:" . $set1);
  67. if ($sst1 <= $set1)
  68. {
  69. if (($snow >= $sst1 && $snow <= $set1) )
  70. {
  71. $isInTimeRange = true;
  72. }
  73. }
  74. else
  75. {
  76. if (($snow >= $sst1 || $snow <= $set1) )
  77. {
  78. $isInTimeRange = true;
  79. }
  80. }
  81. if ($isInTimeRange)
  82. {
  83. $min_fee += $time["price"];
  84. break;
  85. }
  86. }
  87. return $min_fee;
  88. }
  89. }