|
|
@@ -14,8 +14,9 @@ use yii\web\HttpException;
|
|
|
|
|
|
class TransportationController extends BaseController
|
|
|
{
|
|
|
- public $countiesModelClass = Countries::class;
|
|
|
public $modelClass = FreeTemplate::class;
|
|
|
+ public $countiesModelClass = Countries::class;
|
|
|
+ public $currencyModelClass = Currency::class;
|
|
|
|
|
|
public function actionTransportation()
|
|
|
{
|
|
|
@@ -24,11 +25,15 @@ class TransportationController extends BaseController
|
|
|
// 运费列表
|
|
|
$transportation = $this->modelClass::getFromCache();
|
|
|
$transportation = array_column($transportation, NULL, 'country_id');
|
|
|
+ // 货币列表
|
|
|
+ $currencies = $this->currencyModelClass::getFromCache();
|
|
|
+ $currencies = array_column($currencies, NULL, 'ID');
|
|
|
|
|
|
foreach ($countries as &$country) {
|
|
|
- $country['freight'] = $transportation[$country['country_id']]['freight'] ?? 0;
|
|
|
- $country['free_shipping'] = $transportation[$country['country_id']]['free_shipping'] ?? 0;
|
|
|
- $country['currency_id'] = $transportation[$country['country_id']]['currency_id'] ?? 0;
|
|
|
+ $country['freight'] = $transportation[$country['ID']]['freight'] ?? 0;
|
|
|
+ $country['free_shipping'] = $transportation[$country['ID']]['free_shipping'] ?? 0;
|
|
|
+ $country['currency_id'] = $transportation[$country['ID']]['currency_id'] ?? 0;
|
|
|
+ $country['currency'] = $currencies[$transportation[$country['ID']]['currency_id']]['NAME'] ?? '';
|
|
|
}
|
|
|
|
|
|
return static::notice(['data' => $countries]);
|