Selaa lähdekoodia

1、海商报业PCWEB增加支持获取二维码配置;
2、企业风管增量获取商品信息接口优化;
3、修改其它BUG。

zhou.xiaoning 4 vuotta sitten
vanhempi
commit
612fe450d1

+ 2 - 1
config/cfg.j2

@@ -13,6 +13,7 @@
         "tradeHost": "{{access_internet_addr}}",
         "tradePort": "{{access_listen_port}}",
         "newsUrl": "{{news_url}}",
-        "hsbyBankSignZone": "08:00-18:00"
+        "hsbyBankSignZone": "08:00-18:00",
+        "hsbyPayUrlWeb": {{hsby_pay_url_web}}
         }
 }

+ 2 - 1
config/cfg.json

@@ -13,6 +13,7 @@
         "tradeHost": "192.168.31.104",
         "tradePort": "5001",
         "newsUrl": "http://www.baidu.com",
-        "hsbyBankSignZone": "08:00-18:00"
+        "hsbyBankSignZone": "08:00-18:00",
+        "hsbyPayUrlWeb": "http://192.168.21.71:9400/bank_scancode/getQrCode"
     }
 }

+ 1 - 1
config/config.xml

@@ -13,7 +13,7 @@
     <DbAddress value="192.168.31.117"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test171"/>
+    <DbUser value="mtp2_test104"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>

+ 3 - 3
controllers/ermcp/qryGoods.go

