Преглед изворни кода

feat: NG-15: 新会员注册时增加国家与语言选项.

kevin пре 1 година
родитељ
комит
df0048d406
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      backendApi/modules/v1/controllers/ShopController.php

+ 5 - 0
backendApi/modules/v1/controllers/ShopController.php

@@ -23,6 +23,7 @@ use backendApi\modules\v1\models\lists\shop\RemainPvList;
 use backendApi\modules\v1\models\lists\shop\FlowRemainPvList;
 use common\helpers\Cache;
 use common\helpers\Form;
+use common\models\CurrencyConversions;
 use common\models\DeclarationPackage;
 use common\models\DecOrder;
 use common\models\forms\DecPackageForm;
@@ -169,10 +170,14 @@ class ShopController extends BaseController {
         // 货币
         $currencies = Cache::getCurrencies();
         $currencies = array_column($currencies, NULL, 'ID');
+        // 货币汇率
+        $currenciesConversions = CurrencyConversions::getFromCache();
+        $currenciesConversions = array_column($currenciesConversions, NULL, 'TO_CURRENCY_ID');
 
         foreach ($countries as &$country) {
             // 货币
             $country['LOCAL_CURRENCY_NAME'] = $currencies[$country['LOCAL_CURRENCY_ID']]['NAME'] ?? '';
+            $country['CURRENCY_PRODUCT_RATE'] = $currenciesConversions[$country['LOCAL_CURRENCY_ID']]['PRODUCT_RATE'] ?? 0;
             // 商品属性
             $country['SHOP_GOODS_NATURE'] = ShopGoodsNature::findAllAsArray('GOODS_ID=:GOODS_ID AND COUNTRY_ID=:COUNTRY_ID', [':GOODS_ID' => $id, ':COUNTRY_ID' => $country['ID']]);
         }