Quellcode durchsuchen

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

kevin vor 1 Jahr
Ursprung
Commit
d552dc9ebb

+ 1 - 0
common/messages/en-US/app.php

@@ -40,6 +40,7 @@ return [
     'villaPointDoesNotAdequate' => '房奖积分不足,无法购买商品',
     'paymentInfoDoesNotExists' => '支付信息不存在',
     'payAmountNotEqualOrderAmount' => '支付金额与订单金额不符',
+    'cashThanNotAllowModificationCountry' => 'Cash balance greater than 0, country modification not allowed.',
     'orderSn' => 'Order Code',
     'expressCompany' => 'Express Company',
     'orderTrackNo' => 'Track Code',

+ 1 - 1
common/messages/zh-CN/app.php

@@ -40,7 +40,7 @@ return [
     'villaPointDoesNotAdequate' => '房奖积分不足,无法购买商品',
     'paymentInfoDoesNotExists' => '支付信息不存在',
     'payAmountNotEqualOrderAmount' => '支付金额与订单金额不符',
-
+    'cashThanNotAllowModificationCountry' => '现金余额大于0,不允许修改国家.',
 
     'orderSn' => '订单号',
     'expressCompany' => '快递公司',

+ 6 - 5
common/models/forms/ShopGoodsForm.php

@@ -218,8 +218,8 @@ class ShopGoodsForm extends Model
                 $shopGoodsNature->GOODS_ID = $shopGoods->ID;
                 $shopGoodsNature->COUNTRY_ID = $item['ID'];
                 $shopGoodsNature->LOCAL_CURRENCY_ID = $country['LOCAL_CURRENCY_ID'];
-                $shopGoodsNature->MARKET_PRICE = $item['marketPrice']; //$shopGoods->SELL_PRICE_STANDARD * $productRate;
-                $shopGoodsNature->SELL_PRICE = $shopGoods->SELL_PRICE_STANDARD * $productRate; // $item['sellPrice'];
+                $shopGoodsNature->SELL_PRICE = $shopGoods->SELL_PRICE_STANDARD * $productRate;
+                $shopGoodsNature->MARKET_PRICE = $item['marketPrice'];
                 $shopGoodsNature->TAX_RATE = $item['taxRate'];
                 if (!$shopGoodsNature->save()) {
                     $transaction->rollBack();
@@ -283,8 +283,8 @@ class ShopGoodsForm extends Model
                 $shopGoodsNature->GOODS_ID = $model->ID;
                 $shopGoodsNature->COUNTRY_ID = $item['ID'];
                 $shopGoodsNature->LOCAL_CURRENCY_ID = $country['LOCAL_CURRENCY_ID'];
-                $shopGoodsNature->MARKET_PRICE = $item['marketPrice']; // $model->SELL_PRICE_STANDARD * $productRate;
-                $shopGoodsNature->SELL_PRICE = $model->SELL_PRICE_STANDARD * $productRate; // $item['sellPrice'];
+                $shopGoodsNature->SELL_PRICE = $model->SELL_PRICE_STANDARD * $productRate;
+                $shopGoodsNature->MARKET_PRICE = $item['marketPrice'];
                 $shopGoodsNature->TAX_RATE = $item['taxRate'];
                 if (!$shopGoodsNature->save()) {
                     $transaction->rollBack();
@@ -349,8 +349,9 @@ class ShopGoodsForm extends Model
             foreach ($shopGoodsNature as $goodsNature) {
                 // 商品
                 $shopGoods = ShopGoods::findOne(['ID' => $goodsNature->GOODS_ID]);
-                // 刷新销售价格
+                // 刷新销售价格、市场价格
                 $goodsNature->SELL_PRICE = $shopGoods->SELL_PRICE_STANDARD * $currencyConversions->PRODUCT_RATE;
+                $goodsNature->MARKET_PRICE = $shopGoods->SELL_PRICE_STANDARD * $currencyConversions->PRODUCT_RATE * 1.2;
                 if (!$goodsNature->save()) {
                     $transaction->rollBack();
                     throw new Exception(Form::formatErrorsForApi($goodsNature->getErrors()));

+ 7 - 1
common/models/forms/UserBasicForm.php

@@ -158,7 +158,13 @@ class UserBasicForm extends Model {
         }
         // 如果移民,则需要进行移民条件检查
         if ($this->country != $beforeCountry) {
-            // 1.是否有进行中的分期订单
+            // 1. 有现金余额不可以移民
+            $userWallet = UserWallet::findOne(['USER_ID' => $this->userId]);
+            if ($userWallet && $userWallet->CASH > 0) {
+                throw new Exception(Yii::t('app', 'cashThanNotAllowModificationCountry'));
+            }
+
+            // 2.有进行中的分期订单不可以移民
             $instalmentOrder = Instalment::findOne(['USER_ID' => $this->userId]);
             // 订单分期总期数配置
             if ($instalmentOrder) {