|
|
@@ -175,10 +175,8 @@ class UserBasicForm extends Model {
|
|
|
$transaction = $db->beginTransaction();
|
|
|
try {
|
|
|
$this->adminOperateLogger->beforeUpdate($userModel);
|
|
|
-// $userModel->NATION = $this->nation;
|
|
|
$userModel->REAL_NAME = $this->realName;
|
|
|
$userModel->MOBILE = $this->mobile;
|
|
|
-// $userModel->ID_CARD = $this->idCard;
|
|
|
$userModel->OPEN_BANK = $this->openBank;
|
|
|
$userModel->BANK_NO = $this->bankNo;
|
|
|
$userModel->BANK_ADDRESS = $this->bankAddress;
|
|
|
@@ -189,26 +187,30 @@ class UserBasicForm extends Model {
|
|
|
throw new Exception($userModel->getErrors());
|
|
|
}
|
|
|
|
|
|
- // 现金钱包余额转换
|
|
|
- $userWallet = UserWallet::findOne(['USER_ID' => $this->userId]);
|
|
|
- if ($userWallet && $userWallet->CASH > 0) {
|
|
|
- $userWallet->CASH = Tool::convertAmount($userWallet->CASH, $beforeCurrencyRate, $afterCurrencyRate);
|
|
|
- if (!$userWallet->save()) {
|
|
|
+ // 移民操作
|
|
|
+ if ($this->country != $beforeCountry) {
|
|
|
+ // 移民记录
|
|
|
+ $model = new UserImmigrant();
|
|
|
+ $model->ID = PageSnowFake::instance()->generateId();
|
|
|
+ $model->user_id = $this->userId;
|
|
|
+ $model->before_country_id = $beforeCountry;
|
|
|
+ $model->after_country_id = $this->country;
|
|
|
+ $model->period_num = Period::instance()->getNowPeriodNum();
|
|
|
+ $model->created_by = \Yii::$app->user->id;
|
|
|
+ if (!$model->save()) {
|
|
|
$transaction->rollBack();
|
|
|
- throw new Exception($userModel->getErrors());
|
|
|
+ throw new Exception(Form::formatErrorsForApi($model->getErrors()));
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- // 移民记录
|
|
|
- $model = new UserImmigrant();
|
|
|
- $model->ID = PageSnowFake::instance()->generateId();
|
|
|
- $model->user_id = $this->userId;
|
|
|
- $model->before_country_id = $beforeCountry;
|
|
|
- $model->after_country_id = $this->country;
|
|
|
- $model->period_num = Period::instance()->getNowPeriodNum();
|
|
|
- $model->created_by = \Yii::$app->user->id;
|
|
|
- if (!$model->save()) {
|
|
|
- throw new Exception(Form::formatErrorsForApi($model->getErrors()));
|
|
|
+ // 现金钱包余额转换
|
|
|
+ $userWallet = UserWallet::findOne(['USER_ID' => $this->userId]);
|
|
|
+ if ($userWallet && $userWallet->CASH > 0) {
|
|
|
+ $userWallet->CASH = Tool::convertAmount($userWallet->CASH, $beforeCurrencyRate, $afterCurrencyRate);
|
|
|
+ if (!$userWallet->save()) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ throw new Exception($userModel->getErrors());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$transaction->commit();
|
|
|
@@ -217,10 +219,8 @@ class UserBasicForm extends Model {
|
|
|
'optType' => 'Modification of Member information', // 修改会员资料
|
|
|
'userId' => $this->userId,
|
|
|
'userName' => $userModel->USER_NAME,
|
|
|
-// 'nation' => $this->nation,
|
|
|
'realName' => $this->realName,
|
|
|
'mobile' => $this->mobile,
|
|
|
-// 'idCard' => $this->idCard,
|
|
|
'openBank' => $this->openBank,
|
|
|
'bankNo' => $this->bankNo,
|
|
|
'bankAddress' => $this->bankAddress,
|