kevin_zhangl пре 2 година
родитељ
комит
352fd818c4
38 измењених фајлова са 1382 додато и 613 уклоњено
  1. 1 0
      common/config/bootstrap.php
  2. 47 0
      common/config/i18n.php
  3. 15 1
      common/config/main.php
  4. 4 3
      common/helpers/user/Cash.php
  5. 306 0
      common/messages/en-US/app.php
  6. 310 0
      common/messages/zh-CN/app.php
  7. 6 6
      common/models/Article.php
  8. 4 4
      common/models/ArticleCategory.php
  9. 11 11
      common/models/OpenBank.php
  10. 81 81
      common/models/User.php
  11. 15 14
      common/models/forms/ApproachDeclarationForm.php
  12. 9 8
      common/models/forms/ApproachDeclarationLoopForm.php
  13. 8 7
      common/models/forms/ApproachDeclarationUpgradeForm.php
  14. 47 48
      common/models/forms/ApproachOrderForm.php
  15. 9 8
      common/models/forms/BaApproachDeclarationLoopForm.php
  16. 38 38
      common/models/forms/BaApproachOrderForm.php
  17. 8 7
      common/models/forms/BaDeclarationLoopForm.php
  18. 3 2
      common/models/forms/BaUserForm.php
  19. 16 15
      common/models/forms/DeclarationForm.php
  20. 9 8
      common/models/forms/DeclarationLoopForm.php
  21. 10 9
      common/models/forms/DeclarationUpgradeForm.php
  22. 88 93
      common/models/forms/OrderForm.php
  23. 3 2
      common/models/forms/TransferForm.php
  24. 10 9
      common/models/forms/UserConfigForm.php
  25. 5 4
      common/models/forms/UserForm.php
  26. 3 2
      common/models/forms/WithdrawForm.php
  27. 2 1
      frontendApi/modules/v1/controllers/ArticleController.php
  28. 8 8
      frontendApi/modules/v1/controllers/AtlasController.php
  29. 22 20
      frontendApi/modules/v1/controllers/BaController.php
  30. 15 7
      frontendApi/modules/v1/controllers/BaseController.php
  31. 51 38
      frontendApi/modules/v1/controllers/BonusController.php
  32. 19 18
      frontendApi/modules/v1/controllers/ConfigController.php
  33. 3 1
      frontendApi/modules/v1/controllers/DashboardController.php
  34. 23 22
      frontendApi/modules/v1/controllers/FinanceController.php
  35. 6 6
      frontendApi/modules/v1/controllers/OauthController.php
  36. 119 65
      frontendApi/modules/v1/controllers/ShopController.php
  37. 29 28
      frontendApi/modules/v1/controllers/UserController.php
  38. 19 19
      frontendApi/modules/v1/models/LoginForm.php

+ 1 - 0
common/config/bootstrap.php

@@ -9,3 +9,4 @@ Yii::setAlias('@frontendApi', dirname(dirname(__DIR__)) . '/frontendApi');
 Yii::setAlias('@backendApi', dirname(dirname(__DIR__)) . '/backendApi');
 Yii::setAlias('@shopApi', dirname(dirname(__DIR__)) . '/shopApi');
 Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
+Yii::setAlias('@rootPath', dirname(dirname(__DIR__)));

+ 47 - 0
common/config/i18n.php

@@ -0,0 +1,47 @@
+<?php
+/**
+ * Configuration file for 'yii message/extract' command.
+ *
+ * This file is automatically generated by 'yii message/config' command.
+ * It contains parameters for source code messages extraction.
+ * You may modify this file to suit your needs.
+ *
+ * You can use 'yii message/config-template' command to create
+ * template configuration file with detailed description for each parameter.
+ */
+return [
+    'color' => null,
+    'interactive' => true,
+    'help' => false,
+    'silentExitOnException' => null,
+    'sourcePath' => '@rootPath',    // 设置为项目跟地址,检索全项目 bootstrap:(Yii::setAlias('@rootPath', dirname(dirname(__DIR__)));)
+//    'sourcePath' => '@yii',
+    'messagePath' => '@yii/messages',
+    'languages' => ['zh-CN'],   // 设置要转换的语言
+    'translator' => 'Yii::t',
+    'sort' => false,
+    'overwrite' => true,
+    'removeUnused' => false,
+    'markUnused' => true,
+    'except' => [
+        '.svn',
+        '.git',
+        '.gitignore',
+        '.gitkeep',
+        '.hgignore',
+        '.hgkeep',
+        '/messages',
+        '/BaseYii.php',
+    ],
+    'only' => [
+        '*.php',
+    ],
+    'format' => 'php',
+    'db' => 'db',
+    'sourceMessageTable' => '{{%source_message}}',
+    'messageTable' => '{{%message}}',
+    'catalog' => 'messages',
+    'ignoreCategories' => [],
+    'phpFileHeader' => '',
+    'phpDocBlock' => null,
+];

+ 15 - 1
common/config/main.php

