|
@@ -130,5 +130,132 @@ class BookGiftsService
|
|
return BookGiftsStatsByGift::getStats();
|
|
return BookGiftsStatsByGift::getStats();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static function chargeGiveGift($property,$price,$charge_type){
|
|
|
|
+ if(!$property) return [];
|
|
|
|
+ $gift_info = [
|
|
|
|
+ 1=>['name_desc'=>'黄金玫瑰','cost'=>200,'icon'=>'https://yqcdn.iycdm.com/wap/present/20181016/3.png'],
|
|
|
|
+ 2=>['name_desc'=>'文学奖','cost'=>800,'icon'=>'https://yqcdn.iycdm.com/wap/present/20181016/5.png'],
|
|
|
|
+ 3=>['name_desc'=>'锦囊','cost'=>500,'icon'=>'https://yqcdn.iycdm.com/wap/present/20181016/4.png'],
|
|
|
|
+ 4=>['name_desc'=>'小皮鞭','cost'=>200,'icon'=>'https://yqcdn.iycdm.com/wap/present/20181016/6.png'],
|
|
|
|
+ 5=>['name_desc'=>'催更票','cost'=>100,'icon'=>'https://yqcdn.iycdm.com/wap/present/20181016/1.png'],
|
|
|
|
+ 6=>['name_desc'=>'点个赞','cost'=>50,'icon'=>'https://yqcdn.iycdm.com/wap/present/20181016/2.png'],
|
|
|
|
+ 7=>['name_desc'=>'文房四宝','cost'=>100,'icon'=>'https://cdn-novel.iycdm.com/h5/20181107/four_literature_tools.png'],
|
|
|
|
+ 8=>['name_desc'=>'至尊大神','cost'=>1800,'icon'=>'https://cdn-novel.iycdm.com/h5/20181107/literature_emprior.png'],
|
|
|
|
+ ];
|
|
|
|
+ if($property == 'none' || $property == 'low'){
|
|
|
|
+ $gift = [];
|
|
|
|
+ if($price <18 && $price >=2){
|
|
|
|
+ $gift = [['gift_id'=>6,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']];
|
|
|
|
+ }elseif ($price <30){
|
|
|
|
+ $gift = [['gift_id'=>6,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']];
|
|
|
|
+ }elseif($price < 50 ){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>6,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }elseif ($price <100){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>6,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }elseif ($price <200){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>2,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }elseif ($price >=200){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>2,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>8,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ if($charge_type == 'YEAR_ORDER'){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>1,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>2,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>6,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>8,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ if($gift){
|
|
|
|
+ foreach ($gift as $item){
|
|
|
|
+ $item['name_desc'] = $gift_info[$item['gift_id']];
|
|
|
|
+ $item['cost'] = $gift_info[$item['cost']];
|
|
|
|
+ $item['icon'] = $gift_info[$item['icon']];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $gift;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($property == 'high' || $property == 'medium'){
|
|
|
|
+ $gift = [];
|
|
|
|
+ if($price <30 && $price >=18){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>6,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }elseif($price < 50 ){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>6,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }elseif ($price <100){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>6,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }elseif ($price <200){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>7,'num'=>3,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>2,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
|
|
|
|
+ }elseif ($price >=200){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>7,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>1,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>2,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>8,'num'=>1,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ if($charge_type == 'YEAR_ORDER'){
|
|
|
|
+ $gift = [
|
|
|
|
+ ['gift_id'=>1,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>2,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>3,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>6,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>7,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>''],
|
|
|
|
+ ['gift_id'=>8,'num'=>2,'name_desc'=>'','cost'=>'','icon'=>'']
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ if($gift){
|
|
|
|
+ foreach ($gift as $item){
|
|
|
|
+ $item['name_desc'] = $gift_info[$item['gift_id']];
|
|
|
|
+ $item['cost'] = $gift_info[$item['cost']];
|
|
|
|
+ $item['icon'] = $gift_info[$item['icon']];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $gift;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return [];
|
|
|
|
+ }
|
|
}
|
|
}
|