Procházet zdrojové kódy

获取影院场次列表:影片售价溢价20%售卖,同时计算养老金、pv

family před 1 rokem
rodič
revize
ba4a8f7edf
1 změnil soubory, kde provedl 23 přidání a 1 odebrání
  1. 23 1
      app/common/repositories/movie/MovieRepository.php

+ 23 - 1
app/common/repositories/movie/MovieRepository.php

@@ -28,6 +28,11 @@ class MovieRepository extends BaseRepository
28 28
 
29 29
     protected $dao;
30 30
 
31
+    private $premium_ratio = 0.2;//溢价比例
32
+    private $yanglaojin_ratio = 0.3;
33
+
34
+    private $pv_ratio = 0.7;
35
+
31 36
     /**
32 37
      * ProductRepository constructor.
33 38
      * @param MovieOrderDao $dao
@@ -89,7 +94,24 @@ class MovieRepository extends BaseRepository
89 94
      */
90 95
     public function getCinemaSched($film_sign = '', $cinema_sign = '')
91 96
     {
92
-        return DouHuoMallFilmApiRequest::getCinemaSched($film_sign, $cinema_sign);
97
+        $result = DouHuoMallFilmApiRequest::getCinemaSched($film_sign, $cinema_sign);
98
+        $cinemaSchedList = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
99
+            ? $result['data']['list'] : [];
100
+        foreach ($cinemaSchedList as $dateDay => &$fileSchedValue) {
101
+            foreach ($fileSchedValue as $key => $value) {
102
+                $premium = round($value['cost_price'] * $this->premium_ratio, 2);
103
+
104
+                $fileSchedValue[$key]['cost_price'] = bcadd((string)$value['cost_price'], (string)$premium, 2);
105
+
106
+                $pv = bcmul((string)$premium, $this->pv_ratio, 2);
107
+                $fileSchedValue[$key]['yanglaojin'] = bcmul((string)$premium, $this->yanglaojin_ratio, 2);
108
+                $fileSchedValue[$key]['pv'] = $fileSchedValue[$key]['score'] = $fileSchedValue[$key]['gongxian'] = $pv;
109
+
110
+                unset($fileSchedValue[$key]['channel_price']);
111
+            }
112
+        }
113
+
114
+        return $cinemaSchedList;
93 115
     }
94 116
 
95 117
     /**