| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- class LewaimaiPaotui {
- //设置二维码推广下单的用户
- //paotui_type 1:代买 2:代送 3:代炮队 4:代办事
- public static function GetPaotuiMinFee($stationrunModel, $paotui_type)
- {
- $is_time_paotui = false;
- if ($paotui_type == 1)
- {
- $min_fee = $stationrunModel->buy;
- $timelist = $stationrunModel->buylist;
-
- if ($stationrunModel->is_timebuy)
- {
- $is_time_paotui = true;
- }
- }
- elseif ($paotui_type == 2)
- {
- $min_fee = $stationrunModel->send;
- $timelist = $stationrunModel->sendlist;
-
- if ($stationrunModel->is_timesend)
- {
- $is_time_paotui = true;
- }
- }
- elseif ($paotui_type == 3)
- {
- $min_fee = $stationrunModel->queue;
- $timelist = $stationrunModel->queuelist;
-
- if ($stationrunModel->is_timequeue)
- {
- $is_time_paotui = true;
- }
- }
- elseif ($paotui_type == 4)
- {
- $min_fee = $stationrunModel->acting;
- $timelist = $stationrunModel->actinglist;
-
- if ($stationrunModel->is_timeacting)
- {
- $is_time_paotui = true;
- }
- }
- else
- {
- $min_fee = 5;
- $timelist = "[]";
- }
-
- if (!$is_time_paotui)
- {
- return $min_fee;
- }
-
- $snow = strtotime(date("H:i"));
- //Yii::log("snow:" . $snow);
-
- //Yii::log("snow cur:" . time());
-
- //Yii::log("start:" . strtotime("22:00") . " stop:" . strtotime("23:59"));
- //Yii::log("test:" . strtotime("23:14"));
-
- $timelistarray = json_decode($timelist, true);
- foreach ($timelistarray as $time)
- {
- $begintime = $time["start"];
- $endtime = $time["stop"];
-
- $isInTimeRange = false;
-
- $sst1 = strtotime($begintime);
- $set1 = strtotime($endtime);
-
- //Yii::log("begintime:" . $begintime . " endtime:" . $endtime . " sst1:" . $sst1 . " set1:" . $set1);
-
- if ($sst1 <= $set1)
- {
- if (($snow >= $sst1 && $snow <= $set1) )
- {
- $isInTimeRange = true;
- }
- }
- else
- {
- if (($snow >= $sst1 || $snow <= $set1) )
- {
- $isInTimeRange = true;
- }
- }
-
- if ($isInTimeRange)
- {
- $min_fee += $time["price"];
-
- break;
- }
- }
-
- return $min_fee;
- }
- }
|