zz 4 anos atrás
pai
commit
67b18f3202

Diferenças do arquivo suprimidas por serem muito extensas
+ 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;
+    }
 }