|
|
@@ -73,8 +73,8 @@ class WithdrawForm extends Model {
|
|
|
return [
|
|
|
[['id', 'userName', 'realName', 'idCard', 'regType', 'applyAmount', 'payPassword', 'planPaidAt', 'auditStatus', 'createdAt', 'remark', 'createRemark', 'selectedIds', 'sn', 'withdrawPeriodNum', 'paidAt', 'paidFailRemark', 'amount', 'bankRealName', 'bankNo'], 'trim'],
|
|
|
[['id', 'userName', 'applyAmount', 'payPassword', 'auditStatus','withdrawCode','withdrawAudit'], 'required'],
|
|
|
- [['id'], 'exist', 'targetClass' => Withdraw::class, 'targetAttribute' => 'ID', 'message' => '提现申请不存在'],
|
|
|
- [['userName'], 'exist', 'targetClass' => UserInfo::class, 'targetAttribute' => 'USER_NAME', 'message' => '会员不存在'],
|
|
|
+ [['id'], 'exist', 'targetClass' => Withdraw::class, 'targetAttribute' => 'ID', 'message' => Yii::t('ctx', 'withdrawalApplyDoesNotExist')],
|
|
|
+ [['userName'], 'exist', 'targetClass' => UserInfo::class, 'targetAttribute' => 'USER_NAME', 'message' => Yii::t('ctx', 'memberDoesNotExist')],
|
|
|
[['applyAmount'], 'price'],
|
|
|
[['applyAmount'], 'isApplyAmount'],
|
|
|
[['userName'], 'isUserName'],
|
|
|
@@ -131,15 +131,15 @@ class WithdrawForm extends Model {
|
|
|
if ($this->scenario == 'addByAdmin') {
|
|
|
$baseInfo = Info::baseInfoZh($userInfo['USER_ID']);
|
|
|
if ($baseInfo['REAL_NAME'] != $this->realName || $baseInfo['ID_CARD'] != $this->idCard) {
|
|
|
- $this->addError($attributes, '输入的会员姓名或身份证号与系统不一致');
|
|
|
+ $this->addError($attributes, Yii::t('ctx', 'memberNameOrNumberInconsistentSystem'));
|
|
|
}
|
|
|
if ($userInfo['REG_TYPE'] != $this->regType) {
|
|
|
- $this->addError($attributes, '选择的会员注册类型与系统不一致');
|
|
|
+ $this->addError($attributes, Yii::t('ctx', 'memberRegisterTypeInconsistentWithSystem'));
|
|
|
}
|
|
|
}
|
|
|
$this->_userId = $userInfo['USER_ID'];
|
|
|
} else {
|
|
|
- $this->addError($attributes, $this->userName . 'Member does not exist'); // 会员不存在
|
|
|
+ $this->addError($attributes, $this->userName . Yii::t('ctx', 'memberDoesNotExist'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -151,10 +151,10 @@ class WithdrawForm extends Model {
|
|
|
public function isApplyAmount($attribute) {
|
|
|
$config = Cache::getSystemConfig();
|
|
|
if ($this->applyAmount <= 0) {
|
|
|
- $this->addError('scenario', '提现金额必须大于0');
|
|
|
+ $this->addError('scenario', Yii::t('ctx', 'withdrawalMustGreaterThanZero'));
|
|
|
}
|
|
|
if ((int)($this->applyAmount)!=$this->applyAmount) {
|
|
|
- $this->addError('scenario', '提现金额必须是整数');
|
|
|
+ $this->addError('scenario', Yii::t('ctx', 'withdrawalAmountMustInteger'));
|
|
|
}
|
|
|
$minAmount = 0;
|
|
|
$maxAmount = 0;
|
|
|
@@ -166,14 +166,14 @@ class WithdrawForm extends Model {
|
|
|
$userInfo = UserInfo::findOneAsArray(['USER_NAME' => $this->userName]);
|
|
|
$this->_userId = $userInfo['USER_ID'];
|
|
|
} else {
|
|
|
- $this->addError($attribute, '场景不存在');
|
|
|
+ $this->addError($attribute, Yii::t('ctx', 'sceneDoesNotExist'));
|
|
|
return false;
|
|
|
}
|
|
|
if ($minAmount != 0 && $this->applyAmount < $minAmount) {
|
|
|
- $this->addError($attribute, '提现金额不能少于' . $minAmount . '元');
|
|
|
+ $this->addError($attribute, Yii::t('ctx', 'withdrawalAmountCannotLessThan') . $minAmount . Yii::t('ctx', 'amountUnit'));
|
|
|
}
|
|
|
if ($maxAmount != 0 && $this->applyAmount > $maxAmount) {
|
|
|
- $this->addError($attribute, '提现金额不能高于' . $maxAmount . '元');
|
|
|
+ $this->addError($attribute, Yii::t('ctx', 'WithdrawalAmountCannotHigherThan') . $maxAmount . Yii::t('ctx', 'amountUnit'));
|
|
|
}
|
|
|
|
|
|
// 提现条件判断
|
|
|
@@ -186,7 +186,7 @@ class WithdrawForm extends Model {
|
|
|
// }
|
|
|
// 获取当前提现用户的金额
|
|
|
if ($this->applyAmount > Balance::getAvailableBalance($this->_userId)) {
|
|
|
- $this->addError('scenario', '提现金额必须小于的可用余额');
|
|
|
+ $this->addError('scenario', Yii::t('ctx', 'withdrawalAmountMustLessThanAvailableBalance'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -197,7 +197,7 @@ class WithdrawForm extends Model {
|
|
|
*/
|
|
|
public function validatePassword($attribute, $params) {
|
|
|
if (!User::validatePayPassword($this->_userId, $this->payPassword)) {
|
|
|
- $this->addError($attribute, 'The payment password is incorrect');//支付密码不正确
|
|
|
+ $this->addError($attribute, Yii::t('ctx', 'paymentPasswordIncorrect'));//支付密码不正确
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -206,7 +206,7 @@ class WithdrawForm extends Model {
|
|
|
$redisCode = \Yii::$app->redis->getset('withdrawCode_'.$uid,'');
|
|
|
\Yii::$app->redis->del('withdrawCode_'.$uid);
|
|
|
if ($this->withdrawCode!=$redisCode) {
|
|
|
- $this->addError($attribute, '申请提现校验失败');
|
|
|
+ $this->addError($attribute, Yii::t('ctx', 'failedApplyWithdrawalVerify'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -214,7 +214,7 @@ class WithdrawForm extends Model {
|
|
|
$adminId = \Yii::$app->user->id;
|
|
|
$redisCode = \Yii::$app->redis->getset('withdrawAudit_'.$adminId,'');
|
|
|
if ($this->withdrawAudit!=$redisCode) {
|
|
|
- $this->addError($attribute, '提现审核校验失败');
|
|
|
+ $this->addError($attribute, Yii::t('ctx', 'withdrawalAuditVerificationFailed'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -224,7 +224,7 @@ class WithdrawForm extends Model {
|
|
|
*/
|
|
|
public function isSelected($attributes) {
|
|
|
if (!$this->selectedIds) {
|
|
|
- $this->addError($attributes, 'A piece of data must be selected'); // 必须选择一条数据
|
|
|
+ $this->addError($attributes, Yii::t('ctx', 'aPieceMustBeSelected')); // 必须选择一条数据
|
|
|
}
|
|
|
if (!is_array($this->selectedIds)) {
|
|
|
$this->selectedIds = [$this->selectedIds];
|
|
|
@@ -244,7 +244,7 @@ class WithdrawForm extends Model {
|
|
|
*/
|
|
|
public function isPlanPaidAt($attribute) {
|
|
|
if (Date::utcToTime($this->planPaidAt) < Date::nowTime()) {
|
|
|
- $this->addError($attribute, '不能选择过去的日期');
|
|
|
+ $this->addError($attribute, Yii::t('ctx', 'cannotSelectDateInThePast'));
|
|
|
}
|
|
|
}
|
|
|
|