@@ -12,7 +12,7 @@ if (YII_ENV == YII_ENV_DEV) {
 }
 
 return [
-    'language' => 'en',
+    'language' => 'en-US', // zh-CN
     'timeZone' => 'Africa/Lagos',
     'aliases' => [
         '@bower' => '@vendor/bower-asset',
@@ -83,6 +83,20 @@ return [
                 'db' => [ 'class' => 'yii\log\FileTarget'],
             ],
         ],
+        // 多语言
+        'i18n' => [
+            'translations' => [
+                'app*' => [
+                    'class' => 'yii\i18n\PhpMessageSource',
+                    'basePath' => '@common/messages',
+                    'sourceLanguage' => 'en-US',
+                    'fileMap' => [
+                        'app' => 'app.php',
+                        'app/error' => 'error.php',
+                    ],
+                ],
+            ],
+        ],
     ],
     'controllerMap' => [
         'swoole_server' => [

+ 4 - 3
common/helpers/user/Cash.php

@@ -14,6 +14,7 @@ use common\libs\lock\RedisLock;
 use common\models\FlowWallet;
 use common\models\Period;
 use common\models\UserWallet;
+use Yii;
 use yii\base\Exception;
 use yii\db\Expression;
 
@@ -65,7 +66,7 @@ class Cash {
                 $lockKey = self::CASH_BALANCE_LOCK_KEY . $userId;
                 break;
             default:
-                throw new Exception('流水类型错误');
+                throw new Exception(Yii::t('app', 'cashDoesNotAdequate'));
         }
         if (RedisLock::instance()->lock($lockKey)) {
             // 改变发奖
@@ -77,7 +78,7 @@ class Cash {
                 $oneUserBonusModel->$type += $amount;
                 if ($oneUserBonusModel->$type < 0) {
                     RedisLock::instance()->unlock($lockKey);
-                    throw new Exception('金额不足');
+                    throw new Exception(Yii::t('app', 'cashDoesNotAdequate'));
                 }
                 UserWallet::updateAll($paramData, 'USER_ID=:USER_ID', [':USER_ID' => $userId]);
 
@@ -121,7 +122,7 @@ class Cash {
             unset($flowInsertData);
             RedisLock::instance()->unlock($lockKey);
         } else {
-            throw new Exception('流水产生错误');
+            throw new Exception(Yii::t('app', 'flowCreateError'));
         }
         return true;
     }

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

@@ -0,0 +1,306 @@
+<?php
+return [
+    # 商城
+    'addressId' => 'Address',
+    'reconsume' => 'Reconsume',
+    'orderCode' => 'Order Code',
+    'orderDetail' => 'Order Detail',
+    'productCode' => 'Product Code',
+    'productName' => 'Product Name',
+    'productPrice' => 'Product Price',
+    'qty' => 'Qty',
+    'taxRate' => 'Tax Rate',
+    'totalTax' => 'Total Tax',
+    'totalAmount' => 'Total Amount',
+    'total' => 'Total',
+    'signature' => 'Signature',
+    'date' => 'Date',
+    'accountBalance' => 'Account Balance',
+    'travelBonus' => 'Travel Bonus',
+    'carFund' => 'Car Fund',
+    'villaFund' => 'Villa Fund',
+    'reconsumeSuccessfully' => '帮会员复消成功',
+    'reconsumeRemark' => '复销备注',
+    'standardProducts' => 'Standard Products',
+    'carFundProducts' => 'Car Fund Products',
+    'villaFundProducts' => 'Villa Fund Products',
+    'travelFundProducts' => 'Travel Fund Products',
+    'insufficientInventory' => 'Insufficient inventory',
+    'soldOut' => 'Sold out',
+    'productsDoesNotExists' => 'Products does not exists!',
+    'cashDoesNotAdequate' => '余额不足,无法购买商品',
+    'exchangePointDoesNotAdequate' => '兑换积分不足,无法购买商品',
+    'travelPointDoesNotAdequate' => '旅游积分不足,无法购买商品',
+    'carFundPointDoesNotAdequate' => '车奖积分不足,无法购买商品',
+    'villaPointDoesNotAdequate' => '房奖积分不足,无法购买商品',
+    'paymentInfoDoesNotExists' => '支付信息不存在',
+    'payAmountNotEqualOrderAmount' => '支付金额与订单金额不符',
+    'orderSn' => 'Order Code',
+    'expressCompany' => 'Express Company',
+    'orderTrackNo' => 'Track Code',
+    'remark' => 'Remark',
+    'orderType' => 'Order Type',
+    'payType' => 'Pay Type',
+    'productID' => 'Product ID',
+    'quantity' => 'Quantity',
+    'repeatSalesMemberNo' => 'UserName',
+    'consigneeNo' => 'Consignee',
+    'acceptMobile' => 'Accept Mobile',
+    'lgaName' => 'Lga Name',
+    'cityName' => 'City Name',
+    'detailAddress' => 'Address',
+    'shippingAddress' => 'shipping Address',
+
+    'orderDoesNotExist' => 'the order does not exist',
+    'orderHasBeenCancelCanNotDeliver ' => '订单已取消不能发货',
+    'orderHasBeenDeleteCanNotDeliver' => '订单已删除不能发货',
+    'orderPayStatusDoesNotSupportRefund' => '订单状态支付状态不支持退款',
+    'orderLogisticsStatusDoesNotSupportRefund' => '订单物流状态不支持退款',
+    'orderPayTypeDoesNotSupportRefund' => '订单支付方式不支持退款',
+    'paymentPasswordError' => 'The payment password is incorrect',
+    'shippingDoesNotExist' => 'the shipping address does not exist',
+    'payTypeError' => '支付方式错误',
+    'orderCanNotHasMoreClassification' => '订单不能包含多种商品分类',
+    'shopGoodClassificationError' => '商品分类错误',
+    'orderStatusTypeError' => '订单状态类型错误',
+    'orderStatusDoesNotChange' => '订单状态没有改变',
+    'orderHasBeenLogisticsStatusDoesNotChangedUnpaid' => '订单已经进入物流状态不能改为未支付',
+    'orderHasBeenInvalidCanNotProcess' => '订单已失效不能处理',
+    'orderCanNotBeenChangedLogistics' => '订单不能单独处理为物流状态',
+    'orderHasBeenFinishedCanNotCancel' => '订单已完成不能取消',
+    'orderHasBeenDeletedCanNotCancel' => '订单已删除不能取消',
+    'orderHasBeenFinishedCanNotDelete' => '订单已完成不能删除',
+    'flowTypeError' => '流水类型错误',
+    'flowCreateError' => '流水产生错误',
+    'doesNotYourSubMemberCanNotReconsume' => '不是您的伞下会员,不能为其复消',
+    'membersResellingBalancePayment' => 'Members reselling balance payment',
+    'membersExchangePointPayment' => '会员复销积分兑换',
+    'orderCanNotContainMultipleProductCategories' => 'Order cannot contain multiple product categories',
+
+
+    # 会员
+    'memberCode' => 'Member Code',
+    'memberName' => 'Member Name',
+    'memberAddress' => 'Member Address',
+    'memberPhone' => 'Member Phone',
+    'bankName' => 'Bank Name',
+    'bankCode' => 'Bank Code',
+    'admin' => 'Admin',
+    'minCharge' => 'Min Charge',
+    'maxCharge' => 'Max Charge',
+    'chargeRate' => 'Charge Rate',
+    'updater' => 'Updater',
+    'userName' => 'USER_NAME',
+    'passwordHash' => 'PASSWORD_HASH',
+    'payPassword' => 'PAY_PASSWORD',
+    'nation' => 'NATION',
+    'realName' => 'REAL_NAME',
+    'IDCard' => 'ID_CARD',
+    'IDType' => 'ID_TYPE',
+    'mobile' => 'MOBILE',
+    'address' => 'ADDRESS',
+    'IDImage' => 'ID_IMAGE',
+    'openBank' => 'OPEN_BANK',
+    'bankAddress' => 'BANK_ADDRESS',
+    'bankNo' => 'BANK_NO',
+    'bankProvince' => 'BANK_PROVINCE',
+    'bankCity' => 'BANK_CITY',
+    'bankCounty' => 'BANK_COUNTY',
+    'spouseName' => 'SPOUSE_NAME',
+    'spouseIDCard' => 'SPOUSE_IDCARD',
+    'decClosed' => 'DEC_CLOSED',
+    'decClosedAt' => 'DEC_CLOSED_AT',
+    'decLv' => 'DEC_LV',
+    'empLv' => 'EMP_LV',
+    'crownLv' => 'CROWN_LV',
+    'province' => 'PROVINCE',
+    'city' => 'CITY',
+    'county' => 'COUNTY',
+    'tel' => 'TEL',
+    'subComID' => 'SUB_COM_ID',
+    'avatar' => 'AVATAR',
+    'isDec' => 'IS_DEC',
+    'isAtlas' => 'IS_ATLAS',
+    'isRecharge' => 'IS_RECHARGE',
+    'DEC_ID' => 'DEC_ID',
+    'birthday' => 'BIRTHDAY',
+    'decRoleID' => 'DEC_ROLE_ID',
+    'periodAt' => 'PERIOD_AT',
+    'decProvince' => 'DEC_PROVINCE',
+    'decCity' => 'DEC_CITY',
+    'decCounty' => 'DEC_COUNTY',
+    'isUnion' => 'IS_UNION',
+    'statusAt' => 'STATUS_AT',
+    'verified' => 'VERIFIED',
+    'verifiedAt' => 'VERIFIED_AT',
+    'allowLogin' => 'ALLOW_LOGIN',
+    'notOperating' => 'NOT_OPERATING',
+    'regFrom' => 'REG_FROM',
+    'IDCardPrefix' => 'ID_CARD_PREFIX',
+    'sex' => 'SEX',
+    'decAccountOld' => 'DEC_ACCOUNT_OLD',
+    'bankUpdatedAt' => 'BANK_UPDATED_AT',
+    'isDirectSeller' => 'IS_DIRECT_SELLER',
+    'decLvUpdatedAt' => 'DEC_LV_UPDATED_AT',
+    'decLvUpdatedPeriod' => 'DEC_LV_UPDATED_PERIOD',
+    'decAddress' => 'DEC_ADDRESS',
+    'decPhone' => 'DEC_PHONE',
+    'guarantor' => 'GUARANTOR',
+    'guarantorName' => 'GUARANTOR_NAME',
+    'partFuncClosed' => 'PART_FUNC_CLOSED',
+    'lastDecLvUpdatedPeriod' => 'LAST_DEC_LV_UPDATED_PERIOD',
+    'userCreator' => 'USER_CREATOR',
+    'userUpdater' => 'USER_UPDATER',
+    'lastDecLvUpdatedAt' => 'LAST_DEC_LV_UPDATED_AT',
+    'decCreatedAt' => 'DEC_CREATED_AT',
+    'partFuncClosedRemark' => 'PART_FUNC_CLOSED_REMARK',
+    'decCreatedPeriod' => 'DEC_CREATED_PERIOD',
+    'passwordChanged' => 'PASSWORD_CHANGED',
+    'subComLeader' => 'SUB_COM_LEADER',
+    'zgUpgradePv' => 'ZG_UPGRADE_PV',
+    'appClientID' => 'APP_CLIENT_ID',
+    'readAgreement' => 'READ_AGREEMENT',
+    'lastDecLv' => 'LAST_DEC_LV',
+    'bonusAppClientID' => 'BONUS_APP_CLIENT_ID',
+    'isFirstOpen' => 'IS_FIRST_OPEN',
+    'isModifyPassword' => 'IS_MODIFY_PASSWORD',
+    'isStudio' => 'IS_STUDIO',
+    'email' => 'EMAIL',
+
+    'fillingUpOfADeficit' => 'filling up of a deficit',
+    'fullPayment' => 'full payment',
+
+    'personalDataModifiedSuccessfully' => 'Personal data modified successfully',
+    'passwordModifiedSuccessfully' => 'Password modified successfully',
+    'theFunctionIsNotAvailable' => 'The function is not available',
+    'inactiveUser' => 'Inactive user. Please contact customer service.',
+    'checkPerformance' => 'Please contact customer service to check performance.',
+    'checkPerformanceOfUpgradedMember' => 'Please contact the customer service personnel to check the performance of upgraded members',
+    'memberNumberExpired' => 'Member number expired',
+    'memberNumberDoesNotConformTo' => 'Member number does not conform to',
+    'failedToGenerateMemberNumber' => 'Failed to generate member number',
+    'memberNumberDoesNotExist' => 'Member number does not exist',
+    'repeatSalesMemberNoDoesNotExist' => 'Repeat sales Member No. does not exist',
+    'memberDoesNotExist' => 'Member does not exist',
+    'memberDoesNotInSamePlacementNetwork' => 'The member is not in the same placement network as the current user',
+    'viewSubMembersMost' => 'View the top 20 sub members of the member at most',
+    'upgradeMethodIncorrect' => 'The upgrade method is incorrect. Please contact the customer service personnel',
+
+    'originalLoginPasswordError' => 'Original login password error',
+    'originalPaymentPasswordError' => 'Original payment password error',
+    'userNameNotExists' => 'Nonexistent user name',
+    'pleaseSelectUpgradeLevel' => 'Please select upgrade level',
+    'totalPVLessThan' => 'Total PV cannot be less than the selected level PV',
+    'totalPvExceedPv' => 'The total PV cannot exceed the PV value of the next level under the selected level',
+    'deliveryTemporarilyNotSupported' => 'Delivery is temporarily not supported in the region. Contact customer service for details',
+    'applicantCashShort' => 'The applicant is short of cash and cannot complete the declaration',
+    'failedToUpgrade' => 'Failed to upgrade for member',
+    'bulkDeclarationNotSames' => 'Bulk declaration member must be the same member',
+    'reportFormatIncorrect' => 'The format of the report data is incorrect',
+    'memberNumberCanNotContainChineseCharacters' => 'Member number cannot contain Chinese characters',
+    'pleaseSelectTheEntryLevel' => 'Please select the entry level',
+    'totalBVCanNotLessThanSelectedBV' => 'The total BV of self selected goods cannot be less than the BV of the selected entry level',
+    'totalBVCanNotLessThanNextSelectedLevelBV' => 'The total BV of self selected goods cannot exceed the BV value of the next level under the selected level',
+    'incorrectEntryType' => 'Incorrect entry type',
+    'MembershipNumberFilledInitialPurchase' => 'Membership number must be filled in for initial purchase',
+    'fillTheInstructorNumberTheMember' => 'For the first purchase, you must fill in the instructor number of the member',
+    'sponsorNumberMustBeFilled' => 'For the first purchase, the Sponsor number of the member must be filled in',
+    'beFilledTheMarketMember' => 'The first purchase must be filled in the market of the member',
+    'pleaseSelectMarket' => 'Please select a market',
+    'stockistDoesNotExist' => 'Stockist does not exist',
+    'newMemberDoesNotExist' => 'New member does not exist',
+    'brandAmbassadorUpgradeError' => 'Brand Ambassador upgrade error',
+    'changeUserStatusError' => 'change user status error',
+    'dataFormatError' => 'Data format error',
+
+
+
+    # 奖金
+    'memberBonus' => 'Member Bonus',
+    'memberEcoin' => 'Member Ecoin',
+    'carPoints' => 'Car Points',
+    'villaPoints' => 'Villa Points',
+    'increase' => 'increase',
+    'reduce' => 'reduce',
+    'cannotViewThisPeriod' => 'Cannot view this period',
+    'bonusRecordDoesNotExists' => 'The bonus record does not exists of this period',
+    'pleaseSelectThePeriod' => 'Please select the period',
+    'withdrawalApplicationHasBeenSubmitted' => 'Withdrawal application has been submitted, please wait for review.',
+    'withdrawHasBeenBacked' => 'Withdraw has been backed',
+    'withdrawDoesNotAllowedOfAuthentication' => '未实名验证无法提现',
+    'withdrawDoesNotAllowedOfSubsidiaryMember' => '附属会员无法提现',
+    'autoWithdrawHasBeenOpened' => '已开启自动提现,如需手动提现请关闭自动提现',
+    'withdrawNotAllowOfDate' => '未到提现日期,请在每月挂网后第一周申请提现',
+    'withdrawAllowOnceOfMonth' => '提现失败,每月只可以提现一次',
+    'withdrawRecordHasNotVerify' => '提现失败,您存在未审核的提现记录',
+    'notionalPoolingAmountFinished' => '归集完成,归集金额',
+    'withdrawDoesNotUploadInvoice' => '该提现记录无法上传发票',
+    'transferDoesNotAllowedOfAuthentication' => '未实名验证无法转账',
+    'transferDoesNotAllowed' => '不允许转账',
+    'transferDoesNotOpen' => '转账功能未启用',
+    'transferTypeDoesNotExists' => '没有可用的转账类型',
+    'rechargeApplicationHasBeenSubmitted' => 'Recharge application has been submitted, please wait for review.',
+
+    # 设置
+    'autoWithdrawHasBeenClosed' => '开启关闭自动提现成功',
+    'closeMessageSendSuccessfully' => '开启关闭复销短信提醒成功',
+    'changeDefaultAddressFailed' => '更新默认地址失败',
+    'addShippingAddressSuccessfully' => '添加收货地址成功',
+    'updateUserConfigFailed' => '更新个人设置失败',
+    'isAutoWithdraw' => '是否自动提现',
+    'allowReconsumeSms' => '开启复销短信通知',
+    'pleaseAuthentication' => '请先实名认证',
+    'systemCloseAutoWithdraw' => '系统关闭了自动提现',
+    'systemCloseReconsumeSMSNotification' => '系统关闭了开启复销短信通知',
+    'openAutoWithdraw' => '开启关闭自动提现',
+    'updateUserSMSExpiredFailed' => '更新个人短信有效期失败',
+    'modeDoesNotExist' => '不存在此方式',
+
+    # 首页
+    'pcOf' => 'PC of ',
+
+    # 财务
+    'statueError' => 'Status error',
+    'notAllowedToTransferToYourself' => 'Not allowed to transfer to yourself',
+    'wrongTransactionType' => 'Wrong transaction type',
+    'isCanWithdrawBack' => '提现退回已关闭',
+    'withdrawRecordDoesNotExist' => '符合退回的提现记录不存在',
+
+
+    # 登录
+    'refreshTokenFailed' => 'refresh token failed',
+    'passwordChangeSucceeded' => 'Password change succeeded',
+    'accountDoesNotExist' => 'The account does not exist',
+    'memberNameOrPasswordIncorrect' => 'The member name or password is incorrect',
+    'abnormalMemberCode' => 'Abnormal member code',
+    'memberNotActivated' => 'Member not activated',
+    'memberHasBeenCancelled' => 'The member has been cancelled',
+    'memberHasBeenBlacklisted' => 'The member has been blacklisted',
+    'memberHasBeenPermanentlySuspended' => 'The member has been permanently suspended',
+    'memberPartOfFunctionClosed' => 'Member part of the function is closed, unable to log in.',
+    'memberAppDeviceInformationUpdateFailed' => 'Member APP device information update failed',
+
+    # 文章
+    'category' => 'Category',
+    'title' => 'Title',
+    'content' => 'Content',
+    'articleDoesNotExist' => 'The article does not exist',
+
+    # 公用
+    'notConnection' => 'Connection not operated for too long',
+    'deleteFailed' => 'failed to delete',
+    'deleteSuccessfully' => 'delete successfully',
+    'quickLoginCanNotOperate' => '快速登录的会员无法进行任何操作',
+    'selectAtLeastOne' => '必须选择一条数据',
+    'failed' => 'Failed',
+    'successfully' => 'Successfully',
+    'createAt' => 'Creation Time',
+    'status' => 'Status',
+    'state' => 'State',
+    'sort' => 'Sort',
+    'illegalRequest' => 'Illegal request',
+    'invalidParameter' => 'Invalid Parameter',
+    'dataDoesNotExists' => 'The data does not exist',
+
+
+];

+ 310 - 0
common/messages/zh-CN/app.php

@@ -0,0 +1,310 @@
+<?php
+return [
+    # 商城
+    'addressId' => '收货地址',
+    'orderCode' => '订单号',
+    'orderDetail' => '订单详情',
+    'productCode' => '商品编号',
+    'productName' => '商品名字',
+    'productPrice' => '商品价格',
+    'qty' => '数量',
+    'taxRate' => '税率',
+    'totalTax' => '数额总计',
+    'totalAmount' => '总金额',
+    'total' => '总计',
+    'signature' => '签名',
+    'date' => '日期',
+    'accountBalance' => '账户余额',
+    'travelBonus' => '旅游积分',
+    'carFund' => '车奖积分',
+    'villaFund' => '房奖积分',
+    'reconsumeSuccessfully' => '帮会员复消成功',
+    'reconsume' => '帮会员复销',
+    'reconsumeRemark' => '复销备注',
+    'standardProducts' => '普通商品列表',
+    'carFundProducts' => '车奖积分商品',
+    'villaFundProducts' => '房奖积分商品',
+    'travelFundProducts' => '旅游积分商品',
+    'insufficientInventory' => '库存不足',
+    'soldOut' => '已下架',
+    'productsDoesNotExists' => '商品不存在',
+    'cashDoesNotAdequate' => '余额不足,无法购买商品',
+    'exchangePointDoesNotAdequate' => '兑换积分不足,无法购买商品',
+    'travelPointDoesNotAdequate' => '旅游积分不足,无法购买商品',
+    'carFundPointDoesNotAdequate' => '车奖积分不足,无法购买商品',
+    'villaPointDoesNotAdequate' => '房奖积分不足,无法购买商品',
+    'paymentInfoDoesNotExists' => '支付信息不存在',
+    'payAmountNotEqualOrderAmount' => '支付金额与订单金额不符',
+
+
+    'orderSn' => '订单号',
+    'expressCompany' => '快递公司',
+    'orderTrackNo' => '快递单号',
+    'remark' => '备注',
+    'orderType' => '订单类型',
+    'payType' => '支付方式',
+    'productID' => '商品ID',
+    'quantity' => '商品数量',
+    'repeatSalesMemberNo' => '复消会员编号',
+    'consignee' => '收货人',
+    'acceptMobile' => '收货电话',
+    'lgaName' => '地域',
+    'cityName' => '城市',
+    'detailAddress' => '详细地址',
+    'shippingAddress' => '收货地址',
+
+    'orderDoesNotExist' => '订单不存在',
+    'orderHasBeenCancelCanNotDeliver ' => '订单已取消不能发货',
+    'orderHasBeenDeleteCanNotDeliver' => '订单已删除不能发货',
+    'orderPayStatusDoesNotSupportRefund' => '订单状态支付状态不支持退款',
+    'orderLogisticsStatusDoesNotSupportRefund' => '订单物流状态不支持退款',
+    'orderPayTypeDoesNotSupportRefund' => '订单支付方式不支持退款',
+    'paymentPasswordError' => '支付密码不正确',
+    'shippingDoesNotExist' => '收货地址不存在',
+    'payTypeError' => '支付方式错误',
+    'orderCanNotHasMoreClassification' => '订单不能包含多种商品分类',
+    'shopGoodClassificationError' => '商品分类错误',
+    'orderStatusTypeError' => '订单状态类型错误',
+    'orderStatusDoesNotChange' => '订单状态没有改变',
+    'orderHasBeenLogisticsStatusDoesNotChangedUnpaid' => '订单已经进入物流状态不能改为未支付',
+    'orderHasBeenInvalidCanNotProcess' => '订单已失效不能处理',
+    'orderCanNotBeenChangedLogistics' => '订单不能单独处理为物流状态',
+    'orderHasBeenFinishedCanNotCancel' => '订单已完成不能取消',
+    'orderHasBeenDeletedCanNotCancel' => '订单已删除不能取消',
+    'orderHasBeenFinishedCanNotDelete' => '订单已完成不能删除',
+    'flowTypeError' => '流水类型错误',
+    'flowCreateError' => '流水产生错误',
+    'doesNotYourSubMemberCanNotReconsume' => '不是您的伞下会员,不能为其复消',
+    'orderCanNotContainMultipleProductCategories' => '订单不能包含多种商品分类',
+    'dataFormatError' => '数据格式错误',
+
+    # 会员
+    'memberCode' => '会员编号',
+    'memberName' => '会员名字',
+    'memberAddress' => '收货地址',
+    'bankName' => '银行名称',
+    'bankCode' => '银行代码',
+    'admin' => '操作人',
+    'minCharge' => '最低手续费',
+    'maxCharge' => '最高手续费',
+    'chargeRate' => '手续费比例',
+    'updater' => '更新人',
+
+    'userName' => '帐号',
+    'passwordHash' => '登录密码',
+    'payPassword' => '支付密码',
+    'nation' => '民族',
+    'realName' => '姓名',
+    'IDCard' => '身份证号',
+    'IDType' => '证件类型',
+    'mobile' => '手机号',
+    'address' => '身份证地址',
+    'IDImage' => '证件图片',
+    'openBank' => '开户行',
+    'bankAddress' => '银行地址',
+    'bankNo' => '银行卡号',
+    'bankProvince' => '银行省份',
+    'bankCity' => '银行城市',
+    'bankCounty' => '银行县区',
+    'spouseName' => '配偶姓名',
+    'spouseIDCard' => '配偶证件号',
+    'decClosed' => '是否关闭报单功能',
+    'decClosedAt' => '关闭时间',
+    'decLv' => '报单级别',
+    'empLv' => '聘级',
+    'crownLv' => '星级',
+    'province' => '省份',
+    'city' => '城市',
+    'county' => '县区',
+    'tel' => '座机',
+    'subComID' => '子公司ID',
+    'avatar' => '头像',
+    'isDec' => '是否为报单中心',
+    'isAtlas' => '是否显示图谱',
+    'isRecharge' => '是否显示充值',
+    'DEC_ID' => '报单中心ID',
+    'birthday' => '生日',
+    'decRoleID' => '报单中心级别',
+    'periodAt' => '期数',
+    'decProvince' => '报单中心所属的省份',
+    'decCity' => '报单中心所属的城市',
+    'decCounty' => '报单中心所属的县区',
+    'isUnion' => '是否为点位合作',
+    'statusAt' => '状态更改时间',
+    'verified' => '是否认证',
+    'verifiedAt' => '认证时间',
+    'allowLogin' => '允许登录',
+    'notOperating' => '不运作',
+    'regFrom' => '注册类型',
+    'IDCardPrefix' => '身份证前缀',
+    'sex' => '性别',
+    'decAccountOld' => '老系统中的报单中心编号',
+    'bankUpdatedAt' => '银行信息更新时间',
+    'isDirectSeller' => '是否为直销员',
+    'decLvUpdatedAt' => '报单级别更新时间',
+    'decLvUpdatedPeriod' => '报单级别更新期数',
+    'decAddress' => '报单中心详细地址',
+    'decPhone' => '报单中心电话',
+    'guarantor' => '担保人编号',
+    'guarantorName' => '担保人姓名',
+    'partFuncClosed' => '部分功能开启',
+    'lastDecLvUpdatedPeriod' => '上次报单级别更新期数',
+    'userCreator' => '创建人',
+    'userUpdater' => '修改人',
+    'lastDecLvUpdatedAt' => '上次报单级别更新时间',
+    'decCreatedAt' => '成为报单中心时间',
+    'partFuncClosedRemark' => '部分功能关闭原因',
+    'decCreatedPeriod' => '成为报单中心期数',
+    'passwordChanged' => '是否修改过密码',
+    'subComLeader' => '是否为分公司领导',
+    'zgUpgradePv' => '增购升级PV',
+    'appClientID' => 'APP设备ID',
+    'readAgreement' => '已读协议',
+    'lastDecLv' => '上次的报单级别',
+    'bonusAppClientID' => '结算APP设备ID',
+    'isFirstOpen' => '首次开通',
+    'isModifyPassword' => '是否修改密码',
+    'isStudio' => '是否是工作室',
+    'email' => '电子邮箱',
+
+
+
+    'fillingUpOfADeficit' => '补差额',
+    'fullPayment' => '全额',
+
+    'personalDataModifiedSuccessfully' => '个人资料修改成功',
+    'passwordModifiedSuccessfully' => '密码修改成功',
+    'theFunctionIsNotAvailable' => '功能暂未开放',
+    'inactiveUser' => '非激活用户,请联系客服',
+    'checkPerformance' => '请联系客服人员核对业绩',
+    'checkPerformanceOfUpgradedMember' => '请联系客服人员核对升级会员业绩',
+    'memberNumberExpired' => '会员编号过期',
+    'memberNumberDoesNotConformTo' => '会员编号不符合',
+    'failedToGenerateMemberNumber' => '会员编号生成失败',
+    'memberNumberDoesNotExist' => '会员编号不存在',
+    'repeatSalesMemberNoDoesNotExist' => '复消会员编号不存在',
+    'memberDoesNotExist' => '会员不存在',
+    'memberDoesNotInSamePlacementNetwork' => '会员与当前用户不再同一安置网络内',
+    'viewSubMembersMost' => '最多查看会员的前20层子会员',
+    'upgradeMethodIncorrect' => '升级方式不正确,请联系客服人员',
+
+    'originalLoginPasswordError' => '原登录密码错误',
+    'originalPaymentPasswordError' => '原支付密码错误',
+    'userNameNotExists' => '不存在的用户名',
+    'pleaseSelectUpgradeLevel' => '请选择升级级别',
+    'totalPVLessThan' => '总PV不能小于所选级别PV',
+    'totalPvExceedPv' => '总PV不能超过已选级别下一个级别的PV值',
+    'deliveryTemporarilyNotSupported' => '地区暂时不支持配送,具体联系客服',
+    'applicantCashShort' => '报单人现金不足,无法完成报单',
+    'failedToUpgrade' => '为会员升级失败',
+    'bulkDeclarationNotSames' => '批量报单会员必须是同一身份证',
+    'reportFormatIncorrect' => '报单数据格式错误',
+    'memberNumberCanNotContainChineseCharacters' => '会员编号中不能含有汉字',
+    'pleaseSelectTheEntryLevel' => '请选择报单级别',
+    'totalBVCanNotLessThanSelectedBV' => '自选商品总BV不能小于所选报单级别BV',
+    'totalBVCanNotLessThanNextSelectedLevelBV' => '自选商品总BV不能超过已选级别下一个级别的BV值',
+    'incorrectEntryType' => '报单类型错误',
+    'MembershipNumberFilledInitialPurchase' => '首购必须填写加入会员编号',
+    'fillTheInstructorNumberTheMember' => '首购必须填写加入会员的指导老师编号',
+    'sponsorNumberMustBeFilled' => '首购必须填写加入会员的开拓人编号',
+    'beFilledTheMarketMember' => '首购必须填写加入会员的市场',
+    'pleaseSelectMarket' => '请选择市场',
+    'stockistDoesNotExist' => '报单中心不存在',
+    'newMemberDoesNotExist' => '新加入的会员不存在',
+    'membersResellingBalancePayment' => '会员复销余额支付',
+    'membersExchangePointPayment' => '会员复销积分兑换',
+    'brandAmbassadorUpgradeError' => 'BA会员升级错误',
+    'changeUserStatusError' => '修改会员状态错误',
+
+
+    # 奖金
+    'memberBonus' => '会员奖金',
+    'memberEcoin' => '会员余额',
+    'carPoints' => '车奖积分',
+    'villaPoints' => '房奖积分',
+    'increase' => '增加',
+    'reduce' => '减少',
+    'cannotViewThisPeriod' => '该期不能查看',
+    'bonusRecordDoesNotExists' => '当期无奖金记录',
+    'pleaseSelectThePeriod' => '请选择期数',
+    'withdrawalApplicationHasBeenSubmitted' => '提现申请已提交,请等待审核',
+    'withdrawHasBeenBacked' => '提现已退回',
+    'withdrawDoesNotAllowedOfAuthentication' => '未实名验证无法提现',
+    'withdrawDoesNotAllowedOfSubsidiaryMember' => '附属会员无法提现',
+    'autoWithdrawHasBeenOpened' => '已开启自动提现,如需手动提现请关闭自动提现',
+    'withdrawNotAllowOfDate' => '未到提现日期,请在每月挂网后第一周申请提现',
+    'withdrawAllowOnceOfMonth' => '提现失败,每月只可以提现一次',
+    'withdrawRecordHasNotVerify' => '提现失败,您存在未审核的提现记录',
+    'notionalPoolingAmountFinished' => '归集完成,归集金额',
+    'withdrawDoesNotUploadInvoice' => '该提现记录无法上传发票',
+    'transferDoesNotAllowedOfAuthentication' => '未实名验证无法转账',
+    'transferDoesNotAllowed' => '不允许转账',
+    'transferDoesNotOpen' => '转账功能未启用',
+    'transferTypeDoesNotExists' => '没有可用的转账类型',
+    'rechargeApplicationHasBeenSubmitted' => '充值申请已提交,请等待审核',
+
+    # 设置
+    'autoWithdrawHasBeenClosed' => '开启关闭自动提现成功',
+    'closeMessageSendSuccessfully' => '开启关闭复销短信提醒成功',
+    'changeDefaultAddressFailed' => '更新默认地址失败',
+    'addShippingAddressSuccessfully' => '添加收货地址成功',
+    'updateUserConfigFailed' => '更新个人设置失败',
+    'isAutoWithdraw' => '是否自动提现',
+    'allowReconsumeSms' => '开启复销短信通知',
+    'pleaseAuthentication' => '请先实名认证',
+    'systemCloseAutoWithdraw' => '系统关闭了自动提现',
+    'systemCloseReconsumeSMSNotification' => '系统关闭了开启复销短信通知',
+    'openAutoWithdraw' => '开启关闭自动提现',
+    'updateUserSMSExpiredFailed' => '更新个人短信有效期失败',
+    'modeDoesNotExist' => '不存在此方式',
+
+
+    # 首页
+    'pcOf' => 'PC of ',
+
+    # 财务
+    'statueError' => 'Status error',
+    'notAllowedToTransferToYourself' => '不允许向自己转账',
+    'isCanWithdrawBack' => '提现退回已关闭',
+    'withdrawRecordDoesNotExist' => '符合退回的提现记录不存在',
+
+    # 文章
+    'category' => '分类',
+    'title' => '标题',
+    'content' => '内容',
+    'articleDoesNotExist' => '文章不存在',
+
+    # 登录
+    'refreshTokenFailed' => '刷新token失败',
+    'passwordChangeSucceeded' => '密码修改成功',
+    'wrongTransactionType' => '错误的交易类型',
+    'accountDoesNotExist' => '账号不存在',
+    'memberNameOrPasswordIncorrect' => '用户名或密码错误',
+    'abnormalMemberCode' => '会员编号异常',
+    'memberNotActivated' => '会员未激活',
+    'memberHasBeenCancelled' => '会员已被注销',
+    'memberHasBeenBlacklisted' => '会员已被列入黑名单',
+    'memberHasBeenPermanentlySuspended' => '会员已被永久关停',
+    'memberPartOfFunctionClosed' => '会员部分功能关闭,无法登录.',
+    'memberAppDeviceInformationUpdateFailed' => '会员APP设备信息更新失败',
+
+    # 公用
+    'notConnection' => '长时间未操作',
+    'deleteFailed' => '删除失败',
+    'deleteSuccessfully' => '删除成功',
+    'quickLoginCanNotOperate' => '快速登录的会员无法进行任何操作',
+    'selectAtLeastOne' => '必须选择一条数据',
+    'failed' => '失败',
+    'successfully' => '成功',
+    'createAt' => '创建时间',
+    'updateAt' => '更新时间',
+    'deletedAt' => '删除时间',
+    'status' => '状态',
+    'state' => '状态',
+    'sort' => '排序',
+    'deleted' => '是否删除',
+    'illegalRequest' => '非法请求',
+    'invalidParameter' => '无效参数',
+    'dataDoesNotExists' => '数据不存在',
+
+];

+ 6 - 6
common/models/Article.php

@@ -48,12 +48,12 @@ class Article extends \common\components\ActiveRecord
     {
         return [
             'ID' => 'ID',
-            'TITLE' => 'Title', // 标题
-            'CID' => 'Category Type', // 分类
-            'CONTENT' => 'Content', // 内容
-            'STATUS' => 'State', // 状态
-            'Order' => 'Sort', // 排序
-            'CREATED_AT' => 'Creation Time', // 创建时间
+            'TITLE' => Yii::t('app', 'title'),
+            'CID' => Yii::t('app', 'category'),
+            'CONTENT' => Yii::t('app', 'content'),
+            'STATUS' => Yii::t('app', 'state'),
+            'Order' => Yii::t('app', 'sort'),
+            'CREATED_AT' => Yii::t('app', 'createAt'),
         ];
     }
 }

+ 4 - 4
common/models/ArticleCategory.php

@@ -45,10 +45,10 @@ class ArticleCategory extends \common\components\ActiveRecord
     {
         return [
             'ID' => 'ID',
-            'CATE_NAME' => '分类名',
-            'STATUS' => '状态',
-            'SORT' => 'Sort',
-            'CREATED_AT' => '创建时间',
+            'CATE_NAME' => Yii::t('app', 'category'),
+            'STATUS' => Yii::t('app', 'status'),
+            'SORT' => Yii::t('app', 'sort'),
+            'CREATED_AT' => Yii::t('app', 'createAt'),
         ];
     }
 

+ 11 - 11
common/models/OpenBank.php

@@ -54,17 +54,17 @@ class OpenBank extends \common\components\ActiveRecord
     {
         return [
             'ID' => 'ID',
-            'BANK_NAME' => '银行名称',
-            'BANK_CODE' => '银行代码',
-            'LIST_ORDER' => '排序',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-            'ADM_NAME' => '操作人',
-            'MIN_CHARGE' => '最低手续费',
-            'MAX_CHARGE' => '最高手续费',
-            'CHARGE_PROP' => '手续费比例',
-            'UPDATER' => '更新人',
-            'STATUS' => '状态',
+            'BANK_NAME' => Yii::t('app', 'bankName'),'银行名称',
+            'BANK_CODE' => Yii::t('app', 'bankCode'),'银行代码',
+            'LIST_ORDER' => Yii::t('app', 'sort'),'排序',
+            'CREATED_AT' => Yii::t('app', 'createAt'),'创建时间',
+            'UPDATED_AT' => Yii::t('app', 'updateAt'),'更新时间',
+            'ADM_NAME' => Yii::t('app', 'admin'),'操作人',
+            'MIN_CHARGE' => Yii::t('app', 'minCharge'),'最低手续费',
+            'MAX_CHARGE' => Yii::t('app', 'maxCharge'),'最高手续费',
+            'CHARGE_PROP' => Yii::t('app', 'chargeRate'),'手续费比例',
+            'UPDATER' => Yii::t('app', 'updater'),'更新人',
+            'STATUS' => Yii::t('app', 'status'),'状态',
         ];
     }
 

+ 81 - 81
common/models/User.php

@@ -135,87 +135,87 @@ class User extends \common\components\ActiveRecord
     {
         return [
             'ID' => 'ID',
-            'USER_NAME' => '帐号',
-            'PASSWORD_HASH' => '登录密码',
-            'PAY_PASSWORD' => '支付密码',
-            'NATION' => '民族',
-            'REAL_NAME' => '姓名',
-            'ID_CARD' => '身份证号',
-            'ID_TYPE' => '证件类型',
-            'MOBILE' => '手机号',
-            'ADDRESS' => '身份证地址',
-            'ID_IMAGE' => '证件图片',
-            'OPEN_BANK' => '开户行',
-            'BANK_ADDRESS' => '银行地址',
-            'BANK_NO' => '银行卡号',
-            'BANK_PROVINCE' => '银行省份',
-            'BANK_CITY' => '银行城市',
-            'BANK_COUNTY' => '银行县区',
-            'SPOUSE_NAME' => '配偶姓名',
-            'SPOUSE_IDCARD' => '配偶证件号',
-            'CREATED_AT' => '创建时间',
-            'UPDATED_AT' => '更新时间',
-            'STATUS' => '状态',
-            'DEC_CLOSED' => '是否关闭报单功能',
-            'DEC_CLOSED_AT' => '关闭时间',
-            'DEC_LV' => '报单级别',
-            'EMP_LV' => '聘级',
-            'CROWN_LV' => '星级',
-            'PROVINCE' => '省份',
-            'CITY' => '城市',
-            'COUNTY' => '县区',
-            'TEL' => '座机',
-            'SUB_COM_ID' => '子公司ID',
-            'AVATAR' => '头像',
-            'DELETED' => '是否删除',
-            'DELETED_AT' => '删除时间',
-            'IS_DEC' => '是否为报单中心',
-            'IS_ATLAS' => '是否显示图谱',
-            'IS_RECHARGE' => '是否显示充值',
-            'DEC_ID' => '报单中心ID',
-            'BIRTHDAY' => '生日',
-            'DEC_ROLE_ID' => '报单中心级别',
-            'PERIOD_AT' => '期数',
-            'DEC_PROVINCE' => '报单中心所属的省份',
-            'DEC_CITY' => '报单中心所属的城市',
-            'DEC_COUNTY' => '报单中心所属的县区',
-            'IS_UNION' => '是否为点位合作',
-            'STATUS_AT' => '状态更改时间',
-            'VERIFIED' => '是否认证',
-            'VERIFIED_AT' => '认证时间',
-            'ALLOW_LOGIN' => '允许登录',
-            'NOT_OPERATING' => '不运作',
-            'REG_FROM' => '注册类型',
-            'ID_CARD_PREFIX' => '身份证前缀',
-            'SEX' => '性别',
-            'DEC_ACCOUNT_OLD' => '老系统中的报单中心编号',
-            'BANK_UPDATED_AT' => '银行信息更新时间',
-            'IS_DIRECT_SELLER' => '是否为直销员',
-            'DEC_LV_UPDATED_AT' => '报单级别更新时间',
-            'DEC_LV_UPDATED_PERIOD' => '报单级别更新期数',
-            'DEC_ADDRESS' => '报单中心详细地址',
-            'DEC_PHONE' => '报单中心电话',
-            'GUARANTOR' => '担保人编号',
-            'GUARANTOR_NAME' => '担保人姓名',
-            'PART_FUNC_CLOSED' => '部分功能开启',
-            'LAST_DEC_LV_UPDATED_PERIOD' => '上次报单级别更新期数',
-            'USER_CREATOR' => '创建人',
-            'USER_UPDATER' => '修改人',
-            'LAST_DEC_LV_UPDATED_AT' => '上次报单级别更新时间',
-            'DEC_CREATED_AT' => '成为报单中心时间',
-            'PART_FUNC_CLOSED_REMARK' => '部分功能关闭原因',
-            'DEC_CREATED_PERIOD' => '成为报单中心期数',
-            'PASSWORD_CHANGED' => '是否修改过密码',
-            'SUB_COM_LEADER' => '是否为分公司领导',
-            'ZG_UPGRADE_PV' => '增购升级PV',
-            'APP_CLIENT_ID' => 'APP设备ID',
-            'READ_AGREEMENT' => '已读协议',
-            'LAST_DEC_LV' => '上次的报单级别',
-            'BONUS_APP_CLIENT_ID' => '结算APP设备ID',
-            'IS_FIRST_OPEN' => '首次开通',
-            'IS_MODIFY_PASSWORD' => '是否修改密码',
-            'IS_STUDIO' => '是否是工作室',
-            'EMAIL' => 'Email',
+            'USER_NAME' => Yii::t('app', 'userName'),
+            'PASSWORD_HASH' => Yii::t('app', 'passwordHash'),
+            'PAY_PASSWORD' => Yii::t('app', 'payPassword'),
+            'NATION' => Yii::t('app', 'nation'),
+            'REAL_NAME' => Yii::t('app', 'realName'),
+            'ID_CARD' => Yii::t('app', 'IDCard'),
+            'ID_TYPE' => Yii::t('app', 'IDType'),
+            'MOBILE' => Yii::t('app', 'mobile'),
+            'ADDRESS' => Yii::t('app', 'address'),
+            'ID_IMAGE' => Yii::t('app', 'IDImage'),
+            'OPEN_BANK' => Yii::t('app', 'openBank'),
+            'BANK_ADDRESS' => Yii::t('app', 'bankAddress'),
+            'BANK_NO' => Yii::t('app', 'bankNo'),
+            'BANK_PROVINCE' => Yii::t('app', 'bankProvince'),
+            'BANK_CITY' => Yii::t('app', 'bankCity'),
+            'BANK_COUNTY' => Yii::t('app', 'bankCounty'),
+            'SPOUSE_NAME' => Yii::t('app', 'spouseName'),
+            'SPOUSE_IDCARD' => Yii::t('app', 'spouseIDCard'),
+            'CREATED_AT' => Yii::t('app', 'createAt'),
+            'UPDATED_AT' => Yii::t('app', 'updateAt'),
+            'STATUS' => Yii::t('app', 'status'),
+            'DEC_CLOSED' => Yii::t('app', 'decClosed'),
+            'DEC_CLOSED_AT' => Yii::t('app', 'decClosedAt'),
+            'DEC_LV' => Yii::t('app', 'decLv'),
+            'EMP_LV' => Yii::t('app', 'empLv'),
+            'CROWN_LV' => Yii::t('app', 'crownLv'),
+            'PROVINCE' => Yii::t('app', 'province'),
+            'CITY' => Yii::t('app', 'city'),
+            'COUNTY' => Yii::t('app', 'county'),
+            'TEL' => Yii::t('app', 'tel'),
+            'SUB_COM_ID' => Yii::t('app', 'subComID'),
+            'AVATAR' => Yii::t('app', 'avatar'),
+            'DELETED' => Yii::t('app', 'deleted'),
+            'DELETED_AT' => Yii::t('app', 'deletedAt'),
+            'IS_DEC' => Yii::t('app', 'isDec'),
+            'IS_ATLAS' => Yii::t('app', 'isAtlas'),
+            'IS_RECHARGE' => Yii::t('app', 'isRecharge'),
+            'DEC_ID' => Yii::t('app', 'DEC_ID'),
+            'BIRTHDAY' => Yii::t('app', 'birthday'),
+            'DEC_ROLE_ID' => Yii::t('app', 'decRoleID'),
+            'PERIOD_AT' => Yii::t('app', 'periodAt'),
+            'DEC_PROVINCE' => Yii::t('app', 'decProvince'),
+            'DEC_CITY' => Yii::t('app', 'decCity'),
+            'DEC_COUNTY' => Yii::t('app', 'decCounty'),
+            'IS_UNION' => Yii::t('app', 'isUnion'),
+            'STATUS_AT' => Yii::t('app', 'statusAt'),
+            'VERIFIED' => Yii::t('app', 'verified'),
+            'VERIFIED_AT' => Yii::t('app', 'verifiedAt'),
+            'ALLOW_LOGIN' => Yii::t('app', 'allowLogin'),
+            'NOT_OPERATING' => Yii::t('app', 'notOperating'),
+            'REG_FROM' => Yii::t('app', 'regFrom'),
+            'ID_CARD_PREFIX' => Yii::t('app', 'IDCardPrefix'),
+            'SEX' => Yii::t('app', 'sex'),
+            'DEC_ACCOUNT_OLD' => Yii::t('app', 'decAccountOld'),
+            'BANK_UPDATED_AT' => Yii::t('app', 'bankUpdatedAt'),
+            'IS_DIRECT_SELLER' => Yii::t('app', 'isDirectSeller'),
+            'DEC_LV_UPDATED_AT' => Yii::t('app', 'decLvUpdatedAt'),
+            'DEC_LV_UPDATED_PERIOD' => Yii::t('app', 'decLvUpdatedPeriod'),
+            'DEC_ADDRESS' => Yii::t('app', 'decAddress'),
+            'DEC_PHONE' => Yii::t('app', 'decPhone'),
+            'GUARANTOR' => Yii::t('app', 'guarantor'),
+            'GUARANTOR_NAME' => Yii::t('app', 'guarantorName'),
+            'PART_FUNC_CLOSED' => Yii::t('app', 'partFuncClosed'),
+            'LAST_DEC_LV_UPDATED_PERIOD' => Yii::t('app', 'lastDecLvUpdatedPeriod'),
+            'USER_CREATOR' => Yii::t('app', 'userCreator'),
+            'USER_UPDATER' => Yii::t('app', 'userUpdater'),
+            'LAST_DEC_LV_UPDATED_AT' => Yii::t('app', 'lastDecLvUpdatedAt'),
+            'DEC_CREATED_AT' => Yii::t('app', 'decCreatedAt'),
+            'PART_FUNC_CLOSED_REMARK' => Yii::t('app', 'partFuncClosedRemark'),
+            'DEC_CREATED_PERIOD' => Yii::t('app', 'decCreatedPeriod'),
+            'PASSWORD_CHANGED' => Yii::t('app', 'passwordChanged'),
+            'SUB_COM_LEADER' => Yii::t('app', 'subComLeader'),
+            'ZG_UPGRADE_PV' => Yii::t('app', 'zgUpgradePv'),
+            'APP_CLIENT_ID' => Yii::t('app', 'appClientID'),
+            'READ_AGREEMENT' => Yii::t('app', 'readAgreement'),
+            'LAST_DEC_LV' => Yii::t('app', 'lastDecLv'),
+            'BONUS_APP_CLIENT_ID' => Yii::t('app', 'bonusAppClientID'),
+            'IS_FIRST_OPEN' => Yii::t('app', 'isFirstOpen'),
+            'IS_MODIFY_PASSWORD' => Yii::t('app', 'isModifyPassword'),
+            'IS_STUDIO' => Yii::t('app', 'isStudio'),
+            'EMAIL' => Yii::t('app', 'email'),
         ];
     }
 

+ 15 - 14
common/models/forms/ApproachDeclarationForm.php

@@ -28,6 +28,7 @@ use common\models\User;
 use common\models\UserInfo;
 use common\models\UserNetwork;
 use common\models\UserRelation;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -195,7 +196,7 @@ class ApproachDeclarationForm extends Model
      */
     public function issetDec($attribute){
         if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
-            $this->addError($attribute, 'Stockist does not exist');//报单中心不存在
+            $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
             return false;
         } else {
             if ($this->decType !== 'ba') {
@@ -376,7 +377,7 @@ class ApproachDeclarationForm extends Model
         else {
             if($this->insertUserName == $conUserName){
                // $this->addError('recUserName', '新加入的会员不存在');
-                $this->addError('recUserName', 'New member does not exist');
+                $this->addError('recUserName', Yii::t('app', 'newMemberDoesNotExist'));
                 return false;
             }
             // 去数据库里查找这个会员的所有上级
@@ -418,7 +419,7 @@ class ApproachDeclarationForm extends Model
         if($this->type == self::TYPE_ZC){
             if(!in_array($this->location, [1, 2, 3])){
                 //$this->addError($attribute, '市场必须在第1市场、第2市场或第三3市场');
-                $this->addError($attribute, 'Please select a market');
+                $this->addError($attribute, Yii::t('app', 'pleaseSelectMarket'));
             }
             $conUser = $recUser = null;
             if(isset($this->_tempParentUser[$this->conUserName])){
@@ -556,16 +557,16 @@ class ApproachDeclarationForm extends Model
         if(array_key_exists($this->type, $this->_types)){
             if($this->type == self::TYPE_ZC){
                 if($this->scenario == 'userDec'){
-                    if(!$this->insertUserName) $this->addError($attribute, 'Membership number must be filled in for initial purchase');//首购必须填写加入会员编号
+                    if(!$this->insertUserName) $this->addError($attribute, Yii::t('app', 'MembershipNumberFilledInitialPurchase'));
                 }
-                if(!$this->insertUserName) $this->addError($attribute, 'Membership number must be filled in for initial purchase');//首购必须填写加入会员编号
+                if(!$this->insertUserName) $this->addError($attribute, Yii::t('app', 'MembershipNumberFilledInitialPurchase'));
 //                if(!$this->insertUserIdCard) $this->addError($attribute, 'For the first purchase, the ID number of the member must be filled in');//首购必须填写加入会员的身份证号
-                if(!$this->conUserName) $this->addError($attribute, 'For the first purchase, you must fill in the instructor number of the member');//首购必须填写加入会员的指导老师编号
-                if(!$this->recUserName) $this->addError($attribute, 'For the first purchase, the Sponsor number of the member must be filled in');//首购必须填写加入会员的开拓人编号
-                if(!$this->location) $this->addError($attribute, 'The first purchase must be filled in the market of the member');//首购必须填写加入会员的市场
+                if(!$this->conUserName) $this->addError($attribute, Yii::t('app', 'fillTheInstructorNumberTheMember'));
+                if(!$this->recUserName) $this->addError($attribute, Yii::t('app', 'sponsorNumberMustBeFilled'));
+                if(!$this->location) $this->addError($attribute, Yii::t('app', 'beFilledTheMarketMember'));
             }
         } else {
-            $this->addError($attribute, 'Incorrect entry type');//报单类型不正确
+            $this->addError($attribute, Yii::t('app', 'incorrectEntryType'));
         }
     }
 
@@ -617,14 +618,14 @@ class ApproachDeclarationForm extends Model
         if($this->type == self::TYPE_ZC) {
             try {
                 if (preg_match("/[\x7f-\xff]/", $this->insertUserName)) {  //判断字符串中是否有中文
-                    throw new Exception('Member number cannot contain Chinese characters');//会员编号中不能含有汉字
+                    throw new Exception(Yii::t('app', 'memberNumberCanNotContainChineseCharacters'));
                 }
                 //报单商品及PV判断
                 $decLevelConfig = Cache::getDecLevelConfig();
                 $decLevel = $decLevelConfig[$this->decLv];
                 $toDecLevel = $this->decLv;
                 if (!$this->decLv) {
-                    throw new Exception('Please select the entry level');//请选择报单级别
+                    throw new Exception(Yii::t('app', 'pleaseSelectTheEntryLevel'));
                 }
 
                 if ($this->decWay == 1) {
@@ -676,7 +677,7 @@ class ApproachDeclarationForm extends Model
                         }
                     }
                     if ($totalPv < $decLevel['PERF']) {
-                        throw new Exception('The total BV of self selected goods cannot be less than the BV of the selected entry level');//自选商品总BV不能小于所选报单级别BV
+                        throw new Exception(Yii::t('app', 'totalBVCanNotLessThanSelectedBV'));
                     }
                     foreach ($decLevelConfig as $key => $val) {
                         if ($totalPv >= $val['PERF']) {
@@ -684,7 +685,7 @@ class ApproachDeclarationForm extends Model
                         }
                     }
                     if ($this->decLv != $toDecLevel) {
-                        throw new Exception('The total BV of self selected goods cannot exceed the BV value of the next level under the selected level');//自选商品总BV不能超过已选级别下一个级别的BV值
+                        throw new Exception(Yii::t('app', 'totalBVCanNotLessThanNextSelectedLevelBV'));
                     }
                     $this->_decAmount = $totalAmount;
                     $this->_decPv = $totalPv;
@@ -820,7 +821,7 @@ class ApproachDeclarationForm extends Model
             $warehouse = Region::getWarehouseByCode($this->province);
             if (!$warehouse) {
                 // 地区暂时不支持配送,具体联系客服
-                throw new Exception('Delivery is temporarily not supported in the region. Contact customer service for details');
+                throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'));
             }
         } else {
             $warehouse = '01';

+ 9 - 8
common/models/forms/ApproachDeclarationLoopForm.php

@@ -4,6 +4,7 @@ namespace common\models\forms;
 use common\components\Model;
 use common\helpers\Form;
 use common\models\UserBind;
+use Yii;
 use yii\base\Exception;
 use yii\helpers\Json;
 use common\models\DeclarationPackage;
@@ -90,7 +91,7 @@ class ApproachDeclarationLoopForm extends Model
                 $model->location = null;
                 $model->decType = null;
             } else {
-                $this->addError($attribute, 'The format of the report data is incorrect');// 报单数据格式错误
+                $this->addError($attribute, Yii::t('app', 'reportFormatIncorrect'));
             }
 
         }
@@ -121,7 +122,7 @@ class ApproachDeclarationLoopForm extends Model
                 if (isset($value['packageId']) && $value['packageId']){
                     $packagedata = DeclarationPackage::findOneAsArray('ID=:ID', [':ID' => $value['packageId']]);
                     if (!$packagedata) {
-                        throw new Exception('Products does not exists!');
+                        throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                     }
                     if($packagedata['STORE_NUMS']>0){
                         $data =  DeclarationPackage::find()->where(['ID'=> $packagedata['ID'] ])->one();
@@ -135,7 +136,7 @@ class ApproachDeclarationLoopForm extends Model
                             $data->UPDATED_AT = Date::nowTime();
                         }
                     }else{
-                        throw new Exception($packagedata['PACKAGE_NAME'].'Insufficient inventory');// 库存不足
+                        throw new Exception($packagedata['PACKAGE_NAME'] . Yii::t('app', 'insufficientInventory'));
                     }
                 }
                 // 普通商品报单
@@ -143,7 +144,7 @@ class ApproachDeclarationLoopForm extends Model
                     for ($i = 0; $i < count($value['goodsId']) ;$i++) {
                         $goods = ShopGoods::findOneAsArray('ID=:ID',[':ID'=> $value['goodsId'][$i]]);
                         if (!$goods) {
-                            throw new Exception('Products does not exists!');
+                            throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                         }
                         if ($goods['STATUS'] == 1 ){
                             if($goods['STORE_NUMS'] >= $value['goodsNum'][$i]) {
@@ -159,10 +160,10 @@ class ApproachDeclarationLoopForm extends Model
                                     $data->update();
                                 }
                             } else {
-                                throw new Exception($goods['GOODS_NAME'].'Insufficient inventory');// 商品库存不足
+                                throw new Exception($goods['GOODS_NAME'] . Yii::t('app', 'insufficientInventory'));
                             }
                         }else{
-                            throw new Exception($goods['GOODS_NAME'].'Sold out');// 商品已下架
+                            throw new Exception($goods['GOODS_NAME'] . Yii::t('app', 'soldOut'));
                         }
 
                     }
@@ -177,7 +178,7 @@ class ApproachDeclarationLoopForm extends Model
                     if( $model->type == 'ZC'){
                         if($zcUserIdCard != null){
                             if($model->insertUserIdCard != $zcUserIdCard){
-                                throw new Exception('Bulk declaration member must be the same member');//批量报单会员必须是同一身份证
+                                throw new Exception(Yii::t('app', 'bulkDeclarationNotSames'));
                             }
                         } else {
                             $zcUserIdCard = $model->insertUserIdCard;
@@ -189,7 +190,7 @@ class ApproachDeclarationLoopForm extends Model
                         throw new Exception(Form::formatErrorsForApi($model->getErrors()));
                     }
                 } else {
-                    throw new Exception('The format of the report data is incorrect');// 报单数据格式错误
+                    throw new Exception(Yii::t('app', 'reportFormatIncorrect'));
                 }
             }
 

+ 8 - 7
common/models/forms/ApproachDeclarationUpgradeForm.php

@@ -25,6 +25,7 @@ use common\models\ShopGoods;
 use common\models\User;
 use common\models\UserInfo;
 use common\models\UserNetwork;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -119,13 +120,13 @@ class ApproachDeclarationUpgradeForm extends Model
             $decLevel = $decLevelConfig[$this->decLv];
             $toDecLevel = $this->decLv;
             if(!$this->decLv){
-                throw new Exception('Please select upgrade level');//请选择升级级别
+                throw new Exception(Yii::t('app', 'pleaseSelectUpgradeLevel'), 400);
             }
             $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
             $userId = $baseInfo['ID'];
             $userDecPvSum = User::sumDevPvByUserId($userId); // 用户所有报单PV总和
             if ($userDecPvSum != $this->nowPerf) {
-                throw new Exception('Please contact the customer service personnel to check the performance of upgraded members');//请联系客服人员核对升级会员业绩
+                throw new Exception(Yii::t('app', 'checkPerformanceOfUpgradedMember'), 400);
             }
             // 获取用户是否是观察期
             $observe = Config::getConfigByType('observe'); // 获取观察期配置信息
@@ -133,7 +134,7 @@ class ApproachDeclarationUpgradeForm extends Model
             $isObserve = User::checkIsObserve($baseInfo['CREATED_AT'], $observeLimit); // 判断用户是否再观察期中
             $diffPerf = $isObserve ? $this->nowPerf : 0; // 观察期内升级要加上用户累计的PV,全额则基础PV为0,全额购买
             if ($this->decWay != 2) {
-                throw new Exception('The upgrade method is incorrect. Please contact the customer service personnel');//升级方式不正确,请联系客服人员
+                throw new Exception(Yii::t('app', 'upgradeMethodIncorrect'), 400);
             }
             if($this->decWay==1) {
                 // 先不加套餐升级方式
@@ -189,7 +190,7 @@ class ApproachDeclarationUpgradeForm extends Model
                 // 这里特殊是用户原报单PV之和+用户购买的商品总PV
                 $checkPv = $totalPv + $diffPerf;
                 if($checkPv < $decLevel['PERF']) {
-                    throw new Exception('Total PV cannot be less than the selected level PV');//总PV不能小于所选级别PV
+                    throw new Exception(Yii::t('app', 'totalPVLessThan'), 400);
                 }
                 foreach ($decLevelConfig as $key=>$val){
                     if($checkPv>=$val['PERF']){
@@ -197,7 +198,7 @@ class ApproachDeclarationUpgradeForm extends Model
                     }
                 }
                 if($this->decLv!=$toDecLevel){
-                    throw new Exception('The total PV cannot exceed the PV value of the next level under the selected level');//总PV不能超过已选级别下一个级别的PV值
+                    throw new Exception(Yii::t('app', 'totalPvExceedPv'), 400);
                 }
                 $this->_decAmount = $totalAmount;
                 $this->_decPv = $totalPv;
@@ -211,7 +212,7 @@ class ApproachDeclarationUpgradeForm extends Model
             $insertRecId = $baseInfo['REC_UID'];
             $decResult = $this->addDecOrder($insertConId, $insertRecId, $baseInfo['DEC_LV'], $isObserve, $this->remark);
             if (!$decResult) {
-                throw new Exception("operation failed");//操作失败
+                throw new Exception(Yii::t('app', 'failed'), 400);
             }
             return $decResult;
         }
@@ -226,7 +227,7 @@ class ApproachDeclarationUpgradeForm extends Model
     {
         $warehouse = Region::getWarehouseByCode($this->province);//仓库
         if(!$warehouse){
-            throw new Exception('Delivery is temporarily not supported in the region. Contact customer service for details');//地区暂时不支持配送,具体联系客服
+            throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'), 400);
         }
 
         $upgradeType = $isObserve ? 1 : 2; // 1补差  2全额

+ 47 - 48
common/models/forms/ApproachOrderForm.php

@@ -26,6 +26,7 @@ use common\models\Region;
 use common\models\ShopGoods;
 use common\models\User;
 use common\models\UserNetwork;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -97,28 +98,26 @@ class ApproachOrderForm extends Model
     public function attributeLabels()
     {
         return [
-            'sn' => 'Order code',//订单号
-            'expressCompany' => 'ExpressCompany',//快递公司
-            'orderTrackNo' => 'courier number',//快递单号
-            'status' => 'status',//状态
-            'remark' => 'remark',//备注
-            'type' => 'order type',//订单类型
-            'addressId' => 'addressId',//收货地址
-            'payType' => 'payType',//支付方式
-            'goodsId' => 'Product ID',
-            'goodsNum' => 'Product quantity',//
-            'userName' => '复消会员编号',//复消会员编号
-            'consignee' => '收货人',//收货人
-            'acceptMobile' => '收货电话',//收货电话
-            'province' => '省',
-            'city' => '市',
-            'county' => '区',
-
-            'lgaName' => 'lga name',
-            'cityName' => 'City Name',
-            'detailaddress' => '收货详细地址',
-
-            'email' => 'Email',
+            'sn' => Yii::t('app', 'orderSn'),
+            'expressCompany' => Yii::t('app', 'expressCompany'),
+            'orderTrackNo' => Yii::t('app', 'orderTrackNo'),
+            'status' => Yii::t('app', 'state'),
+            'remark' => Yii::t('app', 'remark'),
+            'type' => Yii::t('app', 'orderType'),
+            'addressId' => Yii::t('app', 'shippingAddress'),
+            'payType' => Yii::t('app', 'payType'),
+            'goodsId' => Yii::t('app', 'productID'),
+            'goodsNum' => Yii::t('app', 'quantity'),
+            'userName' => Yii::t('app', 'repeatSalesMemberNo'),
+            'consignee' => Yii::t('app', 'consignee'),
+            'acceptMobile' => Yii::t('app', 'acceptMobile'),
+            'province' => Yii::t('app', 'province'),
+            'city' => Yii::t('app', 'city'),
+            'county' => Yii::t('app', 'county'),
+            'lgaName' =>Yii::t('app', 'lgaName'),
+            'cityName' => Yii::t('app', 'cityName'),
+            'detailaddress' => Yii::t('app', 'detailAddress'),
+            'email' => Yii::t('app', 'email'),
         ];
     }
 
@@ -150,14 +149,14 @@ class ApproachOrderForm extends Model
         if ($this->sn) {
             $this->_model = ApproachOrder::findOne(['SN' => $this->sn]);
             if (!$this->_model){
-                $this->addError('sn', '订单不存在');
+                $this->addError('sn', Yii::t('app', 'orderDoesNotExist'));
                 return false;
             }
         }
 
         if ($this->scenario == 'verifyPayStack'){
             if ($this->_model->STATUS != \Yii::$app->params['orderStatus']['notPaid']['value']) {
-                $this->addError('sn', '订单支付状态错误');
+                $this->addError('sn', Yii::t('app', 'payTypeError'));
                 return false;
             }
         }
@@ -171,7 +170,7 @@ class ApproachOrderForm extends Model
      */
     public function isAddress($attribute){
         if (!$receiveAddress = ReceiveAddress::find()->where(' ID=:ID', [':ID' => $this->addressId])->asArray()->one()) {
-            $this->addError($attribute, '收货地址不存在');
+            $this->addError($attribute, Yii::t('app', 'shippingDoesNotExist'));
         } else {
             $this->_address = $receiveAddress;
         }
@@ -184,7 +183,7 @@ class ApproachOrderForm extends Model
      */
     public function validatePassword($attribute, $params) {
         if (!User::validatePayPassword(\Yii::$app->user->id, $this->payPassword)) {
-            $this->addError($attribute, 'The payment password is incorrect');//支付密码不正确
+            $this->addError($attribute, Yii::t('app', 'paymentPasswordError'));
         }
     }
 
@@ -195,26 +194,26 @@ class ApproachOrderForm extends Model
     public function isPayType($attribute)
     {
         if ($this->payType != 'pay_stack'){
-            $this->addError($attribute, '只允许PayStack方式支付');
+            $this->addError($attribute, Yii::t('app', 'payTypeError'));
             return;
         }
 
         // 一个订单只能包含一类商品
         $goods = ShopGoods::find()->select('ID,CATEGORY_TYPE')->where(['in', 'ID', $this->goodsId])->andWhere(['STATUS' => 1])->asArray()->all();
         if (!$goods) {
-            $this->addError($attribute, 'Products does not exists!');
+            throw new Exception(Yii::t('app', 'orderCanNotContainMultipleProductCategories'));
             return;
         }
         $goodsCategoryType = array_unique(array_column($goods, 'CATEGORY_TYPE'));
         if (count($goodsCategoryType) > 1) {
-            $this->addError($attribute, 'Order cannot contain multiple product categories');//订单不能包含多种商品分类
+            $this->addError($attribute, Yii::t('app', 'orderCanNotHasMoreClassification'));
             return;
         }
 
         // 购买方式
         $sellTypeLabelMap = array_column(ShopGoods::SALE_TYPE, NULL, 'label');
         if (!array_key_exists($this->payType, $sellTypeLabelMap)) {
-            $this->addError($attribute, '不支持PayStack方式支付');
+            $this->addError($attribute, Yii::t('app', 'payTypeError'));
             return;
         }
 
@@ -223,13 +222,13 @@ class ApproachOrderForm extends Model
         // 商品类型
         $currCategoryType = $goodsCategoryType[0];
         if (!array_key_exists($currCategoryType, $categoryType)) {
-            $this->addError($attribute, '商品分类错误');
+            $this->addError($attribute, Yii::t('app', 'shopGoodClassificationError'));
             return;
         }
 
         $sellType = $categoryType[$currCategoryType]['sell_type'] ?? [];
         if (!$sellType || !in_array($this->payType, array_column($sellType, 'label'))) {
-            $this->addError($attribute, '支付方式错误3');
+            $this->addError($attribute, Yii::t('app', 'payTypeError'));
         }
     }
 
@@ -238,44 +237,44 @@ class ApproachOrderForm extends Model
      * @param $attribute
      */
     public function isStatus($attribute){
-        if($this->type && !in_array($this->type, \Yii::$app->params['orderStatus'])){
-            $this->addError($attribute, '订单状态类型错误');
+        if(!in_array($this->type, \Yii::$app->params['orderStatus'])){
+            $this->addError($attribute, Yii::t('app', 'orderStatusTypeError'));
             return ;
         }
         if ($this->scenario == 'adminStatus'){
             if ($this->status == $this->_model['STATUS']) {
-                $this->addError($attribute, '订单状态没有改变');
+                $this->addError($attribute, Yii::t('app', 'orderStatusDoesNotChange'));
                 return ;
             }
             if($this->status == \Yii::$app->params['orderStatus']['notPaid'] && $this->_model['STATUS'] >= \Yii::$app->params['orderStatus']['delivery']) {
-                $this->addError($attribute, '订单已经进入物流状态不能改为未支付');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenLogisticsStatusDoesNotChangedUnpaid'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['paid'] && $this->_model['STATUS'] >= \Yii::$app->params['orderStatus']['cancel']) {
-                $this->addError($attribute, '订单已失效不能处理');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenInvalidCanNotProcess'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['delivery']) {
-                $this->addError($attribute, '订单不能单独处理为物流状态');
+                $this->addError($attribute, Yii::t('app', 'orderCanNotBeenChangedLogistics'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['complete'] && $this->_model['STATUS'] > \Yii::$app->params['orderStatus']['cancel']) {
-                $this->addError($attribute, '订单已失效不能处理');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenInvalidCanNotProcess'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['cancel']) {
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['complete']) {
-                    $this->addError($attribute, '订单已完成不能取消');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenFinishedCanNotCancel'));
                     return ;
                 }
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['del']) {
-                    $this->addError($attribute, '订单已删除不能取消');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenDeletedCanNotCancel'));
                     return ;
                 }
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['del']) {
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['complete']) {
-                    $this->addError($attribute, '订单已完成不能删除');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenFinishedCanNotDelete'));
                     return ;
                 }
             }
@@ -301,7 +300,7 @@ class ApproachOrderForm extends Model
             throw new Exception(Form::formatErrorsForApi($payload['message']));
         }
         if ($payload['data']['amount'] != $this->_model->PAY_AMOUNT * 100) {
-            throw new Exception(Form::formatErrorsForApi('支付金额与订单金额不符'));
+            throw new Exception(Form::formatErrorsForApi(Yii::t('app', 'payAmountNotEqualOrderAmount')));
         }
 
         // 订单类型:userOrder(会员订单)、userUpgrade(会员升级)、userDec(会员报单)
@@ -343,7 +342,7 @@ class ApproachOrderForm extends Model
                     // 修改会员锁定状态
                     if (in_array($orderType, ['userDec', 'baUpgrade'])) {
                         if (!User::updateAll(['STATUS' => 1], 'ID=:USER_ID', [':USER_ID' => $approachDecOrder['TO_USER_ID']])) {
-                            throw new Exception(Form::formatErrorsForApi('change user status error'));
+                            throw new Exception(Form::formatErrorsForApi(Yii::t('app', 'changeUserStatusError')));
                         }
                     }
                     // 修改BA会员升级状态
@@ -351,7 +350,7 @@ class ApproachOrderForm extends Model
                         // 查询BA会员名
                         $userInfo = User::findOneAsArray('ID=:USER_ID', [':USER_ID' => $approachDecOrder['TO_USER_ID']]);
                         if (!BaUser::updateAll(['WHETHER_UPGRADE' => 1, 'BA_UPGRADE_AT' => time()], 'USER_NAME=:USER_NAME', [':USER_NAME' => $userInfo['USER_NAME']])) {
-                            throw new Exception(Form::formatErrorsForApi('Brand Ambassador upgrade error!'));
+                            throw new Exception(Form::formatErrorsForApi(Yii::t('app', 'brandAmbassadorUpgradeError')));
                         }
                     }
 
@@ -372,7 +371,7 @@ class ApproachOrderForm extends Model
                             $modifyDecLv = $decLevelLog->frontendChange($decLog);
                             if (empty($modifyDecLv)) {
                                 $transaction->rollBack();
-                                throw new Exception("Failed to upgrade for member");//为会员升级失败
+                                throw new Exception(Yii::t('app', 'failedToUpgrade'));
                             }
                         }
                     }
@@ -416,7 +415,7 @@ class ApproachOrderForm extends Model
             if ($v) {
                 $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
                 if (!$goods) {
-                    throw new Exception('Products does not exists!');
+                    throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                 }
                 if($goods['STORE_NUMS']>0){
                     if ($goods['TYPE'] == 1 || $goods['TYPE'] == 2) {
@@ -512,7 +511,7 @@ class ApproachOrderForm extends Model
         if ($this->_address['PROVINCE'] != 1) {
             $warehouse = Region::getWarehouseByCode($this->_address['PROVINCE']);//仓库
             if (!$warehouse) {
-//                throw new Exception('地区2暂时不支持配送,具体联系客服');
+//                throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'));
             }
         }else{
             $warehouse = '01';

+ 9 - 8
common/models/forms/BaApproachDeclarationLoopForm.php

@@ -4,6 +4,7 @@ namespace common\models\forms;
 use common\components\Model;
 use common\helpers\Form;
 use common\models\UserBind;
+use Yii;
 use yii\base\Exception;
 use yii\helpers\Json;
 use common\models\DeclarationPackage;
@@ -58,7 +59,7 @@ class BaApproachDeclarationLoopForm extends Model
     public function formatData($attribute){
         //$this->data = Json::decode($this->data);
         if(!is_array($this->data)){
-            $this->addError($attribute, 'Data format error');// 数据格式错误
+            $this->addError($attribute, Yii::t('app', 'dataFormatError'));
         }
     }
 
@@ -89,7 +90,7 @@ class BaApproachDeclarationLoopForm extends Model
                 $model->recUserName = null;
                 $model->location = null;
             } else {
-                $this->addError($attribute, 'The format of the report data is incorrect');// 报单数据格式错误
+                $this->addError($attribute, Yii::t('app', 'reportFormatIncorrect'));
             }
 
         }
@@ -120,7 +121,7 @@ class BaApproachDeclarationLoopForm extends Model
                 if (isset($value['packageId']) && $value['packageId']){
                     $packagedata = DeclarationPackage::findOneAsArray('ID=:ID', [':ID' => $value['packageId']]);
                     if (!$packagedata) {
-                        throw new Exception('Products does not exists!');
+                        throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                     }
                     if($packagedata['STORE_NUMS']>0){
                         $data =  DeclarationPackage::find()->where(['ID'=> $packagedata['ID'] ])->one();
@@ -134,7 +135,7 @@ class BaApproachDeclarationLoopForm extends Model
                             $data->UPDATED_AT = Date::nowTime();
                         }
                     }else{
-                        throw new Exception($packagedata['PACKAGE_NAME'].'Insufficient inventory');// 库存不足
+                        throw new Exception($packagedata['PACKAGE_NAME']. Yii::t('app', 'insufficientInventory'));
                     }
                 }
                 // 普通商品报单
@@ -158,10 +159,10 @@ class BaApproachDeclarationLoopForm extends Model
                                     $data->update();
                                 }
                             } else {
-                                throw new Exception($goods['GOODS_NAME'].'Insufficient inventory');// 商品库存不足
+                                throw new Exception($goods['GOODS_NAME']. Yii::t('app', 'insufficientInventory'));
                             }
                         }else{
-                            throw new Exception($goods['GOODS_NAME'].'Sold out');// 商品已下架
+                            throw new Exception($goods['GOODS_NAME']. Yii::t('app', 'soldOut'));
                         }
                     }
                 }
