Bladeren bron

修改“ 查询敞口期货头寸期货明细”路由BUG

zhou.xiaoning 4 jaren geleden
bovenliggende
commit
3ad8723235
4 gewijzigde bestanden met toevoegingen van 26 en 7 verwijderingen
  1. 6 6
      config/config.xml
  2. 3 1
      controllers/ermcp/qryExposure.go
  3. 16 0
      models/account.go
  4. 1 0
      routers/router.go

+ 6 - 6
config/config.xml

@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.117"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test171"/>
+    <DbUser value="mtp2_test125"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.171"/>
+    <Address value="192.168.30.125"/>
     <Port value="5007"/>
     <Timeout value="3"/>
     <ConnNum value="1"/>
@@ -25,11 +25,11 @@
     <Pwd value=""/>
   </RedisSetting>
   <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.171:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.30.125:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.171"/>
+    <HostName value="192.168.30.125"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.140"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test171"/>
-    <Username value="root"/>
+    <DBName value="historyquote_test125"/>
+    <Username value="quote_test125"/>
     <Password value="123456"/>
   </MySQLSetting>
 </Configuration>

+ 3 - 1
controllers/ermcp/qryExposure.go

@@ -7,12 +7,13 @@
 package ermcp
 
 import (
-	"github.com/gin-gonic/gin"
 	"mtp2_if/global/app"
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
 	"mtp2_if/models"
 	"net/http"
+
+	"github.com/gin-gonic/gin"
 )
 
 //敞口相关查询
@@ -253,6 +254,7 @@ type ExposureHedgePosDetailReq struct {
 // 期货明细应答
 type ExposureHedgePosDetailRsp models.ErmcpHedgePositionDetail
 
+// QueryExposureHedgePositionDetail 查询敞口期货头寸期货明细
 // @Summary 查询敞口期货头寸期货明细(菜单:敞口/期货头寸/期货明细)
 // @Produce json
 // @Security ApiKeyAuth

+ 16 - 0
models/account.go

@@ -912,12 +912,28 @@ func GetUserInfos(userName string) ([]Userinfo, error) {
 func UpdateUserAccountStatus(userID, accountStatus int) error {
 	engine := db.GetEngine()
 
+	if accountStatus != 4 && accountStatus != 6 {
+		return errors.New("错误的状态值")
+	}
+
+	// 要同时改UserAccount表和UserInfo表的状态
 	useraccount := Useraccount{Accountstatus: int32(accountStatus)}
 	if _, err := engine.Table("USERACCOUNT").
 		Where("USERID = ?", userID).
 		Update(&useraccount); err != nil {
 		return err
 	}
+	// UserInfo表的状态为1-正常;2-注销
+	userStatus := 1
+	if accountStatus == 6 {
+		userStatus = 2
+	}
+	userinfo := Userinfo{Userstatus: int32(userStatus)}
+	if _, err := engine.Table("USERINFO").
+		Where("USERID = ?", userID).
+		Update(&userinfo); err != nil {
+		return err
+	}
 
 	return nil
 }

+ 1 - 0
routers/router.go

@@ -349,6 +349,7 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/QryReportDaySpotDetail", ermcp.QryReportDaySpotDetail)
 		ermcpR.GET("/QryReportMonthSpot", ermcp.QryReportMonthSpot)
 		ermcpR.GET("/QryReportMonthSpotDetail", ermcp.QryReportMonthSpotDetail)
+		ermcpR.GET("/QueryExposureHedgePositionDetail", ermcp.QueryExposureHedgePositionDetail)
 	}
 
 	return r