@@ -12,14 +12,14 @@ import (
 
 // GetErmcpGoodsReq 查询企业风管期货商品信息请求参数
 type GetErmcpGoodsReq struct {
-	LastID int `form:"lastID"`
+	LastUpdateTime string `form:"lastUpdateTime"`
 }
 
 // GetErmcpGoods 查询企业风管期货商品信息
 // @Summary 查询企业风管期货商品信息
 // @Produce json
 // @Security ApiKeyAuth
-// @Param lastID query int false "已存末尾商品编号"
+// @Param lastUpdateTime query string false "最后修改时间 - 闭区间,格式:yyyy-MM-dd HH:mm:ss"
 // @Success 200 {object} models.Goods
 // @Failure 500 {object} app.Response
 // @Router /Ermcp/GetErmcpGoods [get]
@@ -36,7 +36,7 @@ func GetErmcpGoods(c *gin.Context) {
 	}
 
 	// 获取数据
-	goodses, err := models.GetErmcpGoodses(req.LastID)
+	goodses, err := models.GetErmcpGoodses(req.LastUpdateTime)
 	if err != nil {
 		// 查询失败
 		logger.GetLogger().Errorf("GetErmcpGoods failed: %s", err.Error())

+ 0 - 36
controllers/user/login.go

@@ -50,39 +50,3 @@ func GetLoginID(c *gin.Context) {
 	// 找不到或查询错误,都把请求代码返回去
 	appG.Response(http.StatusOK, e.SUCCESS, req.UserName)
 }
-
-// type LoginQueryReq struct {
-// 	UserID int `form:"userID" binding:"required"`
-// }
-
-// type LoginQueryRsp struct {
-// 	UserAccount models.Useraccount `json:"userAccount"` // 账户信息
-// 	TaAccounts  []models.Taaccount `json:"taAccounts"`  // 资金账户列表
-
-// }
-
-// func LoginQuery(c *gin.Context) {
-// 	appG := app.Gin{C: c}
-
-// 	// 获取请求参数
-// 	var req LoginQueryReq
-// 	if err := appG.C.ShouldBindQuery(&req); err != nil {
-// 		logger.GetLogger().Errorf("LoginQuery failed: %s", err.Error())
-// 		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
-// 		return
-// 	}
-
-// 	var (
-// 		userAccount *models.Useraccount // 用户表信息
-// 		err         error
-// 	)
-
-// 	// 通过登录代码查询登录账号
-// 	if userAccount, err = models.GetUserAccount(req.UserID); err != nil {
-// 		// 查询失败
-// 		logger.GetLogger().Errorf("LoginQuery failed: %s", err.Error())
-// 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
-// 		return
-// 	}
-
-// }

+ 3 - 1
controllers/user/user.go

@@ -194,7 +194,7 @@ type LoginQueryRsp struct {
 	Markets           []models.Market           `json:"markets"`           // 市场
 	Goodsgroups       []models.Goodsgroup       `json:"goodsgroups"`       // 商品组
 	ExternalExchanges []models.Externalexchange `json:"externalExchanges"` // 外部交易所
-	SystemParams      []models.Systemparam      `json:"SystemParams"`      // 系统参数
+	SystemParams      []models.Systemparam      `json:"systemParams"`      // 系统参数
 }
 
 // LoginQuery 账户登录后信息查询
@@ -255,6 +255,7 @@ func LoginQuery(c *gin.Context) {
 	}
 	rsp.Markets = markets
 	// 商品组
+	rsp.Goodsgroups = make([]models.Goodsgroup, 0)
 	if len(rsp.Markets) > 0 {
 		marketIDs := make([]int, 0)
 		for _, v := range rsp.Markets {
@@ -270,6 +271,7 @@ func LoginQuery(c *gin.Context) {
 		rsp.Goodsgroups = goodsgroups
 	}
 	// 外部交易所
+	rsp.ExternalExchanges = make([]models.Externalexchange, 0)
 	if len(rsp.Goodsgroups) > 0 {
 		exchangeIDs := make([]int, 0)
 		for _, v := range rsp.Goodsgroups {

+ 10 - 10
docs/docs.go

@@ -806,9 +806,9 @@ var doc = `{
                 "summary": "查询企业风管期货商品信息",
                 "parameters": [
                     {
-                        "type": "integer",
-                        "description": "已存末尾商品编号",
-                        "name": "lastID",
+                        "type": "string",
+                        "description": "最后修改时间 - 闭区间,格式:yyyy-MM-dd HH:mm:ss",
+                        "name": "lastUpdateTime",
                         "in": "query"
                     }
                 ],
@@ -18633,13 +18633,6 @@ var doc = `{
         "user.LoginQueryRsp": {
             "type": "object",
             "properties": {
-                "SystemParams": {
-                    "description": "系统参数",
-                    "type": "array",
-                    "items": {
-                        "$ref": "#/definitions/models.Systemparam"
-                    }
-                },
                 "externalExchanges": {
                     "description": "外部交易所",
                     "type": "array",
@@ -18665,6 +18658,13 @@ var doc = `{
                         "$ref": "#/definitions/models.Market"
                     }
                 },
+                "systemParams": {
+                    "description": "系统参数",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.Systemparam"
+                    }
+                },
                 "userAccount": {
                     "description": "用户账号",
                     "$ref": "#/definitions/models.Useraccount"

+ 10 - 10
docs/swagger.json

@@ -790,9 +790,9 @@
                 "summary": "查询企业风管期货商品信息",
                 "parameters": [
                     {
-                        "type": "integer",
-                        "description": "已存末尾商品编号",
-                        "name": "lastID",
+                        "type": "string",
+                        "description": "最后修改时间 - 闭区间,格式:yyyy-MM-dd HH:mm:ss",
+                        "name": "lastUpdateTime",
                         "in": "query"
                     }
                 ],
@@ -18617,13 +18617,6 @@
         "user.LoginQueryRsp": {
             "type": "object",
             "properties": {
-                "SystemParams": {
-                    "description": "系统参数",
-                    "type": "array",
-                    "items": {
-                        "$ref": "#/definitions/models.Systemparam"
-                    }
-                },
                 "externalExchanges": {
                     "description": "外部交易所",
                     "type": "array",
@@ -18649,6 +18642,13 @@
                         "$ref": "#/definitions/models.Market"
                     }
                 },
+                "systemParams": {
+                    "description": "系统参数",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.Systemparam"
+                    }
+                },
                 "userAccount": {
                     "description": "用户账号",
                     "$ref": "#/definitions/models.Useraccount"

+ 8 - 8
docs/swagger.yaml

@@ -9173,11 +9173,6 @@ definitions:
     type: object
   user.LoginQueryRsp:
     properties:
-      SystemParams:
-        description: 系统参数
-        items:
-          $ref: '#/definitions/models.Systemparam'
-        type: array
       externalExchanges:
         description: 外部交易所
         items:
@@ -9196,6 +9191,11 @@ definitions:
         items:
           $ref: '#/definitions/models.Market'
         type: array
+      systemParams:
+        description: 系统参数
+        items:
+          $ref: '#/definitions/models.Systemparam'
+        type: array
       userAccount:
         $ref: '#/definitions/models.Useraccount'
         description: 用户账号
@@ -9699,10 +9699,10 @@ paths:
   /Ermcp/GetErmcpGoods:
     get:
       parameters:
-      - description: 已存末尾商品编号
+      - description: 最后修改时间 - 闭区间,格式:yyyy-MM-dd HH:mm:ss
         in: query
-        name: lastID
-        type: integer
+        name: lastUpdateTime
+        type: string
       produces:
       - application/json
       responses:

+ 31 - 5
models/ermcpGoods.go

@@ -2,21 +2,47 @@ package models
 
 // 企业风管期货商品相关
 
-import "mtp2_if/db"
+import (
+	"fmt"
+	"mtp2_if/db"
+	"time"
+)
 
 // GetErmcpGoodses 企业风管专用获取商品信息的方法
-func GetErmcpGoodses(lastID int) ([]Goods, error) {
+func GetErmcpGoodses(lastUpdateTime string) ([]Goods, error) {
 	engine := db.GetEngine()
 
 	goodses := make([]Goods, 0)
 	session := engine.Table("GOODS").Where("GOODSSTATUS = 3")
-	if lastID != 0 {
-		session = session.And("GOODSID > ?", lastID)
+	// if lastID != 0 {
+	// 	session = session.And("GOODSID > ?", lastID)
+	// }
+	// session = session.Asc("GOODSID")
+	if len(lastUpdateTime) != 0 {
+		session = session.And(fmt.Sprintf("MODIFYTIME > to_date('%s','yyyy-MM-dd hh24:mi:ss')", lastUpdateTime))
 	}
-	session = session.Asc("GOODSID")
 	if err := session.Find(&goodses); err != nil {
 		return nil, err
 	}
 
 	return goodses, nil
 }
+
+// GetGoodsLastUpdateTime 获取商品表最后更新(Update)时间
+func GetGoodsLastUpdateTime() (*time.Time, error) {
+	engine := db.GetEngine()
+
+	var lastUpdateTimes time.Time
+	sql := `SELECT VERSIONS_STARTTIME LASTUPDATETIME
+			FROM GOODS VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE WHERE
+			VERSIONS_STARTTIME IS NOT NULL and VERSIONS_OPERATION = 'U' order by LASTUPDATETIME desc`
+	has, err := engine.SQL(sql).Get(&lastUpdateTimes)
+	if err != nil {
+		return nil, err
+	}
+	if !has {
+		return nil, nil
+	}
+
+	return &lastUpdateTimes, nil
+}