@@ -174,7 +175,7 @@ class BaApproachDeclarationLoopForm extends Model
                     if( $model->type == 'ZC'){
                         if($zcUserIdCard != null){
                             if($model->insertUserIdCard != $zcUserIdCard){
-                                throw new Exception('Bulk declaration member must be the same member');//批量报单会员必须是同一身份证
+                                throw new Exception(Yii::t('app', 'bulkDeclarationNotSames'));
                             }
                         } else {
                             $zcUserIdCard = $model->insertUserIdCard;
@@ -186,7 +187,7 @@ class BaApproachDeclarationLoopForm extends Model
                         throw new Exception(Form::formatErrorsForApi($model->getErrors()));
                     }
                 } else {
-                    throw new Exception('The format of the report data is incorrect');// 报单数据格式错误
+                    throw new Exception(Yii::t('app', 'reportFormatIncorrect'));
                 }
             }
 

+ 38 - 38
common/models/forms/BaApproachOrderForm.php

@@ -33,6 +33,7 @@ use common\models\Region;
 use common\models\ShopGoods;
 use common\models\User;
 use common\models\UserNetwork;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -100,23 +101,23 @@ class BaApproachOrderForm extends Model
     public function attributeLabels(): array
     {
         return [
-            'sn' => 'Order code',//订单号
-            'expressCompany' => 'Express Company',//快递公司
-            'orderTrackNo' => 'Track Code',//快递单号
-            'status' => 'Status',//状态
-            'remark' => 'Remark',//备注
-            'type' => 'Order Type',//订单类型
-            'addressId' => 'AddressId',//收货地址
-            'payType' => 'PayType',//支付方式
-            'goodsId' => 'Product ID',// 商品编号
-            'goodsNum' => 'Quantity',//
-            'userName' => 'UserName',//复消会员编号
-            'consignee' => 'Consignee',//收货人
-            'acceptMobile' => 'Accept Mobile',//收货电话
-            'lgaName' => 'LgaName',
-            'cityName' => 'CityName',
-            'detailaddress' => 'Detail Address',// 收货详细地址
-            'email' => 'Email',
+            'sn' => Yii::t('app', 'orderSn'),
+            'expressCompany' => Yii::t('app', 'expressCompany'),
+            'orderTrackNo' => Yii::t('app', 'orderTrackNo'),
+            'status' => Yii::t('app', 'state'),
+            'remark' => Yii::t('app', 'remark'),
+            'type' => Yii::t('app', 'orderType'),
+            'addressId' => Yii::t('app', 'shippingAddress'),
+            'payType' => Yii::t('app', 'payType'),
+            'goodsId' => Yii::t('app', 'productID'),
+            'goodsNum' => Yii::t('app', 'quantity'),
+            'userName' => Yii::t('app', 'repeatSalesMemberNo'),
+            'consignee' => Yii::t('app', 'consignee'),
+            'acceptMobile' => Yii::t('app', 'acceptMobile'),
+            'lgaName' =>Yii::t('app', 'lgaName'),
+            'cityName' => Yii::t('app', 'cityName'),
+            'detailaddress' => Yii::t('app', 'detailAddress'),
+            'email' => Yii::t('app', 'email'),
         ];
     }
 
@@ -148,14 +149,14 @@ class BaApproachOrderForm extends Model
         if ($this->sn) {
             $this->_model = BaApproachOrder::findOne(['SN' => $this->sn]);
             if (!$this->_model){
-                $this->addError('sn', 'Order does not exist');// 订单不存在
+                $this->addError('sn', Yii::t('app', 'orderDoesNotExist'));
                 return false;
             }
         }
 
         if ($this->scenario == 'verifyPayStack'){
             if ($this->_model->STATUS != \Yii::$app->params['orderStatus']['notPaid']['value']) {
-                $this->addError('sn', '订单支付状态错误');
+                $this->addError('sn', Yii::t('app', 'payTypeError'));
                 return false;
             }
         }
@@ -171,7 +172,7 @@ class BaApproachOrderForm extends Model
     public function isAddress($attribute, $params)
     {
         if (!$receiveAddress = BaReceiveAddress::find()->where(' ID=:ID', [':ID' => $this->addressId])->asArray()->one()) {
-            $this->addError($attribute, 'Receive address does not exist'); // 收货地址不存在
+            $this->addError($attribute, Yii::t('app', 'shippingDoesNotExist'));
         } else {
             $this->_address = $receiveAddress;
         }
@@ -184,7 +185,7 @@ class BaApproachOrderForm extends Model
      */
     public function validatePassword($attribute, $params) {
         if (!BaUser::validatePayPassword(\Yii::$app->user->id, $this->payPassword)) {
-            $this->addError($attribute, 'The payment password is incorrect');//支付密码不正确
+            $this->addError($attribute, Yii::t('app', 'paymentPasswordError'));
         }
     }
 
@@ -203,7 +204,7 @@ class BaApproachOrderForm extends Model
         $goods = ShopGoods::find()->select('ID,CATEGORY_TYPE')->where(['in', 'ID', $this->goodsId])->andWhere(['STATUS' => 1])->asArray()->all();
         $goodsCategoryType = array_unique(array_column($goods, 'CATEGORY_TYPE'));
         if (count($goodsCategoryType) != 1) {
-            $this->addError($attribute, 'Order cannot contain multiple product categories');//订单不能包含多种商品分类
+            $this->addError($attribute, Yii::t('app', 'orderCanNotContainMultipleProductCategories'));
         }
     }
 
@@ -211,46 +212,45 @@ class BaApproachOrderForm extends Model
      * 校验类型
      * @param $attribute
      */
-    public function isStatus($attribute)
-    {
-        if($this->type && !in_array($this->type, \Yii::$app->params['orderStatus'])){
-            $this->addError($attribute, '订单状态类型错误');
+    public function isStatus($attribute){
+        if(!in_array($this->type, \Yii::$app->params['orderStatus'])){
+            $this->addError($attribute, Yii::t('app', 'orderStatusTypeError'));
             return ;
         }
         if ($this->scenario == 'adminStatus'){
             if ($this->status == $this->_model['STATUS']) {
-                $this->addError($attribute, '订单状态没有改变');
+                $this->addError($attribute, Yii::t('app', 'orderStatusDoesNotChange'));
                 return ;
             }
             if($this->status == \Yii::$app->params['orderStatus']['notPaid'] && $this->_model['STATUS'] >= \Yii::$app->params['orderStatus']['delivery']) {
-                $this->addError($attribute, '订单已经进入物流状态不能改为未支付');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenLogisticsStatusDoesNotChangedUnpaid'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['paid'] && $this->_model['STATUS'] >= \Yii::$app->params['orderStatus']['cancel']) {
-                $this->addError($attribute, '订单已失效不能处理');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenInvalidCanNotProcess'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['delivery']) {
-                $this->addError($attribute, '订单不能单独处理为物流状态');
+                $this->addError($attribute, Yii::t('app', 'orderCanNotBeenChangedLogistics'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['complete'] && $this->_model['STATUS'] > \Yii::$app->params['orderStatus']['cancel']) {
-                $this->addError($attribute, '订单已失效不能处理');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenInvalidCanNotProcess'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['cancel']) {
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['complete']) {
-                    $this->addError($attribute, '订单已完成不能取消');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenFinishedCanNotCancel'));
                     return ;
                 }
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['del']) {
-                    $this->addError($attribute, '订单已删除不能取消');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenDeletedCanNotCancel'));
                     return ;
                 }
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['del']) {
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['complete']) {
-                    $this->addError($attribute, '订单已完成不能删除');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenFinishedCanNotDelete'));
                     return ;
                 }
             }
@@ -276,7 +276,7 @@ class BaApproachOrderForm extends Model
             throw new Exception(Form::formatErrorsForApi($payload['message']));
         }
         if ($payload['data']['amount'] != $this->_model->PAY_AMOUNT * 100) {
-            throw new Exception(Form::formatErrorsForApi('支付金额与订单金额不符'));
+            throw new Exception(Form::formatErrorsForApi(Yii::t('app', 'payAmountNotEqualOrderAmount')));
         }
 
         // 订单类型:baOrder(BA订单)、baDec(BA报单)
@@ -316,7 +316,7 @@ class BaApproachOrderForm extends Model
 
                     // 修改会员锁定状态
                     if (!BaUser::updateAll(['STATUS' => 1], 'ID=:USER_ID', [':USER_ID' => $approachDecOrder['TO_USER_ID']])) {
-                        throw new Exception(Form::formatErrorsForApi('Update Brand Ambassador status error'));
+                        throw new Exception(Form::formatErrorsForApi(Yii::t('app', 'brandAmbassadorUpgradeError')));
                     }
                 }
                 BaApproachDecOrder::deleteAll('ORDER_SN = :ORDER_SN', [':ORDER_SN' => $this->sn]);
@@ -355,7 +355,7 @@ class BaApproachOrderForm extends Model
             if ($v) {
                 $goods = ShopGoods::findOneAsArray('ID = :ID AND STATUS = 1', [':ID' => $ids[$k]]);
                 if (!$goods) {
-                    throw new Exception('Products does not exists!');
+                    throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                 }
                 if ($goods['STORE_NUMS'] > 0) {
                     if ($goods['TYPE'] == 1 || $goods['TYPE'] == 2) {
@@ -442,7 +442,7 @@ class BaApproachOrderForm extends Model
         if ($this->_address['PROVINCE'] != 1) {
             $warehouse = Region::getWarehouseByCode($this->_address['PROVINCE']);//仓库
             if (!$warehouse) {
-//                throw new Exception('地区2暂时不支持配送,具体联系客服');
+//                throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'));
             }
         }else{
             $warehouse = '01';

+ 8 - 7
common/models/forms/BaDeclarationLoopForm.php

@@ -4,6 +4,7 @@ namespace common\models\forms;
 use common\components\Model;
 use common\helpers\Form;
 use common\models\UserBind;
+use Yii;
 use yii\base\Exception;
 use yii\helpers\Json;
 use common\models\DeclarationPackage;
@@ -58,7 +59,7 @@ class BaDeclarationLoopForm extends Model
     public function formatData($attribute){
         //$this->data = Json::decode($this->data);
         if(!is_array($this->data)){
-            $this->addError($attribute, 'Data format error');// 数据格式错误
+            $this->addError($attribute,  Yii::t('app', 'dataFormatError'));
         }
     }
 
@@ -89,7 +90,7 @@ class BaDeclarationLoopForm extends Model
                 $model->recUserName = null;
                 $model->location = null;
             } else {
-                $this->addError($attribute, 'The format of the report data is incorrect');// 报单数据格式错误
+                $this->addError($attribute, Yii::t('app', 'reportFormatIncorrect'));
             }
 
         }
@@ -119,7 +120,7 @@ class BaDeclarationLoopForm extends Model
                     for ($i=0;$i<count($value['goodsId']);$i++){
                         $goods = ShopGoods::findOneAsArray('ID=:ID',[':ID'=> $value['goodsId'][$i]]);
                         if (!$goods) {
-                            throw new Exception('Products does not exists!');
+                            throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                         }
                         if ($goods['STATUS'] == 1 ){
                             if($goods['STORE_NUMS'] >= $value['goodsNum'][$i]){
@@ -133,10 +134,10 @@ class BaDeclarationLoopForm extends Model
                                     $data->update();
                                 }
                             }else{
-                                throw new Exception($goods['GOODS_NAME'].'Insufficient inventory');// 商品库存不足
+                                throw new Exception($goods['GOODS_NAME']. Yii::t('app', 'insufficientInventory'));
                             }
                         }else{
-                            throw new Exception($goods['GOODS_NAME'].'Sold out');// 商品已下架
+                            throw new Exception($goods['GOODS_NAME']. Yii::t('app', 'soldOut'));
                         }
                     }
                 }
@@ -150,7 +151,7 @@ class BaDeclarationLoopForm extends Model
                         $allZcUserIds[] = null;
                         if($zcUserIdCard != null){
                             if($model->insertUserIdCard != $zcUserIdCard){
-                                throw new Exception('Bulk declaration member must be the same member'); // 批量报单会员必须是同一身份证
+                                throw new Exception(Yii::t('app', 'bulkDeclarationNotSames'));
                             }
                         } else {
                             $zcUserIdCard = $model->insertUserIdCard;
@@ -160,7 +161,7 @@ class BaDeclarationLoopForm extends Model
                         throw new Exception(Form::formatErrorsForApi($model->getErrors()));
                     }
                 } else {
-                    throw new Exception('The format of the report data is incorrect');// 报单数据格式错误
+                    throw new Exception(Yii::t('app', 'reportFormatIncorrect'));
                 }
             }
             $transaction->commit();

+ 3 - 2
common/models/forms/BaUserForm.php

@@ -9,6 +9,7 @@ use common\models\BaUser;
 use common\models\BaUserInfo;
 use common\models\User;
 use common\models\UserInfo;
+use Yii;
 use yii\db\Exception;
 
 /**
@@ -200,7 +201,7 @@ class BaUserForm extends Model
         $uid = \Yii::$app->user->id;
         $model = BaUser::findOne(['ID'=>$uid]);
         if ( !$model->validatePassword($this->oldPassword) ) {
-            $this->addError('modifyPassword', 'Original login password error');//原登录密码错误
+            $this->addError('modifyPassword', Yii::t('app', 'originalLoginPasswordError'));
             return false;
         }
         $model->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($this->password);
@@ -221,7 +222,7 @@ class BaUserForm extends Model
         $uid = \Yii::$app->user->id;
         $model = BaUser::findOne(['ID'=>$uid]);
         if ( !$model->validatePasswordPay($this->oldPassword) ) {
-            $this->addError('modifyPasswordPay', 'Original payment password error');//原支付密码错误
+            $this->addError('modifyPasswordPay', Yii::t('app', 'originalPaymentPasswordError'));
             return false;
         }
         $model->PAY_PASSWORD = \Yii::$app->security->generatePasswordHash($this->payPassword);

+ 16 - 15
common/models/forms/DeclarationForm.php

@@ -25,6 +25,7 @@ use common\models\User;
 use common\models\UserInfo;
 use common\models\UserNetwork;
 use common\models\UserRelation;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -191,7 +192,7 @@ class DeclarationForm extends Model
      */
     public function issetDec($attribute){
         if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
-            $this->addError($attribute, 'Stockist does not exist'); // 报单中心不存在
+            $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
             return false;
         } else {
             if ($this->decType !== 'ba') {
@@ -376,7 +377,7 @@ class DeclarationForm extends Model
         else {
             if($this->insertUserName == $conUserName){
                // $this->addError('recUserName', '新加入的会员不存在');
-                $this->addError('recUserName', 'New member does not exist');
+                $this->addError('recUserName', Yii::t('app', 'newMemberDoesNotExist'));
                 return false;
             }
             // 去数据库里查找这个会员的所有上级
@@ -417,7 +418,7 @@ class DeclarationForm extends Model
         if($this->type == self::TYPE_ZC){
             if(!in_array($this->location, [1, 2, 3])){
                 //$this->addError($attribute, '市场必须在第1市场、第2市场或第三3市场');
-                $this->addError($attribute, 'Please select a market');
+                $this->addError($attribute, Yii::t('app', 'pleaseSelectMarket'));
             }
             $conUser = $recUser = null;
             if(isset($this->_tempParentUser[$this->conUserName])){
@@ -571,16 +572,16 @@ class DeclarationForm extends Model
         if(array_key_exists($this->type, $this->_types)){
             if($this->type == self::TYPE_ZC){
                 if($this->scenario == 'userDec'){
-                    if(!$this->insertUserName) $this->addError($attribute, 'Membership number must be filled in for initial purchase');//首购必须填写加入会员编号
+                    if(!$this->insertUserName) $this->addError($attribute, Yii::t('app', 'MembershipNumberFilledInitialPurchase'));
                 }
-                if(!$this->insertUserName) $this->addError($attribute, 'Membership number must be filled in for initial purchase');//首购必须填写加入会员编号
+                if(!$this->insertUserName) $this->addError($attribute, Yii::t('app', 'MembershipNumberFilledInitialPurchase'));
 //                if(!$this->insertUserIdCard) $this->addError($attribute, 'For the first purchase, the ID number of the member must be filled in');//首购必须填写加入会员的身份证号
-                if(!$this->conUserName) $this->addError($attribute, 'For the first purchase, you must fill in the instructor number of the member');//首购必须填写加入会员的指导老师编号
-                if(!$this->recUserName) $this->addError($attribute, 'For the first purchase, the Sponsor number of the member must be filled in');//首购必须填写加入会员的开拓人编号
-                if(!$this->location) $this->addError($attribute, 'The first purchase must be filled in the market of the member');//首购必须填写加入会员的市场
+                if(!$this->conUserName) $this->addError($attribute, Yii::t('app', 'fillTheInstructorNumberTheMember'));
+                if(!$this->recUserName) $this->addError($attribute, Yii::t('app', 'sponsorNumberMustBeFilled'));
+                if(!$this->location) $this->addError($attribute, Yii::t('app', 'beFilledTheMarketMember'));
             }
         } else {
-            $this->addError($attribute, 'Incorrect entry type');//报单类型不正确
+            $this->addError($attribute, Yii::t('app', 'incorrectEntryType'));
         }
     }
 
@@ -631,14 +632,14 @@ class DeclarationForm extends Model
         // 首购单,需要添加会员操作
         if($this->type == self::TYPE_ZC){
             if (preg_match("/[\x7f-\xff]/", $this->insertUserName)) {  //判断字符串中是否有中文
-                throw new Exception('Member number cannot contain Chinese characters');//会员编号中不能含有汉字
+                throw new Exception(Yii::t('app', 'memberNumberCanNotContainChineseCharacters'));
             }
             //报单商品及PV判断
             $decLevelConfig = Cache::getDecLevelConfig();
             $decLevel = $decLevelConfig[$this->decLv];
             $toDecLevel = $this->decLv;
             if(!$this->decLv){
-                throw new Exception('Please select the entry level');//请选择报单级别
+                throw new Exception(Yii::t('app', 'pleaseSelectTheEntryLevel'));
             }
             if($this->decWay==1) {
                 $decPackage = DeclarationPackage::findOneAsArray('ID=:ID', [':ID'=>$this->packageId]);
@@ -705,7 +706,7 @@ class DeclarationForm extends Model
                     }
                 }
                 if($totalPv<$decLevel['PERF']){
-                    throw new Exception('The total BV of self selected goods cannot be less than the BV of the selected entry level');//自选商品总BV不能小于所选报单级别BV
+                    throw new Exception(Yii::t('app', 'totalBVCanNotLessThanSelectedBV'));
                 }
                 foreach ($decLevelConfig as $key=>$val){
                     if($totalPv>=$val['PERF']){
@@ -713,7 +714,7 @@ class DeclarationForm extends Model
                     }
                 }
                 if($this->decLv!=$toDecLevel){
-                    throw new Exception('The total BV of self selected goods cannot exceed the BV value of the next level under the selected level');//自选商品总BV不能超过已选级别下一个级别的BV值
+                    throw new Exception(Yii::t('app', 'totalBVCanNotLessThanNextSelectedLevelBV'));
                 }
                 $this->_decAmount = $totalAmount;
                 $this->_decPv = $totalPv;
@@ -723,7 +724,7 @@ class DeclarationForm extends Model
             //看现金余额是否充足
             $loginUserId = \Yii::$app->user->id;
             if (Cash::getAvailableBalance($loginUserId) < $this->_decAmount){
-                throw new Exception('The applicant is short of cash and cannot complete the declaration');//报单人现金不足,无法完成报单
+                throw new Exception(Yii::t('app', 'applicantCashShort'));
             }
 
             if(!($zcResult = $this->addUser($allData))) {
@@ -845,7 +846,7 @@ class DeclarationForm extends Model
         if($this->province!=1){
             $warehouse = Region::getWarehouseByCode($this->province);//仓库
             if(!$warehouse){
-                throw new Exception('Delivery is temporarily not supported in the region. Contact customer service for details');//地区暂时不支持配送,具体联系客服
+                throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'));
             }
         }else{
             $warehouse = '01';

+ 9 - 8
common/models/forms/DeclarationLoopForm.php

@@ -4,6 +4,7 @@ namespace common\models\forms;
 use common\components\Model;
 use common\helpers\Form;
 use common\models\UserBind;
+use Yii;
 use yii\base\Exception;
 use yii\helpers\Json;
 use common\models\DeclarationPackage;
@@ -90,7 +91,7 @@ class DeclarationLoopForm extends Model
                 $model->location = null;
                 $model->decType = null;
             } else {
-                $this->addError($attribute, 'The format of the report data is incorrect');// 报单数据格式错误
+                $this->addError($attribute, Yii::t('app', 'reportFormatIncorrect'));
             }
 
         }
@@ -126,11 +127,11 @@ class DeclarationLoopForm extends Model
 
                     $packagedata = DeclarationPackage::findOneAsArray('ID=:ID', [':ID' => $value['packageId']]);
                     if (!$packagedata) {
-                        throw new Exception('Products does not exists!');
+                        throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                     }
                     //var_dump($packagedata['ID']);
                     if($packagedata['STORE_NUMS']<=0){
-                        throw new Exception($packagedata['PACKAGE_NAME'].'Insufficient inventory');// 库存不足
+                        throw new Exception($packagedata['PACKAGE_NAME'] . Yii::t('app', 'insufficientInventory'));
                     }
                 }
 
@@ -138,14 +139,14 @@ class DeclarationLoopForm extends Model
                     for ($i=0;$i<count($value['goodsId']);$i++){
                         $goods = ShopGoods::findOneAsArray('ID=:ID',[':ID'=> $value['goodsId'][$i]]);
                         if (!$goods) {
-                            throw new Exception('Products does not exists!');
+                            throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                         }
                         if ($goods['STATUS'] == 1 ){
                             if($goods['STORE_NUMS'] < $value['goodsNum'][$i]){
-                                throw new Exception($goods['GOODS_NAME'].'Insufficient inventory');// 商品库存不足
+                                throw new Exception($goods['GOODS_NAME'] . Yii::t('app', 'insufficientInventory'));
                             }
                         }else{
-                            throw new Exception($goods['GOODS_NAME'].'Sold out');// 商品已下架
+                            throw new Exception($goods['GOODS_NAME'] . Yii::t('app', 'soldOut'));
                         }
                     }
                 }
@@ -159,7 +160,7 @@ class DeclarationLoopForm extends Model
                         $allZcUserIds[] = null;
                         if($zcUserIdCard != null){
                             if($model->insertUserIdCard != $zcUserIdCard){
-                                throw new Exception('Bulk declaration member must be the same member');//批量报单会员必须是同一身份证
+                                throw new Exception(Yii::t('app', 'bulkDeclarationNotSames'));
                             }
                         } else {
                             $zcUserIdCard = $model->insertUserIdCard;
@@ -169,7 +170,7 @@ class DeclarationLoopForm extends Model
                         throw new Exception(Form::formatErrorsForApi($model->getErrors()));
                     }
                 } else {
-                    throw new Exception('The format of the report data is incorrect');// 报单数据格式错误
+                    throw new Exception(Yii::t('app', 'reportFormatIncorrect'));
                 }
             }
 

+ 10 - 9
common/models/forms/DeclarationUpgradeForm.php

@@ -22,6 +22,7 @@ use common\models\ShopGoods;
 use common\models\User;
 use common\models\UserInfo;
 use common\models\UserNetwork;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -117,13 +118,13 @@ class DeclarationUpgradeForm extends Model
             $decLevel = $decLevelConfig[$this->decLv];
             $toDecLevel = $this->decLv;
             if(!$this->decLv){
-                throw new Exception('Please select upgrade level');//请选择升级级别
+                throw new Exception(Yii::t('app', 'pleaseSelectUpgradeLevel'));
             }
             $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
             $userId = $baseInfo['ID'];
             $userDecPvSum = User::sumDevPvByUserId($userId); // 用户所有报单PV总和
             if ($userDecPvSum != $this->nowPerf) {
-                throw new Exception('Please contact the customer service personnel to check the performance of upgraded members');//请联系客服人员核对升级会员业绩
+                throw new Exception(Yii::t('app', 'checkPerformanceOfUpgradedMember'));
             }
             // 获取用户是否是观察期
             $observe = Config::getConfigByType('observe'); // 获取观察期配置信息
@@ -131,7 +132,7 @@ class DeclarationUpgradeForm extends Model
             $isObserve = User::checkIsObserve($baseInfo['CREATED_AT'], $observeLimit); // 判断用户是否再观察期中
             $diffPerf = $isObserve ? $this->nowPerf : 0; // 观察期内升级要加上用户累计的PV,全额则基础PV为0,全额购买
             if ($this->decWay != 2) {
-                throw new Exception('The upgrade method is incorrect. Please contact the customer service personnel');//升级方式不正确,请联系客服人员
+                throw new Exception(Yii::t('app', 'upgradeMethodIncorrect'));
             }
             if($this->decWay==1) {
                 // 先不加套餐升级方式
@@ -187,7 +188,7 @@ class DeclarationUpgradeForm extends Model
                 // 这里特殊是用户原报单PV之和+用户购买的商品总PV
                 $checkPv = $totalPv + $diffPerf;
                 if($checkPv < $decLevel['PERF']) {
-                    throw new Exception('Total PV cannot be less than the selected level PV');//总PV不能小于所选级别PV
+                    throw new Exception(Yii::t('app', 'totalPVLessThan'), 400);
                 }
                 foreach ($decLevelConfig as $key=>$val){
                     if($checkPv>=$val['PERF']){
@@ -195,7 +196,7 @@ class DeclarationUpgradeForm extends Model
                     }
                 }
                 if($this->decLv!=$toDecLevel){
-                    throw new Exception('The total PV cannot exceed the PV value of the next level under the selected level');//总PV不能超过已选级别下一个级别的PV值
+                    throw new Exception(Yii::t('app', 'totalPvExceedPv'), 400);
                 }
                 $this->_decAmount = $totalAmount;
                 $this->_decPv = $totalPv;
@@ -204,14 +205,14 @@ class DeclarationUpgradeForm extends Model
             }
             //看现金余额是否充足
             if (Cash::getAvailableBalance($loginUserId) < $this->_decAmount){
-                throw new Exception('The applicant is short of cash and cannot complete the declaration');//报单人现金不足,无法完成报单
+                throw new Exception(Yii::t('app', 'applicantCashShort'), 400);
             }
             $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
             $this->_insertUserId = $baseInfo['ID']; // 被报单人,通过insername 查找用户id
             $insertConId = $baseInfo['CON_UID'];
             $insertRecId = $baseInfo['REC_UID'];
             if(!($decResult = $this->addDecOrder($insertConId,$insertRecId, $baseInfo['DEC_LV'],$isObserve,$this->remark))) {
-                throw new Exception("operation failed");//操作失败
+                throw new Exception(Yii::t('app', 'failed'), 400);
             }
         }
         return true;
@@ -225,7 +226,7 @@ class DeclarationUpgradeForm extends Model
     public function addDecOrder($insertConId,$insertRecId,$oriDecLv,$isObserve,$remark=''){
         $warehouse = Region::getWarehouseByCode($this->province);//仓库
         if(!$warehouse){
-            throw new Exception('Delivery is temporarily not supported in the region. Contact customer service for details');//地区暂时不支持配送,具体联系客服
+            throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'), 400);
         }
         $upgradeType = $isObserve ? 1 : 2; // 1补差  2全额
         $periodObj = Period::instance();
@@ -370,7 +371,7 @@ class DeclarationUpgradeForm extends Model
             $modifyDecLv = $decLevelLog->frontendChange($decLog);
             if (empty($modifyDecLv)) {
                 $transaction->rollBack();
-                throw new Exception("Failed to upgrade for member");//为会员升级失败
+                throw new Exception(Yii::t('app', 'failedToUpgrade'), 400);
             }
             $transaction->commit();
         } catch(Exception $e) {

+ 88 - 93
common/models/forms/OrderForm.php

@@ -21,6 +21,7 @@ use common\models\User;
 use common\models\UserNetwork;
 use common\models\RemainPv;
 use common\models\FlowRemainPv;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -92,26 +93,26 @@ class OrderForm extends Model
     public function attributeLabels()
     {
         return [
-            'sn' => 'Order Code', // 订单号
-            'expressCompany' => '快递公司',
-            'orderTrackNo' => '快递单号',
-            'status' => 'State', // 状态
-            'remark' => 'Remark', // 备注
-            'type' => 'Order Type',// 订单类型
-            'addressId' => 'Shipping address',// 收货地址
-            'payType' => 'Pay Type',// 支付方式
-            'goodsId' => 'Product ID',//商品ID
-            'goodsNum' => 'Product quantity',//商品数量
-            'userName' => 'Repeat sales Member No. does not exist',//复消会员编号
-            'consignee' => 'Consignee',// 收货人
-            'acceptMobile' => 'Accept Mobile',// 收货电话
-            'province' => 'Province',// 省
-            'city' => 'City',// 市
-            'county' => 'County',// 区
-            'lgaName' => 'Lga Name',
-            'cityName' => 'City Name',
-            'detailaddress' => 'Address',// 收货详细地址
-            'email' => 'Email',
+            'sn' => Yii::t('app', 'orderSn'),
+            'expressCompany' => Yii::t('app', 'expressCompany'),
+            'orderTrackNo' => Yii::t('app', 'orderTrackNo'),
+            'status' => Yii::t('app', 'state'),
+            'remark' => Yii::t('app', 'remark'),
+            'type' => Yii::t('app', 'orderType'),
+            'addressId' => Yii::t('app', 'shippingAddress'),
+            'payType' => Yii::t('app', 'payType'),
+            'goodsId' => Yii::t('app', 'productID'),
+            'goodsNum' => Yii::t('app', 'quantity'),
+            'userName' => Yii::t('app', 'repeatSalesMemberNo'),
+            'consignee' => Yii::t('app', 'consignee'),
+            'acceptMobile' => Yii::t('app', 'acceptMobile'),
+            'province' => Yii::t('app', 'province'),
+            'city' => Yii::t('app', 'city'),
+            'county' => Yii::t('app', 'county'),
+            'lgaName' =>Yii::t('app', 'lgaName'),
+            'cityName' => Yii::t('app', 'cityName'),
+            'detailaddress' => Yii::t('app', 'detailAddress'),
+            'email' => Yii::t('app', 'email'),
         ];
     }
 
@@ -152,36 +153,36 @@ class OrderForm extends Model
         if ($this->sn) {
             $this->_model = Order::findOne(['SN'=>$this->sn]);
             if (!$this->_model){
-                $this->addError('sn', '订单不存在');
+                $this->addError('sn', Yii::t('app', 'orderDoesNotExist'));
                 return false;
             }
         }
         if ($this->scenario == 'adminDelivery'){
             if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['cancel']) {
-                $this->addError('sn', '订单已取消不能发货');
+                $this->addError('sn', Yii::t('app', 'orderHasBeenCancelCanNotDeliver'));
                 return false;
             }
             if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['del']) {
-                $this->addError('sn', '订单已删除不能发货');
+                $this->addError('sn', Yii::t('app', 'orderHasBeenDeleteCanNotDeliver'));
                 return false;
             }
         }
 
         if ($this->scenario == 'adminRefund'){
             if ($this->_model['STATUS'] != \Yii::$app->params['orderStatus']['paid']['value']) {
-                $this->addError('sn', '订单状态支付状态不支持退款');
+                $this->addError('sn', Yii::t('app', 'orderPayStatusDoesNotSupportRefund'));
                 return false;
             }
             if ($this->_model['DELIVERY_STATUS'] != \Yii::$app->params['deliveryStatus']['notDelivery']['value']) {
-                $this->addError('sn', '订单物流状态不支持退款');
+                $this->addError('sn', Yii::t('app', 'orderLogisticsStatusDoesNotSupportRefund'));
                 return false;
             }
             if ($this->_model['PAY_TYPE'] != 'pay_stack') {
-                $this->addError('sn', '订单支付方式不支持退款');
+                $this->addError('sn', Yii::t('app', 'orderPayTypeDoesNotSupportRefund'));
                 return false;
             }
             if (!$this->_model['REMARK']) {
-                $this->addError('sn', '订单支付信息不存在');
+                $this->addError('sn', Yii::t('app', 'paymentInfoDoesNotExists'));
                 return false;
             }
         }
@@ -196,7 +197,7 @@ class OrderForm extends Model
      */
     public function validatePassword($attribute, $params) {
         if (!User::validatePayPassword(\Yii::$app->user->id, $this->payPassword)) {
-            $this->addError($attribute, 'The payment password is incorrect');//支付密码不正确
+            $this->addError($attribute, Yii::t('app', 'paymentPasswordError'));
         }
     }
 
