Browse Source

修复产品风险等级

kobe6258 5 months ago
parent
commit
dcb52bd0f5
2 changed files with 13 additions and 3 deletions
  1. 2 0
      common/exception/exc_enums.go
  2. 11 3
      controllers/order/subscribe_controller.go

+ 2 - 0
common/exception/exc_enums.go

@@ -78,6 +78,7 @@ const (
 	RiskUnMatchError
 	OfficialUserFoundError
 	OfficialUserNotFound
+	IllegalAccountStatus
 	SubscribeFailed
 	GenerateOrderNoFailed
 	IllegalOrderNo
@@ -205,6 +206,7 @@ var ErrorMap = map[int]string{
 	RiskUnMatchError:                   "客户风险测评不匹配",
 	OfficialUserFoundError:             "获取正式用户信息失败",
 	OfficialUserNotFound:               "用户未开户",
+	IllegalAccountStatus:               "非法的开户状态",
 	SubscribeFailed:                    "订阅失败",
 	GenerateOrderNoFailed:              "生成订单号",
 	IllegalOrderNo:                     "非法的商品订单号",

+ 11 - 3
controllers/order/subscribe_controller.go

@@ -146,13 +146,21 @@ func (sc *SubscribeController) SubscribeProduct() {
 			}
 			return
 		}
-		//开户中
-		if officialUser.AccountStatus == "opening" {
+		switch officialUser.AccountStatus {
+		case "unopen":
+			result.Ret = AccountNotOpen
+			sc.FailedResult("用户未开通账户", result)
+			return
+		case "opening":
 			result.Ret = AccountOpening
 			sc.FailedResult("用户开户中", result)
 			return
+		case "opened":
+		default:
+			err = exception.New(exception.IllegalAccountStatus)
+			sc.FailedResult(result.Msg, result)
+			return
 		}
-
 		//证件信息是否过期
 		if !officialUser.IDValid {
 			result.Ret = IDExpired