Explorar el Código

Merge branch 'master' of 192.168.30.132:MTP2.0/MTP20_IF

zou.yingbin hace 4 años
padre
commit
f7fce6f21c
Se han modificado 9 ficheros con 5636 adiciones y 4521 borrados
  1. 1 1
      config/config.xml
  2. 40 1
      controllers/erms3/customer.go
  3. 39 0
      controllers/user/user.go
  4. 1608 1279
      docs/docs.go
  5. 1608 1279
      docs/swagger.json
  6. 2252 1960
      docs/swagger.yaml
  7. 83 0
      models/account.go
  8. 1 1
      models/quote.go
  9. 4 0
      routers/router.go

+ 1 - 1
config/config.xml

@@ -5,7 +5,7 @@
     <DebugMode value="1"/>
   </WebSetting>
   <LogSetting>
-    <LogPath value="/home/pub/mtp2.0/log/queryservice"/>
+    <LogPath value="./log"/>
     <LogLevel value="5"/>
   </LogSetting>
   <DbSetting>

+ 40 - 1
controllers/erms3/customer.go

@@ -23,7 +23,7 @@ type AddUserInfoApplyReq struct {
 // @Summary 新增客户申请
 // @Produce json
 // @Security ApiKeyAuth
-// @Param jsonBody body AddUserInfoApplyReq true "申请参数"
+// @Param jsonBody body AddUserInfoApplyReq true "用户信息"
 // @Success 200 {object} app.Response
 // @Failure 500 {object} app.Response
 // @Router /Erms3/AddUserInfoApply [post]
@@ -55,6 +55,45 @@ func AddUserInfoApply(c *gin.Context) {
 	appG.Response(http.StatusOK, e.SUCCESS, "OK")
 }
 
+// ModifyUserInfoApplyReq 修改客户申请请求参数
+type ModifyUserInfoApplyReq struct {
+	models.Wskhuserinfo
+}
+
+// ModifyUserInfoApply 修改客户申请
+// @Summary 修改客户申请
+// @description 保存草稿(撤回)- { "userid": int, "userstate": 1 }  提交审核 - { "userid": int, "userstate": 2 }
+// @Produce json
+// @Security ApiKeyAuth
+// @Param jsonBody body ModifyUserInfoApplyReq true "用户信息"
+// @Success 200 {object} app.Response
+// @Failure 500 {object} app.Response
+// @Router /Erms3/ModifyUserInfoApply [post]
+// @Tags 风险管理v3
+func ModifyUserInfoApply(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req ModifyUserInfoApplyReq
+	err := appG.C.ShouldBindJSON(&req)
+	if err != nil {
+		logger.GetLogger().Errorf("ModifyUserInfoApply failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if err := models.UpdateWSKHUserInfo(req.Wskhuserinfo); err != nil {
+		// 执行失败
+		logger.GetLogger().Errorf("ModifyUserInfoApply failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_OPERATION_FAILED, nil)
+		return
+	}
+
+	// 执行成功
+	logger.GetLogger().Debugln("ModifyUserInfoApply successed: %v", "OK")
+	appG.Response(http.StatusOK, e.SUCCESS, "OK")
+}
+
 // QueryUserInfoAppliesReq 客户申请信息查询请求参数
 type QueryUserInfoAppliesReq struct {
 	app.PageInfo

+ 39 - 0
controllers/user/user.go

@@ -366,3 +366,42 @@ func AddMessageBoard(c *gin.Context) {
 	logger.GetLogger().Debugln("AddMessageBoard successed: %v", "ok")
 	appG.Response(http.StatusOK, e.SUCCESS, "")
 }
+
+// UpdateUserAccountStatusReq 更新用户状态请求参数
+type UpdateUserAccountStatusReq struct {
+	UserID        int `json:"userID" binding:"required"`
+	AccountStatus int `json:"accountStatus" binding:"required"`
+}
+
+// UpdateUserAccountStatus 更新用户状态
+// @Summary 更新用户状态
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userID query int true "用户ID"
+// @Param accountStatus query string true "账户状态 -  4:正常 6:注销(停用)"
+// @Success 200 {object} app.Response
+// @Failure 500 {object} app.Response
+// @Router /User/UpdateUserAccountStatus [post]
+// @Tags 用户信息
+func UpdateUserAccountStatus(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req UpdateUserAccountStatusReq
+	if err := appG.C.ShouldBind(&req); err != nil {
+		logger.GetLogger().Errorf("UpdateUserAccountStatus failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if err := models.UpdateUserAccountStatus(req.UserID, req.AccountStatus); err != nil {
+		// 执行失败
+		logger.GetLogger().Errorf("UpdateUserAccountStatus failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 执行成功
+	logger.GetLogger().Debugln("UpdateUserAccountStatus successed: %v", "ok")
+	appG.Response(http.StatusOK, e.SUCCESS, "")
+}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1608 - 1279
docs/docs.go


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1608 - 1279
docs/swagger.json


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 2252 - 1960
docs/swagger.yaml


+ 83 - 0
models/account.go

@@ -805,6 +805,76 @@ func InsertWSKHUserInfo(userinfo Wskhuserinfo) error {
 	return nil
 }
 
+// UpdateWSKHUserInfo 修改网上开户账户信息(客户资料申请)
+func UpdateWSKHUserInfo(userinfo Wskhuserinfo) error {
+	engine := db.GetEngine()
+
+	// 加密数据
+	key, _ := hex.DecodeString(utils.AESSecretKey)
+	// 证件号码
+	if len(userinfo.Cardnum) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Cardnum), key); err == nil {
+			userinfo.Cardnum = hex.EncodeToString(encrypted)
+		}
+	}
+	// 证件地址
+	if len(userinfo.Cardaddress) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Cardaddress), key); err == nil {
+			userinfo.Cardaddress = hex.EncodeToString(encrypted)
+		}
+	}
+	// 手机
+	if len(userinfo.Mobilephone) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Mobilephone), key); err == nil {
+			userinfo.Mobilephone = hex.EncodeToString(encrypted)
+		}
+	}
+	// 微信
+	if len(userinfo.Wechat) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Wechat), key); err == nil {
+			userinfo.Wechat = hex.EncodeToString(encrypted)
+		}
+	}
+	// 邮件
+	if len(userinfo.Email) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Email), key); err == nil {
+			userinfo.Email = hex.EncodeToString(encrypted)
+		}
+	}
+	// 银行帐号
+	if len(userinfo.Bankaccount) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Bankaccount), key); err == nil {
+			userinfo.Bankaccount = hex.EncodeToString(encrypted)
+		}
+	}
+	// 经纪人ID
+	if len(userinfo.Brokerid) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Brokerid), key); err == nil {
+			userinfo.Brokerid = hex.EncodeToString(encrypted)
+		}
+	}
+	// 登录帐号
+	if len(userinfo.Logincode) > 0 {
+		if encrypted, err := utils.AESEncrypt([]byte(userinfo.Logincode), key); err == nil {
+			userinfo.Logincode = hex.EncodeToString(encrypted)
+		}
+	}
+
+	// 修改数据
+	// 由于表的主键未定义成ID,所以这里需要用where来过滤
+	userID := userinfo.Userid
+	userinfo.Userid = 0
+	// m := make(map[string]interface{})
+	// j, _ := json.Marshal(userinfo)
+	// json.Unmarshal(j, &m)
+	// delete(m, "USERID")
+	if _, err := engine.Where("USERID = ?", userID).Update(&userinfo); err != nil {
+		return err
+	}
+
+	return nil
+}
+
 // GetWSKHUserInfos 获取开户信息列表
 func GetWSKHUserInfos(userName string) ([]Wskhuserinfo, error) {
 	engine := db.GetEngine()
@@ -837,3 +907,16 @@ func GetUserInfos(userName string) ([]Userinfo, error) {
 
 	return userInfos, nil
 }
+
+// UpdateUserAccountStatus 更新用户状态
+func UpdateUserAccountStatus(userID, accountStatus int) error {
+	engine := db.GetEngine()
+
+	if _, err := engine.Table("USERACCOUNT").
+		Where("USERID = ?", userID).
+		Update(map[string]interface{}{"ACCOUNTSTATUS": accountStatus}); err != nil {
+		return err
+	}
+
+	return nil
+}

+ 1 - 1
models/quote.go

@@ -51,7 +51,7 @@ type CycleData struct {
 
 // Quoteday 行情盘面
 type Quoteday struct {
-	Id                   int64   `xorm:"pk autoincr BIGINT(20)"`
+	ID                   int64   `xorm:"pk autoincr BIGINT(20)"`
 	Exchangedate         int64   `xorm:"not null BIGINT(20)"`
 	Goodscode            string  `xorm:"not null unique CHAR(10)"`
 	Exchangecode         int     `xorm:"INT(11)"`

+ 4 - 0
routers/router.go

@@ -77,6 +77,8 @@ func InitRouter() *gin.Engine {
 		userR.Use(token.Auth()).POST("/AddMessageBoard", user.AddMessageBoard)
 		// 获取用户账号信息
 		userR.Use(token.Auth()).GET("/GetUserAccount", user.GetUserAccount)
+		// 更新用户状态
+		userR.Use(token.Auth()).POST("/UpdateUserAccountStatus", user.UpdateUserAccountStatus)
 	}
 	// ************************ 资金账户 ************************
 	taAccountR := apiR.Group("TaAccount")
@@ -219,6 +221,8 @@ func InitRouter() *gin.Engine {
 		erms3R.GET("/QueryPendingAuditContract", erms3.QueryPendingAuditContract)
 		// 新增客户申请
 		erms3R.POST("/AddUserInfoApply", erms3.AddUserInfoApply)
+		// 修改客户申请
+		erms3R.POST("/ModifyUserInfoApply", erms3.ModifyUserInfoApply)
 		// 客户申请信息查询
 		erms3R.GET("/QueryUserInfoApplies", erms3.QueryUserInfoApplies)
 		// 待审核业务查询

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio