wesmiler пре 2 година
родитељ
комит
c16a511e06
2 измењених фајлова са 13 додато и 4 уклоњено
  1. 12 3
      app/Services/Api/GoodsService.php
  2. 1 1
      app/Services/Api/MemberService.php

+ 12 - 3
app/Services/Api/GoodsService.php

@@ -127,8 +127,13 @@ class GoodsService extends BaseService
                 $usdtCnyPrice = ConfigService::make()->getConfigByCode('usdt_cny_price', 7.2);
                 $usdtPrice = $usdtCnyPrice>0 && $usdtCnyPrice< 100? $usdtCnyPrice : 0;
             }
+
             $xdPrice = ConfigService::make()->getConfigByCode('xd_price', 100);
             $xdPrice = $xdPrice > 0 && $xdPrice <= 10000 ? $xdPrice : 100;
+            $awardWaitRate = ConfigService::make()->getConfigByCode('shop_award_score_rate', 0);
+            $awardWaitRate = $awardWaitRate>0 && $awardWaitRate<1000? $awardWaitRate : 0;
+            $waitRate = ConfigService::make()->getConfigByCode('day_wait_score_num', 0);
+            $waitRate = $waitRate>0 && $waitRate<100? $waitRate : 0;
             foreach ($list['data'] as &$item) {
                 $item['detail_img'] = isset($item['detail_img']) && $item['detail_img'] ? json_decode($item['detail_img'], true) : [];
                 $item['supply_name'] = isset($supplyList[$item['supply_type']]) ? $supplyList[$item['supply_type']] : '';
@@ -136,10 +141,9 @@ class GoodsService extends BaseService
                 $item['xd_price_rate'] = $xdPrice;
                 $item['retail_price1'] = $item['retail_price'];
                 $item['retail_price'] = $this->getRealSalePrice($item['cost_price']);
+                $item['wait_score'] = moneyFormat($item['retail_price'] * $awardWaitRate/100 * $waitRate/100, 2);
             }
             unset($item);
-        } else {
-            $this->updateGoods();
         }
 
         return [
@@ -187,9 +191,14 @@ class GoodsService extends BaseService
             $info['usdt_price_rate'] = $usdtPrice;
             $info['xd_price'] = $xdPrice;
             $info['custom_uid'] = ConfigService::make()->getConfigByCode('xl_custom_id',100001);
+            $awardWaitRate = ConfigService::make()->getConfigByCode('shop_award_score_rate', 0);
+            $awardWaitRate = $awardWaitRate>0 && $awardWaitRate<1000? $awardWaitRate : 0;
+            $waitRate = ConfigService::make()->getConfigByCode('day_wait_score_num', 0);
+            $waitRate = $waitRate>0 && $waitRate<100? $waitRate : 0;
             if(isset($info['retail_price']) && $info['retail_price']){
                 $info['retail_price1'] =$info['retail_price'];
                 $info['retail_price'] = $this->getRealSalePrice($info['cost_price']);
+                $info['wait_score'] = moneyFormat($info['retail_price'] * $awardWaitRate/100 * $waitRate/100, 2);
             }
 
             if(isset($info['sku_list']) && $info['sku_list']){
@@ -199,7 +208,7 @@ class GoodsService extends BaseService
                     $v['main_img'] = $v['main_img']? get_image_url($v['main_img']) : '';
                     $v['retail_price_1'] =  $v['retail_price'];
                     $v['retail_price'] =  $this->getRealSalePrice($v['plat_price']);
-
+                    $item['wait_score'] = moneyFormat($v['retail_price'] * $awardWaitRate/100 * $waitRate/100, 2);
                 }
                 unset($v);
             }

+ 1 - 1
app/Services/Api/MemberService.php

@@ -1981,7 +1981,7 @@ class MemberService extends BaseService
         $cacheKey = "caches:machine:list_{$userId}_{$page}_".md5(json_encode($params,256));
         $datas = RedisService::get($cacheKey);
         if ($datas) {
-            return [ 
+            return [
                 'pageSize' => $pageSize,
                 'total' => isset($datas['total']) ? $datas['total'] : 0,
                 'list' => isset($datas['data']) ? $datas['data'] : []