@@ -206,7 +207,7 @@ class OrderForm extends Model
      */
     public function isAddress($attribute){
         if (!$receiveAddress = ReceiveAddress::find()->where(' ID=:ID', [':ID' => $this->addressId])->asArray()->one()) {
-            $this->addError($attribute, '收货地址不存在');
+            $this->addError($attribute, Yii::t('app', 'shippingDoesNotExist'));
         } else {
             $this->_address = $receiveAddress;
         }
@@ -219,26 +220,26 @@ class OrderForm extends Model
      */
     public function isPayType($attribute){
         if(!array_key_exists($this->payType, ShopGoods::payTypes())){
-            $this->addError($attribute, '支付方式错误1');
+            $this->addError($attribute, Yii::t('app', 'payTypeError'));
             return;
         }
 
         // 一个订单只能包含一类商品
         $goods = ShopGoods::find()->select('ID,CATEGORY_TYPE')->where(['in', 'ID', $this->goodsId])->andWhere(['STATUS' => 1])->asArray()->all();
         if (!$goods) {
-            throw new Exception('Products does not exists!');
+            throw new Exception(Yii::t('app', 'productsDoesNotExists'));
             return;
         }
         $goodsCategoryType = array_unique(array_column($goods, 'CATEGORY_TYPE'));
         if (count($goodsCategoryType) > 1) {
-            $this->addError($attribute, 'Order cannot contain multiple product categories'); // 订单不能包含多种商品分类
+            $this->addError($attribute, Yii::t('app', 'orderCanNotHasMoreClassification'));
             return;
         }
 
         // 购买方式
         $sellTypeLabelMap = array_column(ShopGoods::SALE_TYPE, NULL, 'label');
         if (!array_key_exists($this->payType, $sellTypeLabelMap)) {
-            $this->addError($attribute, '支付方式错误2');
+            $this->addError($attribute, Yii::t('app', 'payTypeError'));
             return;
         }
 
@@ -247,13 +248,13 @@ class OrderForm extends Model
         // 商品类型
         $currCategoryType = $goodsCategoryType[0];
         if (!array_key_exists($currCategoryType, $categoryType)) {
-            $this->addError($attribute, '商品分类错误');
+            $this->addError($attribute, Yii::t('app', 'shopGoodClassificationError'));
             return;
         }
 
         $sellType = $categoryType[$currCategoryType]['sell_type'] ?? [];
         if (!$sellType || !in_array($this->payType, array_column($sellType, 'label'))) {
-            $this->addError($attribute, '支付方式错误3');
+            $this->addError($attribute, Yii::t('app', 'payTypeError'));
             return;
         }
     }
@@ -264,43 +265,43 @@ class OrderForm extends Model
      */
     public function isStatus($attribute){
         if(!in_array($this->type, \Yii::$app->params['orderStatus'])){
-            $this->addError($attribute, '类型错误');
+            $this->addError($attribute, Yii::t('app', 'orderStatusTypeError'));
             return ;
         }
         if ($this->scenario == 'adminStatus'){
             if ($this->status == $this->_model['STATUS']) {
-                $this->addError($attribute, '订单状态没有改变');
+                $this->addError($attribute, Yii::t('app', 'orderStatusDoesNotChange'));
                 return ;
             }
             if($this->status == \Yii::$app->params['orderStatus']['notPaid'] && $this->_model['STATUS'] >= \Yii::$app->params['orderStatus']['delivery']) {
-                $this->addError($attribute, '订单已经进入物流状态不能改为未支付');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenLogisticsStatusDoesNotChangedUnpaid'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['paid'] && $this->_model['STATUS'] >= \Yii::$app->params['orderStatus']['cancel']) {
-                $this->addError($attribute, '订单已失效不能处理');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenInvalidCanNotProcess'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['delivery']) {
-                $this->addError($attribute, '订单不能单独处理为物流状态');
+                $this->addError($attribute, Yii::t('app', 'orderCanNotBeenChangedLogistics'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['complete'] && $this->_model['STATUS'] > \Yii::$app->params['orderStatus']['cancel']) {
-                $this->addError($attribute, '订单已失效不能处理');
+                $this->addError($attribute, Yii::t('app', 'orderHasBeenInvalidCanNotProcess'));
                 return ;
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['cancel']) {
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['complete']) {
-                    $this->addError($attribute, '订单已完成不能取消');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenFinishedCanNotCancel'));
                     return ;
                 }
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['del']) {
-                    $this->addError($attribute, '订单已删除不能取消');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenDeletedCanNotCancel'));
                     return ;
                 }
             }
             elseif($this->status == \Yii::$app->params['orderStatus']['del']) {
                 if($this->_model['STATUS'] == \Yii::$app->params['orderStatus']['complete']) {
-                    $this->addError($attribute, '订单已完成不能删除');
+                    $this->addError($attribute, Yii::t('app', 'orderHasBeenFinishedCanNotDelete'));
                     return ;
                 }
             }
@@ -356,7 +357,7 @@ class OrderForm extends Model
             throw new Exception(Form::formatErrorsForApi($payload['message']));
         }
         if ($payload['data']['amount'] != $this->_model->PAY_AMOUNT * 100) {
-            throw new Exception(Form::formatErrorsForApi('支付金额与订单金额不符'));
+            throw new Exception(Form::formatErrorsForApi(Yii::t('app', 'payAmountNotEqualOrderAmount')));
         }
 
         $db = \Yii::$app->db;
@@ -393,7 +394,7 @@ class OrderForm extends Model
         $remark = $this->_model->REMARK ? json_decode($this->_model->REMARK, true) : [];
         $reference = $remark['reference'] ?? '';
         if (!$reference) {
-            throw new Exception(Form::formatErrorsForApi('支付信息不存在'));
+            throw new Exception(Form::formatErrorsForApi(Yii::t('app', 'paymentInfoDoesNotExists')));
         }
         // 退款金额. 订单支付金额 * 100
         $amount = $this->_model->PAY_AMOUNT * 100;
@@ -467,7 +468,7 @@ class OrderForm extends Model
             if ($v) {
                 $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
                 if (!$goods) {
-                    throw new Exception('Products does not exists!');
+                    throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                 }
                 if($goods['STORE_NUMS']>0){
                     if ($goods['TYPE'] == 1 || $goods['TYPE'] == 2) {
@@ -569,7 +570,7 @@ class OrderForm extends Model
                 if ($v){
                     $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
                     if (!$goods) {
-                        throw new Exception('Products does not exists!');
+                        throw new Exception(Yii::t('app', 'productsDoesNotExists'));
                     }
                     if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
                         $data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
@@ -584,7 +585,7 @@ class OrderForm extends Model
 
                         }
                     }else{
-                        throw new Exception($goods['GOODS_NAME'].'库存不足,无法购买商品');
+                        throw new Exception($goods['GOODS_NAME'] . Yii::t('app', 'insufficientInventory'));
 
                     }
                 }
@@ -617,19 +618,19 @@ class OrderForm extends Model
 
         if ($payType == 'cash') {
             if (Cash::getAvailableBalance($loginUserId) < $payAmount) {
-                return ['code' => 500, 'message' => '余额不足,无法购买商品'];
+                return ['code' => 500, 'message' => Yii::t('app', 'cashDoesNotAdequate')];
             }
         } else if ($payType =='exchange') {
             if ($payAmount > Balance::getBalanceExchangePoints($loginUserId)) {
-                return ['code' => 500, 'message' => '兑换积分不足,无法购买商品'];
+                return ['code' => 500, 'message' => Yii::t('app', 'exchangePointDoesNotAdequate')];
             }
         } else if ($payType == 'tourism_points') {
             if ($payAmount > Balance::getBalanceTourism($loginUserId)) {
-                return ['code' => 500, 'message' => '旅游积分不足,无法购买商品'];
+                return ['code' => 500, 'message' => Yii::t('app', 'travelPointDoesNotAdequate')];
             }
         } else if ($payType == 'garage_points') {
             if ($payAmount > Balance::getBalanceGarage($loginUserId)) {
-                return ['code' => 500, 'message' => '车房积分不足,无法购买商品'];
+                return ['code' => 500, 'message' => Yii::t('app', 'carFundPointDoesNotAdequate')];
             }
 //        } else{
 //            if ($payAmount > Balance::getBalanceReconsumePoints($loginUserId)) {
@@ -660,7 +661,7 @@ class OrderForm extends Model
         if ($this->_address['PROVINCE'] != 1) {
             $warehouse = Region::getWarehouseByCode($this->_address['PROVINCE']);//仓库
             if (!$warehouse) {
-                throw new Exception('地区2暂时不支持配送,具体联系客服');
+                throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'));
             }
         }else{
             $warehouse = '01';
@@ -852,55 +853,49 @@ class OrderForm extends Model
                 $userId = Info::getUserIdByUserName($this->userName);
                 $userNetwork = UserNetwork::find()->where("USER_ID=:USER_ID AND INSTR(PARENT_UIDS,'{$loginUserId}')>0", ['USER_ID'=>$userId])->count();
                 if(!$userNetwork){
-                    throw new Exception($this->userName.'不是您的伞下会员,不能为其复消!');
+                    throw new Exception($this->userName . Yii::t('app', 'doesNotYourSubMemberCanNotReconsume'));
                 }
             }
             //判断用户余额是否充足
             if($this->payType=='cash') {
                 if (Cash::getAvailableBalance($loginUserId) < $this->_payAmount) {
-                    throw new Exception('余额不足,无法购买商品');
+                    throw new Exception(Yii::t('app', 'cashDoesNotAdequate'));
                 }
             }else{
                 if ($this->_payAmount > Balance::getBalanceReconsumePoints($loginUserId)) {
-                    throw new Exception('复消积分不足,无法购买商品');
+                    throw new Exception(Yii::t('app', 'exchangePointDoesNotAdequate'));
                 }
             }
 
-
-
 			/**
-			             * 2022-04-28
-			             * York
-			             * 支付后减少库存
-			             */
-			            foreach ($this->goodsNum as $k => $v){
-			                if ($v){
-			                    $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
-                                if (!$goods) {
-                                    throw new Exception('Products does not exists!');
-                                }
-			                    if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
-			                        $data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
-			                        $goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
-			                        $data->STORE_NUMS = $goods_store_nums;
-			                        $data->update();
-			                        //下单后库存小于等于0 商品下架
-			                        if($goods_store_nums <= 0){
-			                            $data->STATUS = 0;
-			                            $data->UPDATED_AT = Date::nowTime();
-			                            $data->update();
-
-			                        }
-			                    }else{
-			                        throw new Exception($goods['GOODS_NAME'].'库存不足,无法购买商品');
-
-			                    }
-
-
-			                }
-			            }
-			//                exit();
+             * 2022-04-28
+             * York
+             * 支付后减少库存
+             */
+            foreach ($this->goodsNum as $k => $v){
+                if ($v){
+                    $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
+                    if (!$goods) {
+                        throw new Exception(Yii::t('app', 'productsDoesNotExists'));
+                    }
+                    if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
+                        $data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
+                        $goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
+                        $data->STORE_NUMS = $goods_store_nums;
+                        $data->update();
+                        //下单后库存小于等于0 商品下架
+                        if($goods_store_nums <= 0){
+                            $data->STATUS = 0;
+                            $data->UPDATED_AT = Date::nowTime();
+                            $data->update();
+
+                        }
+                    }else{
+                        throw new Exception($goods['GOODS_NAME'] . Yii::t('app', 'insufficientInventory'));
 
+                    }
+                }
+            }
 
             //写入订单
             if (!$orderResult = $this->addUserOrder()) {
@@ -933,7 +928,7 @@ class OrderForm extends Model
         if($this->province!=1){
             $warehouse = Region::getWarehouseByCode($this->province);//仓库
             if(!$warehouse){
-                throw new Exception('地区1暂时不支持配送,具体联系客服');
+                throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'));
             }
         }else{
             $warehouse = '01';
@@ -980,9 +975,9 @@ class OrderForm extends Model
 
         //扣除会员余额/积分
         if($this->payType=='cash') {
-            Cash::changeUserCash($loginUserId, 'CASH', -abs($this->_payAmount), ['REMARK' => 'Members reselling balance payment']); // 会员复销余额支付
+            Cash::changeUserCash($loginUserId, 'CASH', -abs($this->_payAmount), ['REMARK' => Yii::t('app', 'membersResellingBalancePayment')]);
         }else{
-            Balance::changeUserBonus($loginUserId,'reconsume_points', -abs($this->_payAmount),['DEAL_TYPE_ID' => DealType::RECONSUME_POINTS_EXCHANGE, 'REMARK' => '会员复销积分兑换']);
+            Balance::changeUserBonus($loginUserId,'reconsume_points', -abs($this->_payAmount),['DEAL_TYPE_ID' => DealType::RECONSUME_POINTS_EXCHANGE, 'REMARK' => Yii::t('app', 'membersExchangePointPayment')]);
         }
         return $orderModel;
     }

+ 3 - 2
common/models/forms/TransferForm.php

@@ -26,6 +26,7 @@ use common\models\UserBonus;
 use common\models\UserInfo;
 use common\models\UserRelation;
 use common\models\UserSystem;
+use Yii;
 use yii\base\Exception;
 use yii\helpers\Json;
 
@@ -299,7 +300,7 @@ class TransferForm extends Model {
             return null;
         }
         if ($this->_fromUserInfo['ID']==$this->_toUserInfo['ID']){
-            throw new \Exception('Not allowed to transfer to yourself');
+            throw new \Exception(Yii::t('app', 'notAllowedToTransferToYourself'));
         }
         $fromData = Balance::getLogData($this->_fromUserInfo['ID']);
         $toData = Balance::getLogData($this->_toUserInfo['ID']);
@@ -350,7 +351,7 @@ class TransferForm extends Model {
                 Cash::changeUserCash($this->_fromUserInfo['ID'], 'CASH', -abs($this->amount), ['TRANSFER_SN' => $model->TRANSFER_SN,'DEAL_TYPE_ID' => DealType::TRANSFER_OUT, 'REMARK' => 'To:' . $this->_toUserInfo['USER_NAME'] . ',' . $this->remark]);
                 Cash::changeUserCash($this->_toUserInfo['ID'], 'CASH', abs($amount), ['TRANSFER_SN' => $model->TRANSFER_SN,'DEAL_TYPE_ID' => DealType::TRANSFER_IN, 'REMARK' => 'From:' . $this->_fromUserInfo['USER_NAME'] . ',' . $this->remark]);
             }else {
-                throw new \Exception('Wrong transaction type'); // 错误的交易类型
+                throw new \Exception(Yii::t('app', 'wrongTransactionType'));
             }
 
             $transaction->commit();

+ 10 - 9
common/models/forms/UserConfigForm.php

@@ -14,6 +14,7 @@ use common\models\DealType;
 use common\models\Period;
 use common\models\User;
 use common\models\UserInfo;
+use Yii;
 use yii\db\Exception;
 
 /**
@@ -46,8 +47,8 @@ class UserConfigForm extends Model {
 
     public function attributeLabels() {
         return [
-            'isAutoWithdraw' => '是否自动提现',
-            'allowReconsumeSms' => '开启复销短信通知',
+            'isAutoWithdraw' => Yii::t('app', 'isAutoWithdraw'),
+            'allowReconsumeSms' => Yii::t('app', 'allowReconsumeSms'),
         ];
     }
 
@@ -71,11 +72,11 @@ class UserConfigForm extends Model {
      */
     public function isCanAutoWithdraw($attribute) {
         if (!Info::isVerified(\Yii::$app->user->id)) {
-            $this->addError($attribute, '请先实名认证');
+            $this->addError($attribute, Yii::t('app', 'pleaseAuthentication'));
         }
         $this->_config = Cache::getSystemConfig();
         if (!$this->_config['isCanAutoWithdraw']['VALUE'] && $this->isAutoWithdraw) {
-            $this->addError('scenario', '系统关闭了自动提现');
+            $this->addError('scenario', Yii::t('app', 'systemCloseAutoWithdraw'));
         }
     }
 
@@ -86,7 +87,7 @@ class UserConfigForm extends Model {
     public function isAllowReconsumeSms($attribute) {
         $this->_config = Cache::getSystemConfig();
         if (!$this->_config['smsOpen']['VALUE'] && $this->isAutoWithdraw) {
-            $this->addError('scenario', '系统关闭了开启复销短信通知');
+            $this->addError('scenario', Yii::t('app', 'systemCloseReconsumeSMSNotification'));
         }
     }
 
@@ -103,7 +104,7 @@ class UserConfigForm extends Model {
         $transaction = \Yii::$app->db->beginTransaction();
         try {
             if (!UserInfo::updateAll(['IS_AUTO_WITHDRAW' => $this->isAutoWithdraw], 'USER_ID=:USER_ID', [':USER_ID' => \Yii::$app->user->id])) {
-                throw new Exception('更新个人设置失败');
+                throw new Exception(Yii::t('app', 'updateUserConfigFailed'));
             }
             $transaction->commit();
         } catch (Exception $e) {
@@ -139,7 +140,7 @@ class UserConfigForm extends Model {
         try {
             $userId = \Yii::$app->user->id;
             if (!UserInfo::updateAll(['ALLOW_RECONSUME_SMS' => $this->allowReconsumeSms?$this->allowReconsumeSms:0], 'USER_ID=:USER_ID', [':USER_ID' => $userId])) {
-                throw new Exception('更新个人设置失败');
+                throw new Exception(Yii::t('app', 'updateUserConfigFailed'));
             }
             //开启扣费
             $smsTo = UserInfo::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $userId], 'ALLOW_RECONSUME_SMS_TO');
@@ -160,11 +161,11 @@ class UserConfigForm extends Model {
                         if (Balance::getAvailableBalance($userId) < $smsFee) continue;
                         Balance::changeUserBonus($userId, 'bonus', -abs($smsFee), ['DEAL_TYPE_ID' => DealType::SMS, 'REMARK' => $year . '年复销提醒短信服务费']);
                         if (!UserInfo::updateAll(['ALLOW_RECONSUME_SMS_TO' => $to], 'USER_ID=:USER_ID', [':USER_ID' => $userId])) {
-                            throw new Exception('更新个人短信有效期失败');
+                            throw new Exception(Yii::t('app', 'updateUserSMSExpiredFailed'));
                         }
                         break;
                     } elseif ($item == 2) {
-                        throw new Exception('不存在此方式');
+                        throw new Exception(Yii::t('app', 'modeDoesNotExist'));
                         break;
                     }
                 }

+ 5 - 4
common/models/forms/UserForm.php

@@ -15,6 +15,7 @@ use common\models\User;
 use common\models\UserInfo;
 use common\models\UserNetwork;
 use common\models\UserRelation;
+use Yii;
 use yii\db\Exception;
 
 /**
@@ -576,7 +577,7 @@ class UserForm extends Model
         $uid = \Yii::$app->user->id;
         $model = User::findOne(['ID'=>$uid]);
         if ( !$model->validatePassword($this->oldPassword) ) {
-            $this->addError('modifyPassword', 'Original login password error');//原登录密码错误
+            $this->addError('modifyPassword', Yii::t('app', 'originalLoginPasswordError'));
             return false;
         }
         $model->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($this->password);
@@ -596,7 +597,7 @@ class UserForm extends Model
         $uid = \Yii::$app->user->id;
         $model = User::findOne(['ID'=>$uid]);
         if ( !$model->validatePasswordPay($this->oldPassword) ) {
-            $this->addError('modifyPasswordPay', 'Original payment password error');//原支付密码错误
+            $this->addError('modifyPasswordPay', Yii::t('app', 'originalPaymentPasswordError'));
             return false;
         }
         $model->PAY_PASSWORD = \Yii::$app->security->generatePasswordHash($this->payPassword);
@@ -617,11 +618,11 @@ class UserForm extends Model
         }
         $model =  User::findOne(["USER_NAME"=>$this->userName]);
         if( !$model ) {
-            $this->addError('noLoginModifyPassword', 'Nonexistent user name');//不存在的用户名
+            $this->addError('noLoginModifyPassword', Yii::t('app', 'userNameNotExists'));
             return false;
         }
         if ( !$model->validatePassword($this->oldPassword) ) {
-            $this->addError('noLoginModifyPassword', 'Original login password error');//原登录密码错误
+            $this->addError('noLoginModifyPassword', Yii::t('app', 'originalLoginPasswordError'));
             return false;
         }
         $model->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($this->password);

+ 3 - 2
common/models/forms/WithdrawForm.php

@@ -27,6 +27,7 @@ use common\models\UserTeamwork;
 use common\models\Withdraw;
 use common\models\WithdrawLevel;
 use common\helpers\http\LingYunGongApi;
+use Yii;
 use yii\base\Exception;
 
 /**
@@ -492,10 +493,10 @@ class WithdrawForm extends Model {
         $transaction = $db->beginTransaction();
         try {
             if (Cache::getSystemConfig()['isCanWithdrawBack']['VALUE'] != 1) {
-                throw new Exception('提现退回已关闭');
+                throw new Exception(Yii::t('app', 'isCanWithdrawBack'));
             }
             if (!Withdraw::find()->where('USER_ID=:USER_ID AND ID=:ID AND AUDIT_STATUS=:AUDIT_STATUS_1', ['USER_ID' => \Yii::$app->user->id, ':ID' => $this->id, ':AUDIT_STATUS_1' => Withdraw::STATUS_APPLIED])->exists()) {
-                throw new Exception('符合退回的提现记录不存在');
+                throw new Exception(Yii::t('app', 'withdrawRecordDoesNotExist'));
             }
             $oneWithdraw->BACK_REMARK = $this->createRemark;
             $oneWithdraw->BACK_FAIL_AT = Date::nowTime();

+ 2 - 1
frontendApi/modules/v1/controllers/ArticleController.php

@@ -9,6 +9,7 @@ namespace frontendApi\modules\v1\controllers;
 
 use common\models\Article;
 use common\models\ArticleCategory;
+use Yii;
 
 class ArticleController extends BaseController
 {
@@ -95,7 +96,7 @@ class ArticleController extends BaseController
             }
             return static::notice($data);
         } else {
-            return static::notice('The article does not exist', 400);// 文章不存在
+            return static::notice(Yii::t('app', 'articleDoesNotExist'), 400);// 文章不存在
         }
     }
 }

+ 8 - 8
frontendApi/modules/v1/controllers/AtlasController.php

@@ -45,13 +45,13 @@ class AtlasController extends BaseController {
 
         if ($userName !== '') {
             if (!$userId = Info::getUserIdByUserName($userName)) {
-                return static::notice('Member does not exist', 400); // 会员不存在
+                return static::notice(Yii::t('app', 'memberDoesNotExist'), 400);
             }
             $topUid = \Yii::$app->user->id;
             $userNetInfo = UserNetwork::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $userId], 'PARENT_UIDS');
             $parentUidsArr = explode(',', $userNetInfo['PARENT_UIDS']);
             if(!in_array($topUid,$parentUidsArr)){
-                return static::notice('The member is not in the same placement network as the current user', 400); // 会员与当前用户不再同一安置网络内
+                return static::notice(Yii::t('app', 'memberDoesNotInSamePlacementNetwork'), 400);
             }
 
         } else {
@@ -93,7 +93,7 @@ class AtlasController extends BaseController {
         $periodNum = Yii::$app->request->get('periodNum', null);
         $deep = Yii::$app->request->get('deep', 5);
         if ($deep > 20) {
-            return static::notice('View the top 20 sub members of the member at most', 400); // 最多查看会员的前20层子会员
+            return static::notice(Yii::t('app', 'viewSubMembersMost'), 400);
         }
         $allData = UserNetwork::getChildrenWithDeepAndLayer($userId, $deep, 1, $periodNum);
         return static::notice(['allData' => $allData, 'periodNum' => $periodNum]);
@@ -114,13 +114,13 @@ class AtlasController extends BaseController {
             $userId = \Yii::$app->user->id;
         } else {
             if (!$userId = Info::getUserIdByUserName($userName)) {
-                return static::notice('Member does not exist', 400); //  会员不存在
+                return static::notice(Yii::t('app', 'memberDoesNotExist'), 400);
             }
             $topUid = \Yii::$app->user->id;
             $userNetInfo = UserNetwork::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $userId], 'PARENT_UIDS');
             $parentUidsArr = explode(',', $userNetInfo['PARENT_UIDS']);
             if(!in_array($topUid,$parentUidsArr)){
-                return static::notice('The member is not in the same placement network as the current user', 400); // 会员与当前用户不再同一安置网络内
+                return static::notice(Yii::t('app', 'memberDoesNotInSamePlacementNetwork'), 400);
             }
         }
         $period = Period::instance();
@@ -168,7 +168,7 @@ class AtlasController extends BaseController {
         $periodNum = Yii::$app->request->get('periodNum', null);
         $deep = Yii::$app->request->get('deep', 5);
         if ($deep > 20) {
-            return static::notice('View the top 20 sub members of the member at most', 400); // 最多查看会员的前20层子会员
+            return static::notice(Yii::t('app', 'viewSubMembersMost'), 400);
         }
         $allData = UserRelation::getChildrenWithDeepAndLayer($userId, $deep, 1, $periodNum);
         return static::notice(['allData' => $allData, 'periodNum' => $periodNum]);
@@ -189,13 +189,13 @@ class AtlasController extends BaseController {
             $userId = \Yii::$app->user->id;
         } else {
             if (!$userId = Info::getUserIdByUserName($userName)) {
-                return static::notice('Member does not exist', 400); //  会员不存在
+                return static::notice(Yii::t('app', 'memberDoesNotExist'), 400);
             }
             $topUid = \Yii::$app->user->id;
             $userNetInfo = UserRelation::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $userId], 'PARENT_UIDS');
             $parentUidsArr = explode(',', $userNetInfo['PARENT_UIDS']);
             if(!in_array($topUid,$parentUidsArr)){
-                return static::notice('会员与当前用户不再同一安置网络内', 400);
+                return static::notice(Yii::t('app', 'memberDoesNotInSamePlacementNetwork'), 400);
             }
         }
         $period = Period::instance();

+ 22 - 20
frontendApi/modules/v1/controllers/BaController.php

@@ -12,6 +12,7 @@ use common\helpers\Cache;
 use common\helpers\Form;
 use common\helpers\Tool;
 use common\helpers\user\Info;
+use common\models\BaUserInfo;
 use common\models\Config;
 use common\models\DeclarationLevel;
 use common\models\DeclarationPackage;
@@ -33,6 +34,7 @@ use common\models\UserBind;
 use common\models\UserInfo;
 use common\models\UserNetwork;
 use common\models\forms\DeclarationUpgradeForm;
+use Yii;
 use yii\db\Exception;
 use yii\web\UploadedFile;
 
@@ -65,12 +67,12 @@ class BaController extends BaseController {
             $post = \Yii::$app->request->post();
             $form->scenario = 'modifyProfile';
             if($form->load($post, '') && $result = $form->modifyProfile()){
-                return static::notice('Personal data modified successfully');//个人资料修改成功
+                return static::notice(Yii::t('app', 'personalDataModifiedSuccessfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -82,12 +84,12 @@ class BaController extends BaseController {
             $form->scenario = 'modifyPassword';
             $post = \Yii::$app->request->post();
             if($form->load($post, '') && $result = $form->modifyPassword()){
-                return static::notice('Password modified successfully');//密码修改成功
+                return static::notice(Yii::t('app', 'passwordModifiedSuccessfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -100,12 +102,12 @@ class BaController extends BaseController {
             $post = \Yii::$app->request->post();
             $form->userId = \Yii::$app->user->id;
             if($form->load($post, '') && $result = $form->modifyPasswordPay()){
-                return static::notice('支付密码修改成功');
+                return static::notice(Yii::t('app', 'passwordModifiedSuccessfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -137,7 +139,7 @@ class BaController extends BaseController {
             //$formModel->token = \Yii::$app->request->post('uploadToken');
             $formModel->token = \Yii::$app->request->request('uploadToken');
             if ($formModel->file && $formModel->upload()) {
-                return static::notice('Successful');
+                return static::notice(Yii::t('app', 'successfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -188,7 +190,7 @@ class BaController extends BaseController {
     public function actionBindEdit(){
         $id = \Yii::$app->request->get('id');
         if(\Yii::$app->request->isPost) {
-            return parent::edit(UserBindForm::class, '修改主点位成功', 'frontEdit', ['frontEdit'], null, function($form, $result){
+            return parent::edit(UserBindForm::class, Yii::t('app', 'successfully'), 'frontEdit', ['frontEdit'], null, function($form, $result){
                 //log
             });
         }
@@ -216,12 +218,12 @@ class BaController extends BaseController {
         ->one();
         $isOpen = !empty($isSwitchUpgrade) && isset($isSwitchUpgrade['VALUE']) ? $isSwitchUpgrade['VALUE'] : 0;
         if ($isOpen < 1) {
-            return static::notice('The function is not available',400); // 功能暂未开放
+            return static::notice(Yii::t('app', 'theFunctionIsNotAvailable'), 400);
         }
         $userNumber = \Yii::$app->request->request('userName');
         $baseInfo = Info::baseInfoZhByUserName($userNumber);
         if ($baseInfo['STATUS'] != 1) {
-            return static::notice('Inactive user. Please contact customer service.',400);// 非激活用户,请联系客服
+            return static::notice(Yii::t('app', 'inactiveUser'), 400);
         }
         // 1. 如果是最高级别,则只显示用户基本信息
         // 2. 如果不是最高级别,如果用户累计报单数据是0, 或者用户累计报单业绩不符合级别信息,则提示 请联系客服核对业绩
@@ -266,10 +268,10 @@ class BaController extends BaseController {
             $nextLevelPerf = DeclarationLevel::getNextDecPref($levelPerf)['PERF'];
             // 如果总和超过了下一级业绩
             if ($userDecPvSum >= $nextLevelPerf) {
-                return static::notice('Please contact customer service to check performance.',400);// 请联系客服人员核对业绩
+                return static::notice(Yii::t('app', 'checkPerformance'), 400);
             }
             $type = $isObserve ? 1 : 2;
-            $userInfo['UPGRADE_FUNC'] = $isObserve ? 'filling up of a deficit' : 'full payment';// 升级方式
+            $userInfo['UPGRADE_FUNC'] = $isObserve ? Yii::t('app', 'fillingUpOfADeficit') : Yii::t('app', 'fullPayment');// 升级方式
             $upgradeType = UpgradeType::getOneByType($type);
             // 如果用户不是最大级别,则需要获取是否观察期,算出PV是否有问题,应该补多少,
             $userInfo['UPGRADE_TYPE'] = $upgradeType;
@@ -294,7 +296,7 @@ class BaController extends BaseController {
         ->one();
         $isOpen = !empty($isSwitchUpgrade) && isset($isSwitchUpgrade['VALUE']) ? $isSwitchUpgrade['VALUE'] : 0;
         if ($isOpen < 1) {
-            return static::notice('功能暂未开放',400);
+            return static::notice(Yii::t('app', 'theFunctionIsNotAvailable'), 400);
         }
         // 开始升级
         if (\Yii::$app->request->isPost) {
@@ -386,10 +388,10 @@ class BaController extends BaseController {
             $insertUserName = strtoupper($post['insertUserName']);
             $getRedisUserName = $redis->get('key_' . $insertUserName);
             if (!$getRedisUserName){
-                return static::notice('Membership number expired',400);//会员编号过期
+                return static::notice(Yii::t('app', 'memberNumberExpired'), 400);
             }
             if ($insertUserName != $getRedisUserName){
-                return static::notice('Member number does not conform to',400);//会员编号不符合
+                return static::notice(Yii::t('app', 'memberNumberDoesNotConformTo'), 400);
             }
 
             $post['insertUserName'] = $insertUserName;
@@ -428,7 +430,7 @@ class BaController extends BaseController {
         // 所有开户行
         $allOpenBank = OpenBank::find()->where('STATUS=1')->orderBy('LIST_ORDER ASC')->asArray()->all();
         if (!$userName) {
-            return static::notice('Failed to generate member number', 400);//会员编号生成失败
+            return static::notice(Yii::t('app', 'failedToGenerateMemberNumber'), 400);
         }
         //随机码保存在redis中方便进行比对
         $redis->setex('key_'.$userName , 3600 , $userName);
@@ -496,7 +498,7 @@ class BaController extends BaseController {
             $userInfo['isLocation'] = '('.implode(',',$isLocation).')';
             return static::notice($userInfo);
         }else{
-            return static::notice('Member number does not exist', 400);//会员编号不存在
+            return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
         }
     }
 
@@ -533,7 +535,7 @@ class BaController extends BaseController {
             ];
             return static::notice($arr);
         }else{
-            return static::notice('Repeat sales Member No. does not exist', 400);//复消会员编号不存在
+            return static::notice(Yii::t('app', 'repeatSalesMemberNoDoesNotExist'), 400);
         }
     }
 
@@ -566,12 +568,12 @@ class BaController extends BaseController {
             $post = \Yii::$app->request->post();
             $form->scenario = 'modifyProfile';
             if ($form->load($post, '') && $result = $form->modifyProfile()){
-                return static::notice('Personal data modified successfully');//个人资料修改成功
+                return static::notice(Yii::t('app', 'personalDataModifiedSuccessfully'), 400);
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
 
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 }

+ 15 - 7
frontendApi/modules/v1/controllers/BaseController.php

@@ -12,6 +12,7 @@ use common\components\ActiveRecord;
 use common\helpers\Date;
 use common\helpers\Form;
 use common\helpers\LoggerTool;
+use common\helpers\Tool;
 use \frontendApi\modules\v1\models\brand\User AS Brand;
 use frontendApi\modules\v1\models\User;
 use Yii;
@@ -36,7 +37,7 @@ class BaseController extends \yii\rest\ActiveController {
         $isQuickly = User::isQuicklyLogin();
         $requestMethod = Yii::$app->request->getMethod();
         if ($isQuickly == 1 && strtoupper($requestMethod) != 'GET') {
-            throw new ForbiddenHttpException('快速登录的会员无法进行任何操作!');
+            throw new ForbiddenHttpException(Yii::t('app', 'quickLoginCanNotOperate'));
         }
     }
 
@@ -47,7 +48,7 @@ class BaseController extends \yii\rest\ActiveController {
         $isQuickly = Brand::isQuicklyLogin();
         $requestMethod = Yii::$app->request->getMethod();
         if ($isQuickly == 1 && strtoupper($requestMethod) != 'GET') {
-            throw new ForbiddenHttpException('快速登录的会员无法进行任何操作!');
+            throw new ForbiddenHttpException(Yii::t('app', 'quickLoginCanNotOperate'));
         }
     }
 
@@ -77,7 +78,7 @@ class BaseController extends \yii\rest\ActiveController {
                 $currentTime = time();
                 $timeOut = Yii::$app->params['operationTimeOut'];
                 if ($currentTime - $lastTime > $timeOut) {
-                    return self::notice('Connection not operated for too long', 402);
+                    return self::notice(Yii::t('app', 'notConnection'), 402);
                 } else {
                     Yii::$app->tokenRedis->hset($redisKey, $userId, time());
                 }
@@ -101,13 +102,20 @@ class BaseController extends \yii\rest\ActiveController {
                 $currentTime = time();
                 $timeOut = Yii::$app->params['operationTimeOut'];
                 if ($currentTime - $lastTime > $timeOut) {
-                    return self::notice('Connection not operated for too long', 402);
+                    return self::notice(Yii::t('app', 'notConnection'), 402);
                 } else {
                     Yii::$app->tokenRedis->hset($redisKey, $userId, time());
                 }
             }
         }
 
+        // 动态返回语言:zh:zh-CN | en:en-US
+        if (!Yii::$app->request->isOptions) {
+            if (Yii::$app->request->headers->get('language')) {
+                Yii::$app->language = Yii::$app->request->headers->get('language') == 'zh' ? 'zh-CN' : 'en-US';
+            }
+        }
+
         return parent::beforeAction($action);
     }
 
@@ -187,7 +195,7 @@ class BaseController extends \yii\rest\ActiveController {
             $selected = \Yii::$app->request->post('selected');
         }
         if (!$selected) {
-            return self::notice('必须选择一条删除数据', 500);
+            return self::notice(Yii::t('app', 'selectAtLeastOne'), 500);
         }
 
         // 是否存在 DONT_DEL 字段
@@ -223,7 +231,7 @@ class BaseController extends \yii\rest\ActiveController {
             if ($isDelData) {
                 // 真实删除数据
                 if (!$modelClass::deleteAll($condition, $params)) {
-                    throw new Exception('failed to delete');//删除失败
+                    throw new Exception(Yii::t('app', 'deleteFailed'));
                 }
             } else {
                 // 设置IS_DEL字段为1
@@ -231,7 +239,7 @@ class BaseController extends \yii\rest\ActiveController {
             }
             if ($afterFun) $afterFun($selected);
             $transaction->commit();
-            return self::notice('delete successfully');//删除成功
+            return self::notice(Yii::t('app', 'deleteSuccessfully'));
         } catch (Exception $e) {
             $transaction->rollBack();
             return self::notice($e->getMessage(), 500);

+ 51 - 38
frontendApi/modules/v1/controllers/BonusController.php

@@ -12,7 +12,9 @@ namespace frontendApi\modules\v1\controllers;
 
 use common\helpers\Cache;
 use common\helpers\Date;
+use common\helpers\Form;
 use common\helpers\Tool;
+use common\helpers\user\Balance;
 use common\helpers\user\Info;
 use common\helpers\user\Perf;
 use common\models\CalcBonus;
@@ -28,17 +30,28 @@ use common\models\FlowReconsumePoints;
 use common\models\FlowTourismPoints;
 use common\models\FlowVillaPoints;
 use common\models\FlowWallet;
+use common\models\forms\TransferForm;
+use common\models\forms\UploadForm;
+use common\models\forms\WithdrawForm;
+use common\models\InvoiceAudit;
 use common\models\PerfMonth;
 use common\models\PerfPeriod;
 use common\models\Period;
 use common\models\DecRole;
 use common\models\EmployLevel;
 use common\models\FlowExchangePoints;
+use common\models\RegType;
 use common\models\ScoreMonth;
+use common\models\Transfer;
+use common\models\Uploads;
 use common\models\UserBonus;
+use common\models\UserInfo;
 use common\models\UserWallet;
 use common\models\UserRelation;
+use common\models\Withdraw;
 use frontendApi\modules\v1\models\User;
+use Yii;
+use yii\web\UploadedFile;
 
 class BonusController extends BaseController {
     public $modelClass = CalcBonus::class;
@@ -75,13 +88,13 @@ class BonusController extends BaseController {
 //                $showCFLX = true;
 //            }
 //        }
-        $wallet[] = ['walletType' => 'bonus', 'walletName' => 'Member Bonus', 'amount' => Tool::formatPrice($data['BONUS'])];//会员奖金
-        $wallet[] = ['walletType' => 'cash', 'walletName' => 'Member Ecoin', 'amount' => Tool::formatPrice($data['CASH'])];//会员余额
+        $wallet[] = ['walletType' => 'bonus', 'walletName' => Yii::t('app', 'memberBonus'), 'amount' => Tool::formatPrice($data['BONUS'])];//会员奖金
+        $wallet[] = ['walletType' => 'cash', 'walletName' => Yii::t('app', 'memberEcoin'), 'amount' => Tool::formatPrice($data['CASH'])];//会员余额
 //        $wallet[] = ['walletType' => 'point', 'walletName' => '会员积分', 'amount' => Tool::formatPrice($data['RECONSUME_POINTS'])];
 //        $wallet[] = ['walletType' => 'exchange', 'walletName' => 'Exchange points', 'amount' => Tool::formatPrice($data['EXCHANGE_POINTS'])];//兑换点数
 //        $wallet[] = ['walletType' => 'tourism_points', 'walletName' => 'Travel points', 'amount' => Tool::formatPrice($data['TOURISM_POINTS'])];//旅游积分
-        $wallet[] = ['walletType' => 'garage_points', 'walletName' => 'Car Points', 'amount' => Tool::formatPrice($data['GARAGE_POINTS'])];//车奖积分
-        $wallet[] = ['walletType' => 'villa_points', 'walletName' => 'Villa Points', 'amount' => Tool::formatPrice($data['VILLA_POINTS'])];//房奖积分
+        $wallet[] = ['walletType' => 'garage_points', 'walletName' => Yii::t('app', 'carPoints'), 'amount' => Tool::formatPrice($data['GARAGE_POINTS'])];//车奖积分
+        $wallet[] = ['walletType' => 'villa_points', 'walletName' => Yii::t('app', 'villaPoints'), 'amount' => Tool::formatPrice($data['VILLA_POINTS'])];//房奖积分
 //        if ($showCFLX) {
 //            $wallet[] = ['walletType' => 'cf', 'walletName' => '福利积分一', 'amount' => Tool::formatPrice($data['CF'])];
 //            $wallet[] = ['walletType' => 'lx', 'walletName' => '福利积分二', 'amount' => Tool::formatPrice($data['LX'])];
@@ -296,7 +309,7 @@ class BonusController extends BaseController {
             if($walletType != 'cash') {
                 foreach ($data['list'] as $key => $value) {
                     if ($value['DEAL_TYPE_IS_PRESET'] == 0) {
-                        $data['list'][$key]['DEAL_TYPE_NAME'] = $value['AMOUNT'] > 0 ? 'increase' : 'reduce'; // 增加 减少
+                        $data['list'][$key]['DEAL_TYPE_NAME'] = $value['AMOUNT'] > 0 ? Yii::t('app', 'increase') : Yii::t('app', 'reduce');
                     } else {
                         $data['list'][$key]['DEAL_TYPE_NAME'] = DealType::getAllTypesForShow()[$value['DEAL_TYPE_ID']]['TYPE_NAME'] ?? '';
                     }
@@ -313,8 +326,8 @@ class BonusController extends BaseController {
                 if(!$value['DEAL_TYPE_ID']) continue;
                 $dealType = DealType::getAllTypesForShow()[$value['DEAL_TYPE_ID']];
                 if($dealType['IS_PRESET']==0){
-                    $dealTypes['1'] = 'increase';// 增加
-                    $dealTypes['2'] = 'reduce';// 扣除
+                    $dealTypes['1'] = Yii::t('app', 'increase');// 增加
+                    $dealTypes['2'] = Yii::t('app', 'reduce');// 扣除
                 }else{
                     $dealLists[$key]['DEAL_TYPE_NAME'] = $dealType['TYPE_NAME']??'';
                     $dealTypes[$value['DEAL_TYPE_ID']] = $dealLists[$key]['DEAL_TYPE_NAME'];
@@ -339,11 +352,11 @@ class BonusController extends BaseController {
         //是否近期期数
         $showFlowPeriodNum = Cache::getSystemConfig()['showFlowPeriodNum']['VALUE'];
         $periodArr = Period::getNearlySendPeriodNum($showFlowPeriodNum);
-        if(!in_array($periodNum,$periodArr)) return static::notice('Cannot view this period',400); // 该期不能查看
+        if(!in_array($periodNum,$periodArr)) return static::notice(Yii::t('app', 'cannotViewThisPeriod'), 400);
         //增加明细开关控制(0 只显示总奖金 1 全部显示)
         $flowBonusSwitch = Cache::getSystemConfig()['flowBonusSwitch']['VALUE'];
         $data = $this->_periodBonus($periodNum,$flowBonusSwitch);
-        if(!$data) return static::notice('当期无奖金记录',400);
+        if(!$data) return static::notice(Yii::t('app', 'bonusRecordDoesNotExists'), 400);
         return static::notice($data);
     }
 
@@ -712,13 +725,13 @@ class BonusController extends BaseController {
         $condition = '';
         $params = [];
         if (!$periodNum) {
-            return static::notice('请选择期数',400);
+            return static::notice(Yii::t('app', 'pleaseSelectThePeriod'), 400);
         }
         if ($periodNum) {
             $showDecPeriodNum = Cache::getSystemConfig()['showDecPeriodNum']['VALUE'];
             $periodNums = Period::find()->where('IS_SENT=:IS_SENT',[':IS_SENT' => Period::SEND_FINISH])->select('PERIOD_NUM')->limit($showDecPeriodNum)->orderBy('PERIOD_NUM DESC')->asArray()->all();
             if(!in_array($periodNum,array_column($periodNums,'PERIOD_NUM'))){
-                return static::notice('该期无法查看',400);
+                return static::notice(Yii::t('app', 'cannotViewThisPeriod'), 400);
             }
             $condition .= ' AND PERIOD_NUM=:PERIOD_NUM';
             $params[':PERIOD_NUM'] = $periodNum;
@@ -752,13 +765,13 @@ class BonusController extends BaseController {
         $condition = '';
         $params = [];
         if (!$periodNum) {
-            return static::notice('请选择期数',400);
+            return static::notice(Yii::t('app', 'pleaseSelectThePeriod'), 400);
         }
         if ($periodNum) {
             $showDecPeriodNum = Cache::getSystemConfig()['showDecPeriodNum']['VALUE'];
             $periodNums = Period::find()->where('IS_SENT=:IS_SENT',[':IS_SENT' => Period::SEND_FINISH])->select('PERIOD_NUM')->limit($showDecPeriodNum)->orderBy('PERIOD_NUM DESC')->asArray()->all();
             if(!in_array($periodNum,array_column($periodNums,'PERIOD_NUM'))){
-                return static::notice('该期无法查看',400);
+                return static::notice(Yii::t('app', 'cannotViewThisPeriod'), 400);
             }
             $condition .= ' AND PERIOD_NUM=:PERIOD_NUM';
             $params[':PERIOD_NUM'] = $periodNum;
@@ -789,7 +802,7 @@ class BonusController extends BaseController {
         $periodInfo = $period->setPeriodNum($periodNum);
         $yearMonth = $period->getYearMonth($periodNum);
         if (!$period->isSent($periodNum)) {
-            return static::notice('Cannot view this period',400); // 该期不能查看
+            return static::notice(Yii::t('app', 'cannotViewThisPeriod'), 400);
         }
         $data = CalcBonus::findUseSlaves()->yearMonth($yearMonth)->select('BONUS_QY,BONUS_YC,BONUS_FX,BONUS_LS,BONUS_CF,BONUS_LX,BONUS_FL')->where('PERIOD_NUM=:PERIOD_NUM AND USER_ID=:USER_ID', [':PERIOD_NUM' => $periodNum, ':USER_ID' => \Yii::$app->user->id])->asArray()->one();
         return static::notice(['period' => $periodInfo, 'bonus' => $data]);
@@ -804,7 +817,7 @@ class BonusController extends BaseController {
         $yearMonth = \Yii::$app->request->get('yearMonth');
         if ($yearMonth) {
             if (!Date::isYearMonth($yearMonth)) {
-                return static::notice('无效参数', 400);
+                return static::notice(Yii::t('app', 'invalidParameter'), 400);
             }
         } else {
             $period = Period::instance();
@@ -832,7 +845,7 @@ class BonusController extends BaseController {
         $yearMonth = \Yii::$app->request->get('yearMonth');
         if ($yearMonth) {
             if (!Date::isYearMonth($yearMonth)) {
-                return static::notice('无效参数', 400);
+                return static::notice(Yii::t('app', 'invalidParameter'), 400);
             }
         } else {
             $period = Period::instance();
@@ -871,12 +884,12 @@ class BonusController extends BaseController {
             $formModel = new WithdrawForm();
             $formModel->scenario = 'addByUser';
             if ($formModel->load(\Yii::$app->request->post(), '') && $formModel->add()) {
-                return static::notice('Withdrawal application has been submitted, please wait for review.'); // 提现申请已提交,请等待审核
+                return static::notice(Yii::t('app', 'withdrawalApplicationHasBeenSubmitted'), 400);
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
         } else {
-            return static::notice('Illegal request', 400); // 非法请求
+            return static::notice(Yii::t('app', 'illegalRequest'), 400);
         }
     }
 
@@ -891,12 +904,12 @@ class BonusController extends BaseController {
             $formModel = new WithdrawForm();
             $formModel->scenario = 'backByUser';
             if ($formModel->load(\Yii::$app->request->post(), '') && $formModel->backByUser()) {
-                return static::notice('提现已退回');
+                return static::notice(Yii::t('app', 'withdrawHasBeenBacked'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
         } else {
-            return static::notice('Illegal request', 400); // 非法请求
+            return static::notice(Yii::t('app', 'illegalRequest'), 400);
         }
     }
 
@@ -908,23 +921,23 @@ class BonusController extends BaseController {
     public function actionChkWithdrawUser() {
         $uid = \Yii::$app->user->id;
         if (!Info::isVerified($uid)) {
-            return static::notice('未实名验证无法提现', 400);
+            return static::notice(Yii::t('app', 'withdrawDoesNotAllowedOfAuthentication'), 400);
         }
         $userInfo = UserInfo::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $uid], 'IS_BIND,IS_BIND_MAIN,IS_AUTO_WITHDRAW,REG_TYPE,TRANSFER_PROP');
         if ($userInfo['IS_BIND'] == 1 && $userInfo['IS_BIND_MAIN'] == 0) {
-            return static::notice('附属会员无法提现', 400);
+            return static::notice(Yii::t('app', 'withdrawDoesNotAllowedOfSubsidiaryMember'), 400);
         }
         if ($userInfo['IS_AUTO_WITHDRAW'] == 1) {
-            return static::notice('已开启自动提现,如需手动提现请关闭自动提现', 400);
+            return static::notice(Yii::t('app', 'autoWithdrawHasBeenOpened'), 400);
         }
         if (!Withdraw::allowWithdraw()) {
-            return static::notice('未到提现日期,请在每月挂网后第一周申请提现', 400);
+            return static::notice(Yii::t('app', 'withdrawNotAllowOfDate'), 400);
         }
         if (Withdraw::hasThisMonthWithdraw($uid)) {
-            return static::notice('提现失败,每月只可以提现一次', 400);
+            return static::notice(Yii::t('app', 'withdrawAllowOnceOfMonth'), 400);
         }
         if (Withdraw::existWaitAudit($uid)) {
-            return static::notice('提现失败,您存在未审核的提现记录', 400);
+            return static::notice(Yii::t('app', 'withdrawRecordHasNotVerify'), 400);
         }
         //是否显示服务协议
         $regType = RegType::findOneAsArray('ID=:ID', [':ID' => $userInfo['REG_TYPE']], 'IS_PACT');
@@ -952,10 +965,10 @@ class BonusController extends BaseController {
     public function actionCollectBind() {
         $transferBonusForm = new TransferBonusForm();
         if ($totals=$transferBonusForm->collectBind(\Yii::$app->user->id)) {
-            return static::notice('归集完成,归集金额'.$totals);
+            return static::notice(Yii::t('app', 'notionalPoolingAmountFinished') . $totals);
         } else {
             if($totals==0){
-                return static::notice('归集完成,归集金额'.$totals);
+                return static::notice(Yii::t('app', 'notionalPoolingAmountFinished') . $totals);
             }else{
                 return static::notice(Form::formatErrorsForApi($transferBonusForm->getErrors()), 400);
             }
@@ -971,13 +984,13 @@ class BonusController extends BaseController {
         $id = \Yii::$app->request->get('id');
         $withdraw = Withdraw::findOneAsArray('ID=:ID', [':ID' => $id]);
         if (!$withdraw) {
-            return static::notice('The data does not exist', 400); // 数据不存在
+            return static::notice(Yii::t('app', 'dataDoesNotExists'), 400);
         }
         $uploadInvoiceTip = Cache::getSystemConfig()['uploadInvoiceTip']['VALUE'];
         if ($withdraw['AUDIT_STATUS'] == Withdraw::STATUS_APPLIED) {
             return static::notice(['addInvoiceTips' => $uploadInvoiceTip]);
         } else {
-            return static::notice('该提现记录无法上传发票', 400);
+            return static::notice(Yii::t('app', 'withdrawDoesNotUploadInvoice'), 400);
         }
     }
 
@@ -991,7 +1004,7 @@ class BonusController extends BaseController {
         $id = \Yii::$app->request->get('id');
         $withdraw = Withdraw::findOneAsArray('ID=:ID', [':ID' => $id]);
         if (!$withdraw) {
-            return static::notice('The data does not exist', 400); // 数据不存在
+            return static::notice(Yii::t('app', 'dataDoesNotExists'), 400);
         }
         if (\Yii::$app->request->isPost) {
             $formModel = new UploadForm();
@@ -1002,7 +1015,7 @@ class BonusController extends BaseController {
             //$formModel->token = \Yii::$app->request->post('uploadToken');
             $formModel->token = \Yii::$app->request->request('uploadToken');
             if ($formModel->file && $formModel->upload()) {
-                return static::notice('Successful');
+                return static::notice(Yii::t('app', 'successfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -1018,7 +1031,7 @@ class BonusController extends BaseController {
         $id = \Yii::$app->request->get('id');
         $uploads = Uploads::findOneAsArray('ID=:ID', [':ID' => $id],'URL');
         if (!$uploads) {
-            return static::notice('The data does not exist', 400); // 数据不存在
+            return static::notice(Yii::t('app', 'dataDoesNotExists'), 400);
         }
         return static::notice($uploads['URL']);
     }
@@ -1041,7 +1054,7 @@ class BonusController extends BaseController {
         $yearMonth = \Yii::$app->request->get('yearMonth');
         if ($yearMonth) {
             if (!Date::isYearMonth($yearMonth)) {
-                return static::notice('无效参数', 400);
+                return static::notice(Yii::t('app', 'invalidParameter'), 400);
             }
         } else {
             $period = Period::instance();
@@ -1095,7 +1108,7 @@ class BonusController extends BaseController {
         if (\Yii::$app->request->isPost) {
             $formModel = new TransferForm();
             if ($formModel->load(\Yii::$app->request->post(), '') && $formModel->transfer()) {
-                return static::notice('Transfer success'); // 转账成功
+                return static::notice(Yii::t('app', 'successfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -1110,11 +1123,11 @@ class BonusController extends BaseController {
     public function actionChkTransferUser() {
         $uid = \Yii::$app->user->id;
         if (!Info::isVerified($uid)) {
-            return static::notice('未实名验证无法转账', 400);
+            return static::notice(Yii::t('app', 'transferDoesNotAllowedOfAuthentication'), 400);
         }
         $userInfo = UserInfo::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $uid], 'ALLOW_TRANSFER,TRANSFER_PROP');
         if($userInfo['ALLOW_TRANSFER']==0){
-            return static::notice('您不允许转账', 400);
+            return static::notice(Yii::t('app', 'transferDoesNotAllowed'), 400);
         }
         $isCanTransferProp = Cache::getSystemConfig()['isCanTransferProp']['VALUE'];
         if($isCanTransferProp==0){
@@ -1135,7 +1148,7 @@ class BonusController extends BaseController {
         $yearMonth = \Yii::$app->request->get('yearMonth');
         if ($yearMonth) {
             if (!Date::isYearMonth($yearMonth)) {
-                return static::notice('无效参数', 400);
+                return static::notice(Yii::t('app', 'invalidParameter'), 400);
             }
             $condition .= ' AND CALC_MONTH=:CALC_MONTH';
             $params['CALC_MONTH'] = $yearMonth;

+ 19 - 18
frontendApi/modules/v1/controllers/ConfigController.php

@@ -17,6 +17,7 @@ use common\models\forms\UserConfigForm;
 use common\models\ReceiveAddress;
 use common\models\Region;
 use common\models\UserInfo;
+use Yii;
 use yii\base\Exception;
 
 class ConfigController extends BaseController
@@ -54,7 +55,7 @@ class ConfigController extends BaseController
             $formModel = new UserConfigForm();
             $formModel->scenario = 'autoWithdraw';
             if($formModel->load(\Yii::$app->request->post(), '') && $formModel->autoWithdraw()){
-                return static::notice('开启关闭自动提现成功');
+                return static::notice(Yii::t('app', 'autoWithdrawHasBeenClosed'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -73,7 +74,7 @@ class ConfigController extends BaseController
             $formModel = new UserConfigForm();
             $formModel->scenario = 'allowReconsumeSms';
             if($formModel->load(\Yii::$app->request->post(), '') && $formModel->allowReconsumeSms()){
-                return static::notice('开启关闭复销短信提醒成功');
+                return static::notice(Yii::t('app', 'closeMessageSendSuccessfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -122,9 +123,9 @@ class ConfigController extends BaseController
     public function actionReceiveAddressAdd() {
         Region::updateToCache();
         if(\Yii::$app->request->isPost) {
-            return parent::edit(ReceiveAddressForm::class, 'Added Successfully', 'userAdd', ['edit']);
+            return parent::edit(ReceiveAddressForm::class, Yii::t('app', 'successfully'), 'userAdd', ['edit']);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -134,9 +135,9 @@ class ConfigController extends BaseController
      */
     public function actionReceiveAddressEdit() {
         if(\Yii::$app->request->isPost) {
-            return parent::edit(ReceiveAddressForm::class, 'Modified Successfully', 'userEdit', ['edit']);
+            return parent::edit(ReceiveAddressForm::class, Yii::t('app', 'successfully'), 'userEdit', ['edit']);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -146,9 +147,9 @@ class ConfigController extends BaseController
      */
     public function actionReceiveAddressDefault() {
         if(\Yii::$app->request->isPost) {
-            return parent::edit(ReceiveAddressForm::class, '添加收货地址成功', 'userIsDefault', ['edit']);
+            return parent::edit(ReceiveAddressForm::class, Yii::t('app', 'successfully'), 'userIsDefault', ['edit']);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -165,12 +166,12 @@ class ConfigController extends BaseController
                     $model = ReceiveAddress::find()->where('USER_ID=:USER_ID', [':USER_ID'=>\Yii::$app->user->id])->one();
                     $model->IS_DEFAULT = 1;
                     if (!$model->save()){
-                        throw new Exception('更新默认地址失败');
+                        throw new Exception(Yii::t('app', 'changeDefaultAddressFailed'));
                     }
                 }
             } , true);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -215,9 +216,9 @@ class ConfigController extends BaseController
     public function actionBaReceiveAddressAdd() {
         Region::updateToCache();
         if (\Yii::$app->request->isPost) {
-            return parent::edit(BaReceiveAddressForm::class, 'Added Successfully', 'userAdd', ['edit']);
+            return parent::edit(BaReceiveAddressForm::class, Yii::t('app', 'successfully'), 'userAdd', ['edit']);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -227,9 +228,9 @@ class ConfigController extends BaseController
      */
     public function actionBaReceiveAddressEdit() {
         if(\Yii::$app->request->isPost) {
-            return parent::edit(BaReceiveAddressForm::class, 'Modified Successfully', 'userEdit', ['edit']);
+            return parent::edit(BaReceiveAddressForm::class, Yii::t('app', 'successfully'), 'userEdit', ['edit']);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -239,9 +240,9 @@ class ConfigController extends BaseController
      */
     public function actionBaReceiveAddressDefault() {
         if(\Yii::$app->request->isPost) {
-            return parent::edit(BaReceiveAddressForm::class, '添加收货地址成功', 'userIsDefault', ['edit']);
+            return parent::edit(BaReceiveAddressForm::class, Yii::t('app', Yii::t('app', 'successfully')), 'userIsDefault', ['edit']);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -260,12 +261,12 @@ class ConfigController extends BaseController
                         $model = BaReceiveAddress::find()->where('USER_ID=:USER_ID', [':USER_ID' => \Yii::$app->getUser()->getId()])->one();
                         $model->IS_DEFAULT = 1;
                         if (!$model->save()) {
-                            throw new Exception('更新默认地址失败');
+                            throw new Exception(Yii::t('app', 'changeDefaultAddressFailed'));
                         }
                     }
                 }
             } , true);
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 }

+ 3 - 1
frontendApi/modules/v1/controllers/DashboardController.php

@@ -21,6 +21,7 @@ use common\models\Period;
 use common\models\ReconsumePool;
 use common\models\RemainPv;
 use common\models\Order;
+use Yii;
 
 class DashboardController extends BaseController
 {
@@ -129,7 +130,8 @@ class DashboardController extends BaseController
             'slides'=>Ad::findUseSlaves()->select('ID,IMAGE,LID,TITLE,CONTENT,TYPE')->where('LID=:LID AND STATUS=1', [':LID'=>'7EFF6260A16C3CC7E053693418AC03E4'])->orderBy('SORT ASC')->asArray()->all(),
             'news'=>$news,
 //            'periodNum'=>'Period '.$periodNum.' ,'.$curYM['CALC_MONTH'].'月第'.$wkrd.'周,共'.$weeks.'周',
-            'periodNum'=>$periodNum.', '.$wkrd.' PC of '. $monthArray[$curYM['CALC_MONTH']],
+//            'periodNum'=>$periodNum.', '.$wkrd.' PC of '. $monthArray[$curYM['CALC_MONTH']],
+            'periodNum'=>$periodNum . ', ' . $wkrd . ' '. Yii::t('app', 'pcOf') . ' '. $monthArray[$curYM['CALC_MONTH']],
             'myRemainPv'=>$totalRemainPv,
             'activeEnd'=>$activeEnd
         ]);

+ 23 - 22
frontendApi/modules/v1/controllers/FinanceController.php

@@ -33,6 +33,7 @@ use common\models\Uploads;
 use common\models\UserInfo;
 use common\models\Withdraw;
 use common\models\UserBonus;
+use Yii;
 use yii\helpers\Json;
 use yii\web\UploadedFile;
 
@@ -70,7 +71,7 @@ class FinanceController extends BaseController {
         $yearMonth = \Yii::$app->request->get('yearMonth');
         if ($yearMonth) {
             if (!Date::isYearMonth($yearMonth)) {
-                return static::notice('无效参数', 400);
+                return static::notice(Yii::t('app', 'invalidParameter'), 400);
             }
         } else {
             $period = Period::instance();
@@ -116,7 +117,7 @@ class FinanceController extends BaseController {
             switch ($checkStatus) {
                 case 0:
                     if ($formModel->load(\Yii::$app->request->post(), '') && $formModel->add()) {
-                        $rtn =  static::notice('Withdrawal application has been submitted, please wait for review.'); // 提现申请已提交,请等待审核
+                        $rtn =  static::notice(Yii::t('app', 'withdrawalApplicationHasBeenSubmitted'));
                     } else {
                         $rtn = static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
                     }
@@ -128,14 +129,14 @@ class FinanceController extends BaseController {
                     $rtn = static::notice(Form::formatErrorsForApi($formModel->getErrors()), 424);
                     break;
                 default:
-                    $rtn = static::notice('状态错误', 400);
+                    $rtn = static::notice(Yii::t('app', 'statueError'), 400);
                     break;
             }
 
             return $rtn;
 
         } else {
-            return static::notice('Illegal request', 400); // 非法请求
+            return static::notice(Yii::t('app', 'illegalRequest'), 400);
         }
     }
 
@@ -159,17 +160,17 @@ class FinanceController extends BaseController {
      * @throws \yii\web\HttpException
      */
     public function actionWithdrawBack() {
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
         if (\Yii::$app->request->isPost) {
             $formModel = new WithdrawForm();
             $formModel->scenario = 'backByUser';
             if ($formModel->load(\Yii::$app->request->post(), '') && $formModel->backByUser()) {
-                return static::notice('提现已退回');
+                return static::notice(Yii::t('app', 'withdrawHasBeenBacked'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
         } else {
-            return static::notice('Illegal request', 400); // 非法请求
+            return static::notice(Yii::t('app', 'illegalRequest'), 400);
         }
     }
 
@@ -181,7 +182,7 @@ class FinanceController extends BaseController {
     public function actionChkWithdrawUser() {
         $uid = \Yii::$app->user->id;
         if (!Info::isVerified($uid)) {
-            return static::notice('未实名验证无法提现', 400);
+            return static::notice(Yii::t('app', 'withdrawDoesNotAllowedOfAuthentication'), 400);
         }
         $userInfo = UserInfo::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $uid], 'IS_BIND,IS_BIND_MAIN,IS_AUTO_WITHDRAW,REG_TYPE,TRANSFER_PROP');
 //        if ($userInfo['IS_BIND'] == 1 && $userInfo['IS_BIND_MAIN'] == 0) {
@@ -232,10 +233,10 @@ class FinanceController extends BaseController {
     public function actionCollectBind() {
         $transferBonusForm = new TransferBonusForm();
         if ($totals=$transferBonusForm->collectBind(\Yii::$app->user->id)) {
-            return static::notice('归集完成,归集金额'.$totals);
+            return static::notice(Yii::t('app', 'notionalPoolingAmountFinished') . $totals);
         } else {
             if($totals==0){
-                return static::notice('归集完成,归集金额'.$totals);
+                return static::notice(Yii::t('app', 'notionalPoolingAmountFinished') . $totals);
             }else{
                 return static::notice(Form::formatErrorsForApi($transferBonusForm->getErrors()), 400);
             }
@@ -251,13 +252,13 @@ class FinanceController extends BaseController {
         $id = \Yii::$app->request->get('id');
         $withdraw = Withdraw::findOneAsArray('ID=:ID', [':ID' => $id]);
         if (!$withdraw) {
-            return static::notice('The data does not exist', 400); // 数据不存在
+            return static::notice(Yii::t('app', 'dataDoesNotExists'), 400);
         }
         $uploadInvoiceTip = Cache::getSystemConfig()['uploadInvoiceTip']['VALUE'];
         if ($withdraw['AUDIT_STATUS'] == Withdraw::STATUS_APPLIED) {
             return static::notice(['addInvoiceTips' => $uploadInvoiceTip]);
         } else {
-            return static::notice('该提现记录无法上传发票', 400);
+            return static::notice(Yii::t('app', 'withdrawDoesNotUploadInvoice'), 400);
         }
     }
 
@@ -271,7 +272,7 @@ class FinanceController extends BaseController {
         $id = \Yii::$app->request->get('id');
         $withdraw = Withdraw::findOneAsArray('ID=:ID', [':ID' => $id]);
         if (!$withdraw) {
-            return static::notice('The data does not exist', 400); // 数据不存在
+            return static::notice(Yii::t('app', 'dataDoesNotExists'), 400);
         }
         if (\Yii::$app->request->isPost) {
             $formModel = new UploadForm();
@@ -298,7 +299,7 @@ class FinanceController extends BaseController {
         $id = \Yii::$app->request->get('id');
         $uploads = Uploads::findOneAsArray('ID=:ID', [':ID' => $id],'URL');
         if (!$uploads) {
-            return static::notice('The data does not exist', 400); // 数据不存在
+            return static::notice(Yii::t('app', 'dataDoesNotExists'), 400);
         }
         return static::notice($uploads['URL']);
     }
@@ -323,7 +324,7 @@ class FinanceController extends BaseController {
         $yearMonth = \Yii::$app->request->get('yearMonth');
         if ($yearMonth) {
             if (!Date::isYearMonth($yearMonth)) {
-                return static::notice('无效参数', 400);
+                return static::notice(Yii::t('app', 'invalidParameter'), 400);
             }
         } else {
             $period = Period::instance();
@@ -436,7 +437,7 @@ class FinanceController extends BaseController {
             $formModel = new TransferForm();
             $formModel->scenario = 'transfer';
             if ($formModel->load(\Yii::$app->request->post(), '') && $formModel->transfer()) {
-                return static::notice('Transfer success'); // 转账成功
+                return static::notice(Yii::t('app', 'successfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -465,15 +466,15 @@ class FinanceController extends BaseController {
     public function actionChkTransferUser() {
         $uid = \Yii::$app->user->id;
         if (!Info::isVerified($uid)) {
-            return static::notice('未实名验证无法转账', 400);
+            return static::notice(Yii::t('app', 'withdrawDoesNotAllowedOfAuthentication'), 400);
         }
         $sysConfig = Cache::getSystemConfig();
         if(!$sysConfig['transferOpen']['VALUE']){
-            return static::notice('转账功能未启用', 400);
+            return static::notice(Yii::t('app', 'transferDoesNotOpen'), 400);
         }
         $userInfo = UserInfo::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $uid], 'ALLOW_TRANSFER,TRANSFER_PROP');
         if($userInfo['ALLOW_TRANSFER']==0){
-            return static::notice('您不允许转账', 400);
+            return static::notice(Yii::t('app', 'transferDoesNotAllowed'), 400);
         }
         $isCanTransferProp = Cache::getSystemConfig()['isCanTransferProp']['VALUE'];
         if($isCanTransferProp==0){
@@ -496,7 +497,7 @@ class FinanceController extends BaseController {
             ];
         }
         if(count($arr)==0){
-            return static::notice('没有可用的转账类型', 400);
+            return static::notice(Yii::t('app', 'transferTypeDoesNotExists'), 400);
         }
         return static::notice([
             'userInfo' => $userInfo,
@@ -539,7 +540,7 @@ class FinanceController extends BaseController {
             $formModel = new RechargeForm();
             $formModel->scenario = 'addByUser';
             if ($formModel->load(\Yii::$app->request->post(), '') && $formModel->add()) {
-                return static::notice('Recharge application has been submitted, please wait for review.');// 充值申请已提交,请等待审核
+                return static::notice(Yii::t('app', 'rechargeApplicationHasBeenSubmitted'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -564,7 +565,7 @@ class FinanceController extends BaseController {
             $formModel->token = \Yii::$app->request->request('uploadToken');
             $formModel->rechargeId = $id;
             if ($formModel->file && $formModel->upload()) {
-                return static::notice('Successful');
+                return static::notice(Yii::t('app', 'successfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }

+ 6 - 6
frontendApi/modules/v1/controllers/OauthController.php

@@ -144,7 +144,7 @@ class OauthController extends BaseController
         if($token){
             return static::notice($token);
         } else {
-            return static::notice('更新Token失败', 401);
+            return static::notice(Yii::t('app', 'refreshTokenFailed'), 401);
         }
     }
 
@@ -160,7 +160,7 @@ class OauthController extends BaseController
         if($token){
             return static::notice($token);
         } else {
-            return static::notice('更新Token失败', 401);
+            return static::notice(Yii::t('app', 'refreshTokenFailed'), 401);
         }
     }
 
@@ -176,7 +176,7 @@ class OauthController extends BaseController
         if($token){
             return static::notice($token);
         } else {
-            return static::notice('更新Token失败', 401);
+            return static::notice(Yii::t('app', 'refreshTokenFailed'), 401);
         }
     }
 
@@ -192,7 +192,7 @@ class OauthController extends BaseController
                 return static::notice($result);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -205,12 +205,12 @@ class OauthController extends BaseController
             $form->scenario = 'noLoginModifyPassword';
             $post = \Yii::$app->request->post();
             if($form->load($post, '') && $result = $form->noLoginModifyPassword()){
-                return static::notice('Password change succeeded'); // 密码修改成功
+                return static::notice(Yii::t('app', 'passwordChangeSucceeded'));
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
 }

+ 119 - 65
frontendApi/modules/v1/controllers/ShopController.php

@@ -613,11 +613,11 @@ class ShopController extends BaseController {
         if (\Yii::$app->request->isPost) {
             $formModel = new OrderForm();
             $formModel->scenario = 'reconsumeOrder';
-            $formModel->remark = '帮会员复销';
+            $formModel->remark = Yii::t('app', 'reconsume');
             $post = \Yii::$app->request->post();
             $post['type'] = DeclarationForm::TYPE_FX;
             if ($formModel->load($post, '') && $formModel->reconsumeAdd()) {
-                return static::notice('帮会员复消成功');
+                return static::notice(Yii::t('app', 'reconsumeSuccessfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()),400);
             }
@@ -638,19 +638,19 @@ class ShopController extends BaseController {
 //            ],
             [
                 'name' => '1',
-                'label' => 'Standard Products',//普通商品列表
+                'label' => Yii::t('app', 'standardProducts'),
             ],
 //            [
 //                'name' => '4',
-//                'label' => 'Travel Fund Products',//旅游积分商品
+//                'label' => Yii::t('app', 'travelFundProducts'),
 //            ],
             [
                 'name' => '5',
-                'label' => 'Car Fund Products',//车奖积分商品
+                'label' => Yii::t('app', 'carFundProducts'),
             ],
             [
                 'name' => '6',
-                'label' => 'Villa Fund Products',//房奖积分商品
+                'label' => Yii::t('app', 'villaFundProducts'),
             ],
         ];
         return static::notice($data);
@@ -742,35 +742,53 @@ class ShopController extends BaseController {
 EOT;
         }
 
+        $memberCode = Yii::t('app', 'memberCode');
+        $memberName = Yii::t('app', 'memberName');
+        $memberAddress = Yii::t('app', 'memberAddress');
+        $memberPhone = Yii::t('app', 'memberPhone');
+        $orderCode = Yii::t('app', 'orderCode');
+        $orderDetail = Yii::t('app', 'orderDetail');
+        $productCode = Yii::t('app', 'productCode');
+        $productName = Yii::t('app', 'productName');
+        $productPrice = Yii::t('app', 'productPrice');
+        $quantity = Yii::t('app', 'qty');
+        $taxRate = Yii::t('app', 'taxRate');
+        $totalTax = Yii::t('app', 'totalTax');
+        $totalAmount = Yii::t('app', 'totalAmount');
+        $total = Yii::t('app', 'total');
+        $signature = Yii::t('app', 'signature');
+        $date = Yii::t('app', 'date');
+        $createAt = Yii::t('app', 'createAt');
+
         // 订单基本信息
         $orderBase = <<<ORDER
             <table border="1" style="table-layout: fixed; padding: 10px 20px;" width="100%">
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Code</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberCode}</td>
                     <td width="70%">{$userId}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Name</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberName}</td>
                     <td width="70%">{$userName}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Address</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberAddress}</td>
                     <td width="70%">{$address}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Phone</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberPhone}</td>
                     <td width="70%">{$mobile}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Order Code</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$orderCode}</td>
                     <td width="70%">{$orderSn}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Creation Time</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$createAt}</td>
                     <td width="70%">{$orderAt}</td>
                 </tr>
                 <tr>
-                    <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">Order Detail</td>
+                    <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">{$orderDetail}</td>
                     <td class="bg"></td>
                 </tr>
             </table>
@@ -789,7 +807,7 @@ ORDER;
             <html lang="en">
             <head>
                 <meta charset="UTF-8" />
-                <title>Order detail</title>
+                <title>{$orderDetail}</title>
                 <style>
                     table {
                         border-collapse: collapse;
@@ -809,24 +827,24 @@ ORDER;
             </head>
             <body>
                 <div class="content">
-                    <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>Order detail</b><br></p>
+                    <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>{$orderDetail}</b><br></p>
                     <div>
                         <div style="display: block; width: 100%;">
                             {$orderBase}
                             
                             <table border="1" width="100%" style="padding: 10px 5px; text-align: center;">
                                 <tr>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Code</th>
-                                    <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Name</th>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Price</th>
-                                    <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Qty</th>
-                                    <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">Tax Rate</th>
-                                    <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Tax</th>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Amount</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productCode}</th>
+                                    <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productName}</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productPrice}</th>
+                                    <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">{$quantity}</th>
+                                    <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">{$taxRate}</th>
+                                    <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalTax}</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalAmount}</th>
                                 </tr>
                                 {$orderDetails}
                                 <tr>
-                                    <td colspan="3">Total</td>
+                                    <td colspan="3">{$total}</td>
                                     <td style="text-align: right;">{$orderNums}</td>
                                     <td></td>
                                     <td style="text-align: right;">{$totalTaxAmount}</td>
@@ -839,11 +857,11 @@ ORDER;
                             <table width="100%" style="border: none; padding: 10px 20px; text-align: center;">
                                 <tr style="border: none;">
                                     <td width="70%" style="border: none;"></td>
-                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Signature:</td>
+                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$signature}:</td>
                                 </tr>
                                 <tr style="border: none;">
                                     <td width="70%" style="border: none;"></td>
-                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Date:</td>
+                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$date}:</td>
                                 </tr>
                             </table>
                         </div>
@@ -988,35 +1006,53 @@ ORDER;
 EOT;
         }
 
+        $memberCode = Yii::t('app', 'memberCode');
+        $memberName = Yii::t('app', 'memberName');
+        $memberAddress = Yii::t('app', 'memberAddress');
+        $memberPhone = Yii::t('app', 'memberPhone');
+        $orderCode = Yii::t('app', 'orderCode');
+        $orderDetail = Yii::t('app', 'orderDetail');
+        $productCode = Yii::t('app', 'productCode');
+        $productName = Yii::t('app', 'productName');
+        $productPrice = Yii::t('app', 'productPrice');
+        $quantity = Yii::t('app', 'qty');
+        $taxRate = Yii::t('app', 'taxRate');
+        $totalTax = Yii::t('app', 'totalTax');
+        $totalAmount = Yii::t('app', 'totalAmount');
+        $total = Yii::t('app', 'total');
+        $signature = Yii::t('app', 'signature');
+        $date = Yii::t('app', 'date');
+        $createAt = Yii::t('app', 'createAt');
+
         // 订单基本信息
         $orderBase = <<<ORDER
             <table border="1" style="table-layout: fixed; padding: 10px 20px;" width="100%">
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Code</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberCode}</td>
                     <td width="70%">{$userId}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Name</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberName}</td>
                     <td width="70%">{$userName}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Address</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberAddress}</td>
                     <td width="70%">{$address}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Phone</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberPhone}</td>
                     <td width="70%">{$mobile}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Order Code</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$orderCode}</td>
                     <td width="70%">{$orderSn}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Creation Time</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$createAt}</td>
                     <td width="70%">{$orderAt}</td>
                 </tr>
                 <tr>
-                    <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">Order detail</td>
+                    <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">{$orderDetail}</td>
                     <td class="bg"></td>
                 </tr>
             </table>
@@ -1035,7 +1071,7 @@ ORDER;
             <html lang="en">
             <head>
                 <meta charset="UTF-8" />
-                <title>Order detail</title>
+                <title>{$orderDetail}</title>
                 <style>
                     table {
                         border-collapse: collapse;
@@ -1055,24 +1091,24 @@ ORDER;
             </head>
             <body>
                 <div class="content">
-                    <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>Order detail</b><br></p>
+                    <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>{$orderDetail}</b><br></p>
                     <div>
                         <div style="display: block; width: 100%;">
                             {$orderBase}
                             
                             <table border="1" width="100%" style="padding: 10px 5px; text-align: center;">
                                 <tr>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Code</th>
-                                    <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Name</th>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Price</th>
-                                    <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Qty</th>
-                                    <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">Tax Rate</th>
-                                    <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Tax</th>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Amount</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productCode}</th>
+                                    <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productName}</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productPrice}</th>
+                                    <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">{$quantity}</th>
+                                    <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">{$taxRate}</th>
+                                    <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalTax}</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalAmount}</th>
                                 </tr>
                                 {$orderDetails}
                                 <tr>
-                                    <td colspan="3">Total</td>
+                                    <td colspan="3">{$total}</td>
                                     <td style="text-align: right;">{$orderNums}</td>
                                     <td></td>
                                     <td style="text-align: right;">{$totalTaxAmount}</td>
@@ -1085,11 +1121,11 @@ ORDER;
                             <table width="100%" style="border: none; padding: 10px 20px; text-align: center;">
                                 <tr style="border: none;">
                                     <td width="70%" style="border: none;"></td>
-                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Signature:</td>
+                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$signature}:</td>
                                 </tr>
                                 <tr style="border: none;">
                                     <td width="70%" style="border: none;"></td>
-                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Date:</td>
+                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$date}:</td>
                                 </tr>
                             </table>
                         </div>
@@ -1224,7 +1260,7 @@ ORDER;
         if (\Yii::$app->request->isPost) {
             $formModel = new BaApproachOrderForm();
             $formModel->scenario = 'userOrder';
-            $formModel->remark = '复销备注';
+            $formModel->remark = Yii::t('app', 'reconsumeRemark');
             $post = \Yii::$app->request->post();
             $post['type'] = DeclarationForm::TYPE_FX;
             if ($formModel->load($post, '') && $order = $formModel->add()) {
@@ -1540,35 +1576,53 @@ ORDER;
 EOT;
         }
 
+        $memberCode = Yii::t('app', 'memberCode');
+        $memberName = Yii::t('app', 'memberName');
+        $memberAddress = Yii::t('app', 'memberAddress');
+        $memberPhone = Yii::t('app', 'memberPhone');
+        $orderCode = Yii::t('app', 'orderCode');
+        $orderDetail = Yii::t('app', 'orderDetail');
+        $productCode = Yii::t('app', 'productCode');
+        $productName = Yii::t('app', 'productName');
+        $productPrice = Yii::t('app', 'productPrice');
+        $quantity = Yii::t('app', 'qty');
+        $taxRate = Yii::t('app', 'taxRate');
+        $totalTax = Yii::t('app', 'totalTax');
+        $totalAmount = Yii::t('app', 'totalAmount');
+        $total = Yii::t('app', 'total');
+        $signature = Yii::t('app', 'signature');
+        $date = Yii::t('app', 'date');
+        $createAt = Yii::t('app', 'createAt');
+
         // 订单基本信息
         $orderBase = <<<ORDER
             <table border="1" style="table-layout: fixed; padding: 10px 20px;" width="100%">
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Code</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberCode}</td>
                     <td width="70%">{$userId}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Name</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberName}</td>
                     <td width="70%">{$userName}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Address</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberAddress}</td>
                     <td width="70%">{$address}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Member Phone</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$memberPhone}</td>
                     <td width="70%">{$mobile}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Order Code</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$orderCode}</td>
                     <td width="70%">{$orderSn}</td>
                 </tr>
                 <tr>
-                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">Creation Time</td>
+                    <td width="30%" style="font-weight: bold; text-align: center; font-size: 14px;">{$createAt}</td>
                     <td width="70%">{$orderAt}</td>
                 </tr>
                 <tr>
-                    <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">Order detail</td>
+                    <td class="bg" style="font-weight: bold; font-size: 14px; text-align: center;">{$orderDetail}</td>
                     <td class="bg"></td>
                 </tr>
             </table>
@@ -1587,7 +1641,7 @@ ORDER;
             <html lang="en">
             <head>
                 <meta charset="UTF-8" />
-                <title>Order detail</title>
+                <title>{$orderDetail}</title>
                 <style>
                     table {
                         border-collapse: collapse;
@@ -1607,24 +1661,24 @@ ORDER;
             </head>
             <body>
                 <div class="content">
-                    <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>Order detail</b><br></p>
+                    <p style="text-align: center; font-weight: bold; font-size: 22px;"><b>{$orderDetail}</b><br></p>
                     <div>
                         <div style="display: block; width: 100%;">
                             {$orderBase}
                             
-                            <table border="1" width="100%" style="padding: 5px 5px; text-align: center;">
+                            <table border="1" width="100%" style="padding: 10px 5px; text-align: center;">
                                 <tr>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Product Code</th>
-                                    <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">Product</th>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Price</th>
-                                    <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">Qty</th>
-                                    <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">Tax Rate</th>
-                                    <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Tax</th>
-                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">Total Amount</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productCode}</th>
+                                    <th width="20%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productName}</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$productPrice}</th>
+                                    <th width="10%" style="font-size: 14px; font-weight: bold; text-align: center;">{$quantity}</th>
+                                    <th width="12%" style="font-size: 14px; font-weight: bold; text-align: center;">{$taxRate}</th>
+                                    <th width="13%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalTax}</th>
+                                    <th width="15%" style="font-size: 14px; font-weight: bold; text-align: center;">{$totalAmount}</th>
                                 </tr>
                                 {$orderDetails}
                                 <tr>
-                                    <td colspan="3">Total</td>
+                                    <td colspan="3">{$total}</td>
                                     <td style="text-align: right;">{$orderNums}</td>
                                     <td></td>
                                     <td style="text-align: right;">{$totalTaxAmount}</td>
@@ -1637,11 +1691,11 @@ ORDER;
                             <table width="100%" style="border: none; padding: 10px 20px; text-align: center;">
                                 <tr style="border: none;">
                                     <td width="70%" style="border: none;"></td>
-                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Signature:</td>
+                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$signature}:</td>
                                 </tr>
                                 <tr style="border: none;">
                                     <td width="70%" style="border: none;"></td>
-                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">Date:</td>
+                                    <td width="30%" style="font-weight: bold; text-align: left; font-size: 14px; border: none;">{$date}:</td>
                                 </tr>
                             </table>
                         </div>

+ 29 - 28
frontendApi/modules/v1/controllers/UserController.php

@@ -41,6 +41,7 @@ use common\models\BaUserInfo;
 use common\models\UserNetwork;
 use common\models\forms\DeclarationUpgradeForm;
 use common\models\UserWallet;
+use Yii;
 use yii\db\Exception;
 use yii\web\UploadedFile;
 
@@ -73,12 +74,12 @@ class UserController extends BaseController {
             $post = \Yii::$app->request->post();
             $form->scenario = 'modifyProfile';
             if($form->load($post, '') && $result = $form->modifyProfile()){
-                return static::notice('Personal data modified successfully');//个人资料修改成功
+                return static::notice(Yii::t('app', 'personalDataModifiedSuccessfully'), 400);
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -90,12 +91,12 @@ class UserController extends BaseController {
             $form->scenario = 'modifyPassword';
             $post = \Yii::$app->request->post();
             if($form->load($post, '') && $result = $form->modifyPassword()){
-                return static::notice('Password modified successfully'); // 密码修改成功
+                return static::notice(Yii::t('app', 'passwordModifiedSuccessfully'), 400);
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -108,12 +109,12 @@ class UserController extends BaseController {
             $post = \Yii::$app->request->post();
             $form->userId = \Yii::$app->user->id;
             if($form->load($post, '') && $result = $form->modifyPasswordPay()){
-                return static::notice('支付密码修改成功');
+                return static::notice(Yii::t('app', 'passwordModifiedSuccessfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -145,7 +146,7 @@ class UserController extends BaseController {
             //$formModel->token = \Yii::$app->request->post('uploadToken');
             $formModel->token = \Yii::$app->request->request('uploadToken');
             if ($formModel->file && $formModel->upload()) {
-                return static::notice('Successful');
+                return static::notice(Yii::t('app', 'successfully'));
             } else {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400);
             }
@@ -196,7 +197,7 @@ class UserController extends BaseController {
     public function actionBindEdit(){
         $id = \Yii::$app->request->get('id');
         if(\Yii::$app->request->isPost) {
-            return parent::edit(UserBindForm::class, '修改主点位成功', 'frontEdit', ['frontEdit'], null, function($form, $result){
+            return parent::edit(UserBindForm::class, Yii::t('app', 'successfully'), 'frontEdit', ['frontEdit'], null, function($form, $result){
                 //log
             });
         }
@@ -224,12 +225,12 @@ class UserController extends BaseController {
         ->one();
         $isOpen = !empty($isSwitchUpgrade) && isset($isSwitchUpgrade['VALUE']) ? $isSwitchUpgrade['VALUE'] : 0;
         if ($isOpen < 1) {
-            return static::notice('The function is not available',400); // 功能暂未开放
+            return static::notice(Yii::t('app', 'theFunctionIsNotAvailable'), 400);
         }
         $userNumber = \Yii::$app->request->request('userName');
         $baseInfo = Info::baseInfoZhByUserName($userNumber);
         if ($baseInfo['STATUS'] != 1) {
-            return static::notice('Inactive user. Please contact customer service.',400);// 非激活用户,请联系客服
+            return static::notice(Yii::t('app', 'inactiveUser'), 400);
         }
         // 1. 如果是最高级别,则只显示用户基本信息
         // 2. 如果不是最高级别,如果用户累计报单数据是0, 或者用户累计报单业绩不符合级别信息,则提示 请联系客服核对业绩
@@ -274,10 +275,10 @@ class UserController extends BaseController {
             $nextLevelPerf = DeclarationLevel::getNextDecPref($levelPerf)['PERF'];
             // 如果总和超过了下一级业绩
             if ($userDecPvSum >= $nextLevelPerf) {
-                return static::notice('Please contact customer service to check performance.',400);// 请联系客服人员核对业绩
+                return static::notice(Yii::t('app', 'checkPerformance'), 400);
             }
             $type = $isObserve ? 1 : 2;
-            $userInfo['UPGRADE_FUNC'] = $isObserve ? 'filling up of a deficit' : 'full payment';// 升级方式
+            $userInfo['UPGRADE_FUNC'] = $isObserve ? Yii::t('app', 'fillingUpOfADeficit') : Yii::t('app', 'fullPayment');
             $upgradeType = UpgradeType::getOneByType($type);
             // 如果用户不是最大级别,则需要获取是否观察期,算出PV是否有问题,应该补多少,
             $userInfo['UPGRADE_TYPE'] = $upgradeType;
@@ -302,7 +303,7 @@ class UserController extends BaseController {
         ->one();
         $isOpen = !empty($isSwitchUpgrade) && isset($isSwitchUpgrade['VALUE']) ? $isSwitchUpgrade['VALUE'] : 0;
         if ($isOpen < 1) {
-            return static::notice('功能暂未开放',400);
+            return static::notice(Yii::t('app', 'theFunctionIsNotAvailable'), 400);
         }
         // 开始升级
         if (\Yii::$app->request->isPost) {
@@ -403,10 +404,10 @@ class UserController extends BaseController {
                 $insertUserName = strtoupper($post['insertUserName']);
                 $getRedisUserName = $redis->get('key_' . $insertUserName);
                 if (!$getRedisUserName){
-                    return static::notice('Membership number expired',400);//会员编号过期
+                    return static::notice(Yii::t('app', 'memberNumberExpired'), 400);
                 }
                 if ($insertUserName != $getRedisUserName){
-                    return static::notice('Member number does not conform to',400);//会员编号不符合
+                    return static::notice(Yii::t('app', 'memberNumberDoesNotConformTo'), 400);
                 }
             }else{ // BA升级,需要判断BA用户是否存在
                 $insertUserName = $post['insertUserName'];
@@ -449,7 +450,7 @@ class UserController extends BaseController {
         // 所有开户行
         $allOpenBank = OpenBank::find()->where('STATUS=1')->orderBy('LIST_ORDER ASC')->asArray()->all();
         if (!$userName) {
-            return static::notice('Failed to generate member number', 400);//会员编号生成失败
+            return static::notice(Yii::t('app', 'failedToGenerateMemberNumber'), 400);
         }
         //随机码保存在redis中方便进行比对
         $redis->setex('key_'.$userName , 3600 , $userName);
@@ -526,7 +527,7 @@ class UserController extends BaseController {
             $userInfo['isLocation'] = '('.implode(',',$isLocation).')';
             return static::notice($userInfo);
         }else{
-            return static::notice('Member number does not exist', 400);//会员编号不存在
+            return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
         }
     }
 
@@ -563,7 +564,7 @@ class UserController extends BaseController {
             ];
             return static::notice($arr);
         }else{
-            return static::notice('Repeat sales Member No. does not exist', 400);//复消会员编号不存在
+            return static::notice(Yii::t('app', 'repeatSalesMemberNoDoesNotExist'), 400);
         }
     }
 
@@ -598,13 +599,13 @@ class UserController extends BaseController {
             $post = \Yii::$app->request->post();
             $form->scenario = 'modifyProfile';
             if ($form->load($post, '') && $result = $form->modifyProfile()){
-                return static::notice('Personal data modified successfully');//个人资料修改成功
+                return static::notice(Yii::t('app', 'personalDataModifiedSuccessfully'), 400);
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
 
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -616,12 +617,12 @@ class UserController extends BaseController {
             $form->scenario = 'modifyPassword';
             $post = \Yii::$app->request->post();
             if($form->load($post, '') && $result = $form->modifyPassword()){
-                return static::notice('Password modified successfully');//密码修改成功
+                return static::notice(Yii::t('app', 'passwordModifiedSuccessfully'), 400);
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
 
     /**
@@ -634,12 +635,12 @@ class UserController extends BaseController {
             $post = \Yii::$app->request->post();
             $form->userId = \Yii::$app->user->id;
             if($form->load($post, '') && $result = $form->modifyPasswordPay()){
-                return static::notice('Payment password modified successfully');  // 支付密码修改成功
+                return static::notice(Yii::t('app', 'passwordModifiedSuccessfully'), 400);
             } else {
                 return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
             }
         }
-        return static::notice('Illegal request', 400); // 非法请求
+        return static::notice(Yii::t('app', 'illegalRequest'), 400);
     }
     
     /**
@@ -676,10 +677,10 @@ class UserController extends BaseController {
             $insertUserName = strtoupper($post['insertUserName']);
             $getRedisUserName = $redis->get('key_' . $insertUserName);
             if (!$getRedisUserName){
-                return static::notice('Membership number expired',400); // 会员编号过期
+                return static::notice(Yii::t('app', 'memberNumberExpired'), 400);
             }
             if ($insertUserName != $getRedisUserName){
-                return static::notice('Member number does not conform to',400); // 会员编号不符合
+                return static::notice(Yii::t('app', 'memberNumberDoesNotConformTo'), 400);
             }
 
             $post['insertUserName'] = $insertUserName;
@@ -695,7 +696,7 @@ class UserController extends BaseController {
         // 只查询普通商品
         $allGoods = ShopGoods::find()->where("ID='375895243322691584'")->orderBy('SORT ASC')->asArray()->all();
         if (!$userName) {
-            return static::notice('Failed to generate member number', 400); // 会员编号生成失败
+            return static::notice(Yii::t('app', 'failedToGenerateMemberNumber'), 400);
         }
         //随机码保存在redis中方便进行比对
         $redis->setex('key_'.$userName , 3600 , $userName);
@@ -740,7 +741,7 @@ class UserController extends BaseController {
             $userInfo['REC_USER_NAME'] = $rec_user['USER_NAME'];
             return static::notice($userInfo);
         }else{
-            return static::notice('Member number does not exist', 400);//会员编号不存在
+            return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
         }
     }
 }

+ 19 - 19
frontendApi/modules/v1/models/LoginForm.php

@@ -134,33 +134,33 @@ class LoginForm extends Model
         try{
             $this->getUser();
             if(!$this->_user){
-                throw new Exception('The account does not exist'); // 账号不存在
+                throw new Exception(Yii::t('app', 'accountDoesNotExist'));
             }
 
             if (!$this->_user->validatePassword($this->password)) {
-                $this->_updateFailTimes($transaction,'The member name or password is incorrect'); // 用户名或密码错误
-                throw new Exception('The member name or password is incorrect'); // 用户名或密码错误
+                $this->_updateFailTimes($transaction,Yii::t('app', 'memberNameOrPasswordIncorrect'));
+                throw new Exception(Yii::t('app', 'memberNameOrPasswordIncorrect'));
             }
             // 找到会员的基本信息来判断其是否可登录
             if(!$this->_user['ALLOW_LOGIN']){
-                $this->_updateFailTimes($transaction,'Abnormal member code'); // 会员编号异常
-                throw new Exception('Abnormal member code'); // 会员编号异常
+                $this->_updateFailTimes($transaction,Yii::t('app', 'abnormalMemberCode'));
+                throw new Exception(Yii::t('app', 'abnormalMemberCode'));
             }
             if($this->_user['STATUS'] == Yii::$app->params['userStatus'][0]['value']){
-                $this->_updateFailTimes($transaction,'Member not activated'); // 会员未激活
-                throw new Exception('Member not activated'); // 会员未激活
+                $this->_updateFailTimes($transaction,Yii::t('app', 'memberNotActivated'));
+                throw new Exception(Yii::t('app', 'memberNotActivated'));
             } elseif($this->_user['STATUS'] == Yii::$app->params['userStatus'][2]['value']){
-                $this->_updateFailTimes($transaction,'The member has been cancelled'); // 会员已被注销
-                throw new Exception('The member has been cancelled'); // 会员已被注销
+                $this->_updateFailTimes($transaction,Yii::t('app', 'memberHasBeenCancelled'));
+                throw new Exception(Yii::t('app', 'memberHasBeenCancelled'));
             } elseif($this->_user['STATUS'] == Yii::$app->params['userStatus'][3]['value']){
-                $this->_updateFailTimes($transaction,'The member has been blacklisted'); // 会员已被列入黑名单
-                throw new Exception('The member has been blacklisted'); // 会员已被列入黑名单
+                $this->_updateFailTimes($transaction,Yii::t('app', 'memberHasBeenBlacklisted'));
+                throw new Exception(Yii::t('app', 'memberHasBeenBlacklisted'));
             } elseif($this->_user['STATUS'] == Yii::$app->params['userStatus'][9]['value']){
-                $this->_updateFailTimes($transaction,'The member has been permanently suspended'); // 会员已被永久关停
-                throw new Exception('The member has been permanently suspended'); // 会员已被永久关停
+                $this->_updateFailTimes($transaction,Yii::t('app', 'memberHasBeenPermanentlySuspended'));
+                throw new Exception(Yii::t('app', 'memberHasBeenPermanentlySuspended'));
             } elseif($this->_user['PART_FUNC_CLOSED'] == 1){
-                $this->_updateFailTimes($transaction,'Member part of the function is closed, unable to log in.'); // 会员部分功能关闭,无法登录
-                throw new Exception('Member part of the function is closed, unable to log in.'); // 会员部分功能关闭,无法登录
+                $this->_updateFailTimes($transaction,Yii::t('app', 'memberPartOfFunctionClosed'));
+                throw new Exception(Yii::t('app', 'memberPartOfFunctionClosed'));
             } elseif($this->_user['IS_MODIFY_PASSWORD'] == 1){
                 throw new Exception(self::ERROR_IS_MODIFY_PASSWORD);
             }
@@ -180,13 +180,13 @@ class LoginForm extends Model
 
                 if (!$this->_whetherBA) {
                     if (!User::updateAll($update, 'ID=:ID', ['ID' => $this->_user['ID']])) {
-                        $this->_updateFailTimes($transaction, 'Member APP device information update failed'); // 会员APP设备信息更新失败
-                        throw new Exception('Member APP device information update failed'); // 会员APP设备信息更新失败
+                        $this->_updateFailTimes($transaction, Yii::t('app', 'memberAppDeviceInformationUpdateFailed'));
+                        throw new Exception(Yii::t('app', 'memberAppDeviceInformationUpdateFailed'));
                     }
                 } else {
                     if (!BaUser::updateAll($update, 'ID=:ID', ['ID' => $this->_user['ID']])) {
-                        $this->_updateFailTimes($transaction, 'Member APP device information update failed'); // 会员APP设备信息更新失败
-                        throw new Exception('Member APP device information update failed'); // 会员APP设备信息更新失败
+                        $this->_updateFailTimes($transaction, Yii::t('app', 'memberAppDeviceInformationUpdateFailed'));
+                        throw new Exception(Yii::t('app', 'memberAppDeviceInformationUpdateFailed'));
                     }
                 }
             }