zz 4 년 전
부모
커밋
67b18f3202
2개의 변경된 파일40개의 추가작업 그리고 1120개의 파일을 삭제
  1. 10 1120
      app/Http/Controllers/Wap/Book/ChapterController.php
  2. 30 0
      app/Modules/Book/Services/BookService.php

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 10 - 1120
app/Http/Controllers/Wap/Book/ChapterController.php


+ 30 - 0
app/Modules/Book/Services/BookService.php

@@ -170,4 +170,34 @@ class BookService
         ]);
         return 0;
     }
+
+    public static function getPrice($book_info,$distribution_channel_id,$size){
+        $calculate_price_type = $book_info->calculate_price_type;
+        $channel_calculate_price_type = Redis::hget('channel:charge_type:setting:' . $distribution_channel_id,  $book_info->bid);
+        if($channel_calculate_price_type){
+            $calculate_price_type = $channel_calculate_price_type;
+        }
+
+        //固定价格
+        if(strtolower($calculate_price_type) == 'const'){
+            $price = (int)$book_info->unit_price;
+            return $price;
+        }
+        //千字价格
+        $channel_fee = self::getChapterPrice($distribution_channel_id);
+        if ($channel_fee) {
+            $price_rate = $channel_fee / 100;
+        } else {
+            $price_rate = env('DEFAULT_CHAPTER_PRICE', 0.015);
+        }
+
+        if($book_info->unit_price){
+            $price_rate = $book_info->unit_price;
+        }
+
+        $fee = ceil($size * $price_rate);
+        if($fee >189) $fee = 189;
+        if($fee <37) $fee = 37;
+        return $fee;
+    }
 }