zhou.xiaoning пре 1 година
родитељ
комит
5906ff9e6b
11 измењених фајлова са 972 додато и 11 уклоњено
  1. 22 4
      controllers/sbyj/order.go
  2. 42 3
      controllers/user/user.go
  3. 223 0
      docs/docs.go
  4. 223 0
      docs/swagger.json
  5. 153 0
      docs/swagger.yaml
  6. 38 0
      models/account.go
  7. 23 0
      models/ermcpCommon.go
  8. 137 0
      models/ori.go
  9. 109 0
      models/sbyj.go
  10. 2 0
      routers/router.go
  11. 0 4
      services/asign/http.go

+ 22 - 4
controllers/sbyj/order.go

@@ -91,10 +91,10 @@ func QueryMyDeliveryofflinedetail(c *gin.Context) {
 // @Param    operatetype     query    int    false "操作类型 - 1:交收流程 2:付款流水"
 // @Param    deliverypaymode query    int    false "付款方式 - 1:线上支付2:线下支付 - 枚举deliveryPayMode"
 // @Param    confirmstatus   query    int    false "确认状态 - 1:未确认 2:已确认 - 枚举confirmStatus"
-// @Param    page            query    int    false "页码"
-// @Param    pagesize        query    int    false "每页条数"
+// @Param    page      query    int false "页码"
+// @Param    pagesize  query    int false "每页条数"
 // @Success  200             {array}  models.MyDeliveryofflineoperatelog
-// @Failure  500             {object} app.Response
+// @Failure  500       {object} app.Response
 // @Router   /sbyj/QueryMyDeliveryofflineoperatelog [get]
 // @Tags     水贝亿爵
 func QueryMyDeliveryofflineoperatelog(c *gin.Context) {
@@ -108,7 +108,7 @@ func QueryMyDeliveryofflineoperatelog(c *gin.Context) {
 // @Summary  查询我的订单
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    accountid query    int    true  "资金账户"
+// @Param    accountid query    int true  "资金账户"
 // @Param    tradedate query    string false "交易日(yyyyMMdd)"
 // @Param    goodsid   query    int    false "商品ID"
 // @Param    holderqty query    int    false "持仓数量"
@@ -124,3 +124,21 @@ func QueryTradeHolderDetailEx(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryTradeCloseDetails 查询我的终止订单
+// @Summary  查询我的终止订单
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    accountid query    int    true  "资金账户"
+// @Param    page            query    int    false "页码"
+// @Param    pagesize        query    int    false "每页条数"
+// @Success  200       {array}  models.TradeCloseDetail
+// @Failure  500             {object} app.Response
+// @Router   /sbyj/QueryTradeCloseDetails [get]
+// @Tags     水贝亿爵
+func QueryTradeCloseDetails(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.TradeCloseDetail{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}

+ 42 - 3
controllers/user/user.go

@@ -618,11 +618,11 @@ type UpdateUserHeadUrlReq struct {
 
 // UpdateUserHeadUrl 更新用户头像
 // @Summary  更新用户头像
-// @Produce json
+// @Produce  json
 // @Security ApiKeyAuth
 // @Param    data body     UpdateUserHeadUrlReq true "入参"
-// @Success  200           {object} app.Response
-// @Failure  500           {object} app.Response
+// @Success  200  {object} app.Response
+// @Failure  500  {object} app.Response
 // @Router   /User/UpdateUserHeadUrl [post]
 // @Tags     用户信息
 func UpdateUserHeadUrl(c *gin.Context) {
@@ -719,3 +719,42 @@ func GetTodayAccountConfigInfo(c *gin.Context) {
 	// 查询成功
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
+
+// UpdateUserInfoWechatAndEmailReq 更新用户微信和邮箱入参
+type UpdateUserInfoWechatAndEmailReq struct {
+	UserID int     `json:"userID" binding:"required"` // 用户ID
+	Wechat *string `json:"wechat"`                    // 微信号,如无必修改则不传,传空为清除微信号
+	Email  *string `json:"email"`                     // 邮箱地址,如无必修改则不传,传空为清除邮箱地址
+}
+
+// UpdateUserInfoWechatAndEmail 更新用户微信和邮箱
+// @Summary  更新用户微信和邮箱
+// @Produce json
+// @Security ApiKeyAuth
+// @Param    data body     UpdateUserInfoWechatAndEmailReq true "入参"
+// @Success  200           {object} app.Response
+// @Failure  500           {object} app.Response
+// @Router   /User/UpdateUserInfoWechatAndEmail [post]
+// @Tags     用户信息
+func UpdateUserInfoWechatAndEmail(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req UpdateUserInfoWechatAndEmailReq
+	if err := appG.C.ShouldBindJSON(&req); err != nil {
+		logger.GetLogger().Errorf("UpdateUserInfoWechatAndEmail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if err := models.UpdateUserInfoWechatAndEmail(req.Wechat, req.Email, req.UserID); err != nil {
+		// 执行失败
+		logger.GetLogger().Errorf("UpdateUserInfoWechatAndEmail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 执行成功
+	logger.GetLogger().Debugln("UpdateUserInfoWechatAndEmail successed:", "ok")
+	appG.Response(http.StatusOK, e.SUCCESS, "ok")
+}

+ 223 - 0
docs/docs.go

@@ -19412,6 +19412,47 @@ const docTemplate = `{
                 }
             }
         },
+        "/User/UpdateUserInfoWechatAndEmail": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "用户信息"
+                ],
+                "summary": "更新用户微信和邮箱",
+                "parameters": [
+                    {
+                        "description": "入参",
+                        "name": "data",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/user.UpdateUserInfoWechatAndEmailReq"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WRTrade/GetAllDeliveryGoods": {
             "get": {
                 "security": [
@@ -22537,6 +22578,60 @@ const docTemplate = `{
                 }
             }
         },
+        "/sbyj/QueryTradeCloseDetails": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "水贝亿爵"
+                ],
+                "summary": "查询我的终止订单",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.TradeCloseDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/sbyj/QueryTradeHolderDetailEx": {
             "get": {
                 "security": [
@@ -54724,6 +54819,114 @@ const docTemplate = `{
                 }
             }
         },
+        "models.TradeCloseDetail": {
+            "type": "object",
+            "required": [
+                "accountid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账号ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "closeid": {
+                    "description": "平仓明细ID(104+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "integer"
+                },
+                "closenum": {
+                    "description": "平仓数量(带单位)",
+                    "type": "string"
+                },
+                "closepl": {
+                    "description": "平仓盈亏 - 按持仓价计算",
+                    "type": "number"
+                },
+                "closeprice": {
+                    "description": "平仓价格",
+                    "type": "number"
+                },
+                "closeqty": {
+                    "description": "平仓数量",
+                    "type": "integer"
+                },
+                "closetime": {
+                    "description": "平仓时间",
+                    "type": "string"
+                },
+                "goodsfullname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "holderprice": {
+                    "description": "持仓价格",
+                    "type": "number"
+                },
+                "isconfirmexercise": {
+                    "description": "是否确认行权- 0:否 1:是",
+                    "type": "integer"
+                },
+                "ispreexercise": {
+                    "description": "是否预申报- 0:否 1:是",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "opennum": {
+                    "description": "开仓数量(带单位)",
+                    "type": "string"
+                },
+                "openprice": {
+                    "description": "建仓价格",
+                    "type": "number"
+                },
+                "opentradedate": {
+                    "description": "建仓成交单交易日",
+                    "type": "string"
+                },
+                "opentradeid": {
+                    "description": "关联建仓成交单号",
+                    "type": "integer"
+                },
+                "optiontype": {
+                    "description": "期权类型 - 1:认购(看涨) 2:认沽(看跌)",
+                    "type": "integer"
+                },
+                "preexerciseprice": {
+                    "description": "预申报价格",
+                    "type": "number"
+                },
+                "premium": {
+                    "description": "权利金 - [持仓单的权利金]",
+                    "type": "number"
+                },
+                "releasecredit": {
+                    "description": "释放授信金额",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号",
+                    "type": "integer"
+                },
+                "tradeproperty": {
+                    "description": "交易属性",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TradeHolderDetail": {
             "type": "object",
             "properties": {
@@ -63723,6 +63926,26 @@ const docTemplate = `{
                 }
             }
         },
+        "user.UpdateUserInfoWechatAndEmailReq": {
+            "type": "object",
+            "required": [
+                "userID"
+            ],
+            "properties": {
+                "email": {
+                    "description": "邮箱地址,如无必修改则不传,传空为清除邮箱地址",
+                    "type": "string"
+                },
+                "userID": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "wechat": {
+                    "description": "微信号,如无必修改则不传,传空为清除微信号",
+                    "type": "string"
+                }
+            }
+        },
         "zhongrong.GetUserInfoRsp": {
             "type": "object",
             "properties": {

+ 223 - 0
docs/swagger.json

@@ -19403,6 +19403,47 @@
                 }
             }
         },
+        "/User/UpdateUserInfoWechatAndEmail": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "用户信息"
+                ],
+                "summary": "更新用户微信和邮箱",
+                "parameters": [
+                    {
+                        "description": "入参",
+                        "name": "data",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/user.UpdateUserInfoWechatAndEmailReq"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WRTrade/GetAllDeliveryGoods": {
             "get": {
                 "security": [
@@ -22528,6 +22569,60 @@
                 }
             }
         },
+        "/sbyj/QueryTradeCloseDetails": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "水贝亿爵"
+                ],
+                "summary": "查询我的终止订单",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.TradeCloseDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/sbyj/QueryTradeHolderDetailEx": {
             "get": {
                 "security": [
@@ -54715,6 +54810,114 @@
                 }
             }
         },
+        "models.TradeCloseDetail": {
+            "type": "object",
+            "required": [
+                "accountid"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账号ID",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "方向 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "closeid": {
+                    "description": "平仓明细ID(104+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)",
+                    "type": "integer"
+                },
+                "closenum": {
+                    "description": "平仓数量(带单位)",
+                    "type": "string"
+                },
+                "closepl": {
+                    "description": "平仓盈亏 - 按持仓价计算",
+                    "type": "number"
+                },
+                "closeprice": {
+                    "description": "平仓价格",
+                    "type": "number"
+                },
+                "closeqty": {
+                    "description": "平仓数量",
+                    "type": "integer"
+                },
+                "closetime": {
+                    "description": "平仓时间",
+                    "type": "string"
+                },
+                "goodsfullname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "holderprice": {
+                    "description": "持仓价格",
+                    "type": "number"
+                },
+                "isconfirmexercise": {
+                    "description": "是否确认行权- 0:否 1:是",
+                    "type": "integer"
+                },
+                "ispreexercise": {
+                    "description": "是否预申报- 0:否 1:是",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "opennum": {
+                    "description": "开仓数量(带单位)",
+                    "type": "string"
+                },
+                "openprice": {
+                    "description": "建仓价格",
+                    "type": "number"
+                },
+                "opentradedate": {
+                    "description": "建仓成交单交易日",
+                    "type": "string"
+                },
+                "opentradeid": {
+                    "description": "关联建仓成交单号",
+                    "type": "integer"
+                },
+                "optiontype": {
+                    "description": "期权类型 - 1:认购(看涨) 2:认沽(看跌)",
+                    "type": "integer"
+                },
+                "preexerciseprice": {
+                    "description": "预申报价格",
+                    "type": "number"
+                },
+                "premium": {
+                    "description": "权利金 - [持仓单的权利金]",
+                    "type": "number"
+                },
+                "releasecredit": {
+                    "description": "释放授信金额",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号",
+                    "type": "integer"
+                },
+                "tradeproperty": {
+                    "description": "交易属性",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TradeHolderDetail": {
             "type": "object",
             "properties": {
@@ -63714,6 +63917,26 @@
                 }
             }
         },
+        "user.UpdateUserInfoWechatAndEmailReq": {
+            "type": "object",
+            "required": [
+                "userID"
+            ],
+            "properties": {
+                "email": {
+                    "description": "邮箱地址,如无必修改则不传,传空为清除邮箱地址",
+                    "type": "string"
+                },
+                "userID": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "wechat": {
+                    "description": "微信号,如无必修改则不传,传空为清除微信号",
+                    "type": "string"
+                }
+            }
+        },
         "zhongrong.GetUserInfoRsp": {
             "type": "object",
             "properties": {

+ 153 - 0
docs/swagger.yaml

@@ -23850,6 +23850,86 @@ definitions:
     - goodsname
     - marketid
     type: object
+  models.TradeCloseDetail:
+    properties:
+      accountid:
+        description: 账号ID
+        type: integer
+      buyorsell:
+        description: 方向 - 0:买 1:卖
+        type: integer
+      closeid:
+        description: 平仓明细ID(104+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+        type: integer
+      closenum:
+        description: 平仓数量(带单位)
+        type: string
+      closepl:
+        description: 平仓盈亏 - 按持仓价计算
+        type: number
+      closeprice:
+        description: 平仓价格
+        type: number
+      closeqty:
+        description: 平仓数量
+        type: integer
+      closetime:
+        description: 平仓时间
+        type: string
+      goodsfullname:
+        description: 商品名称
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      holderprice:
+        description: 持仓价格
+        type: number
+      isconfirmexercise:
+        description: 是否确认行权- 0:否 1:是
+        type: integer
+      ispreexercise:
+        description: 是否预申报- 0:否 1:是
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      opennum:
+        description: 开仓数量(带单位)
+        type: string
+      openprice:
+        description: 建仓价格
+        type: number
+      opentradedate:
+        description: 建仓成交单交易日
+        type: string
+      opentradeid:
+        description: 关联建仓成交单号
+        type: integer
+      optiontype:
+        description: 期权类型 - 1:认购(看涨) 2:认沽(看跌)
+        type: integer
+      preexerciseprice:
+        description: 预申报价格
+        type: number
+      premium:
+        description: 权利金 - [持仓单的权利金]
+        type: number
+      releasecredit:
+        description: 释放授信金额
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      tradeid:
+        description: 成交单号
+        type: integer
+      tradeproperty:
+        description: 交易属性
+        type: integer
+    required:
+    - accountid
+    type: object
   models.TradeHolderDetail:
     properties:
       accountid:
@@ -30592,6 +30672,20 @@ definitions:
     - headurl
     - userID
     type: object
+  user.UpdateUserInfoWechatAndEmailReq:
+    properties:
+      email:
+        description: 邮箱地址,如无必修改则不传,传空为清除邮箱地址
+        type: string
+      userID:
+        description: 用户ID
+        type: integer
+      wechat:
+        description: 微信号,如无必修改则不传,传空为清除微信号
+        type: string
+    required:
+    - userID
+    type: object
   zhongrong.GetUserInfoRsp:
     properties:
       customername:
@@ -42836,6 +42930,31 @@ paths:
       summary: 更新用户头像
       tags:
       - 用户信息
+  /User/UpdateUserInfoWechatAndEmail:
+    post:
+      parameters:
+      - description: 入参
+        in: body
+        name: data
+        required: true
+        schema:
+          $ref: '#/definitions/user.UpdateUserInfoWechatAndEmailReq'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/app.Response'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 更新用户微信和邮箱
+      tags:
+      - 用户信息
   /WRTrade/GetAllDeliveryGoods:
     get:
       produces:
@@ -44823,6 +44942,40 @@ paths:
       summary: 查询我的交收
       tags:
       - 水贝亿爵
+  /sbyj/QueryTradeCloseDetails:
+    get:
+      parameters:
+      - description: 资金账户
+        in: query
+        name: accountid
+        required: true
+        type: integer
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.TradeCloseDetail'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询我的终止订单
+      tags:
+      - 水贝亿爵
   /sbyj/QueryTradeHolderDetailEx:
     get:
       parameters:

+ 38 - 0
models/account.go

@@ -1271,3 +1271,41 @@ func UpdateUserHeadUrl(userID int, headurl string) error {
 
 	return nil
 }
+
+// UpdateUserInfoWechatAndEmail 更新用户微信号和邮箱地址
+func UpdateUserInfoWechatAndEmail(wechat, email *string, userid int) (err error) {
+	if wechat == nil && email == nil {
+		return
+	}
+
+	w := ""
+	if wechat != nil && len(*wechat) > 0 {
+		w, err = EncryptField(*wechat)
+		if err != nil {
+			return
+		}
+	}
+
+	u := ""
+	if email != nil && len(*email) > 0 {
+		u, err = EncryptField(*email)
+		if err != nil {
+			return
+		}
+	}
+
+	sql := "UPDATE userinfo SET"
+	if wechat != nil {
+		sql += fmt.Sprintf(" wechat='%v'", w)
+	}
+	if wechat == nil && email != nil {
+		sql += fmt.Sprintf(" email='%v'", u)
+	} else if wechat != nil && email != nil {
+		sql += fmt.Sprintf(" ,email='%v'", u)
+	}
+	sql += fmt.Sprintf(" WHERE userid=%v", userid)
+
+	_, err = db.GetEngine().Exec(sql)
+
+	return
+}

+ 23 - 0
models/ermcpCommon.go

@@ -9,6 +9,7 @@ package models
 
 import (
 	"encoding/hex"
+	"errors"
 	"fmt"
 	"math"
 	"mtp2_if/utils"
@@ -40,6 +41,28 @@ type PageJosn struct {
 	Total    int `json:"total"`    // 总条数
 }
 
+// EncryptField 加密字段
+func EncryptField(oriStr string) (result string, err error) {
+	if len(oriStr) == 0 {
+		err = errors.New("加密字段为空")
+		return
+	}
+
+	key := "0d299ce2d4105282f7471074cb0f9f9d"
+	key2, err := hex.DecodeString(key)
+	if err != nil {
+		return
+	}
+
+	dst, err := utils.AESEncrypt([]byte(oriStr), key2)
+	if err != nil {
+		return
+	}
+	result = hex.EncodeToString(dst)
+
+	return
+}
+
 // DecryptField 解密字段
 func DecryptField(oriStr string) string {
 	nLen := len(oriStr)

+ 137 - 0
models/ori.go

@@ -873,3 +873,140 @@ type Riskratiotype struct {
 func (r *Riskratiotype) TableName() string {
 	return "RISKRATIOTYPE"
 }
+
+// Tradeclosedetail 交易平仓明细表 - 导历史
+type Tradeclosedetail struct {
+	CLOSEID           int64     `json:"closeid" xorm:"CLOSEID"`                     // 平仓明细ID(104+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	TRADEID           int64     `json:"tradeid" xorm:"TRADEID"`                     // 成交单号
+	OPENTRADEID       int64     `json:"opentradeid" xorm:"OPENTRADEID"`             // 关联建仓成交单号
+	TRADEDATE         string    `json:"tradedate" xorm:"TRADEDATE"`                 // 交易日(yyyyMMdd)
+	MARKETID          int32     `json:"marketid" xorm:"MARKETID"`                   // 市场ID
+	GOODSID           int32     `json:"goodsid" xorm:"GOODSID"`                     // 商品ID
+	ACCOUNTID         int64     `json:"accountid" xorm:"ACCOUNTID"`                 // 账号ID
+	BUYORSELL         int32     `json:"buyorsell" xorm:"BUYORSELL"`                 // 方向 - 0:买 1:卖
+	OPENPRICE         float64   `json:"openprice" xorm:"OPENPRICE"`                 // 建仓价格
+	HOLDERPRICE       float64   `json:"holderprice" xorm:"HOLDERPRICE"`             // 持仓价格
+	CLOSEQTY          int64     `json:"closeqty" xorm:"CLOSEQTY"`                   // 平仓数量
+	CLOSEPRICE        float64   `json:"closeprice" xorm:"CLOSEPRICE"`               // 平仓价格
+	CLOSETIME         time.Time `json:"closetime" xorm:"CLOSETIME"`                 // 平仓时间
+	TRADEPROPERTY     int32     `json:"tradeproperty" xorm:"TRADEPROPERTY"`         // 交易属性
+	OPTIONTYPE        int32     `json:"optiontype" xorm:"OPTIONTYPE"`               // 期权类型 - 1:认购(看涨) 2:认沽(看跌)
+	PREMIUM           float64   `json:"premium" xorm:"PREMIUM"`                     // 权利金 - [持仓单的权利金]
+	ISPREEXERCISE     int32     `json:"ispreexercise" xorm:"ISPREEXERCISE"`         // 是否预申报- 0:否 1:是
+	PREEXERCISEPRICE  float64   `json:"preexerciseprice" xorm:"PREEXERCISEPRICE"`   // 预申报价格
+	ISCONFIRMEXERCISE int32     `json:"isconfirmexercise" xorm:"ISCONFIRMEXERCISE"` // 是否确认行权- 0:否 1:是
+	OPENTRADEDATE     string    `json:"opentradedate" xorm:"OPENTRADEDATE"`         // 建仓成交单交易日
+	RELEASECREDIT     float64   `json:"releasecredit" xorm:"RELEASECREDIT"`         // 释放授信金额
+	CLOSEPL           float64   `json:"closepl" xorm:"CLOSEPL"`                     // 平仓盈亏 - 按持仓价计算
+	CLOSEPL2          float64   `json:"closepl2" xorm:"CLOSEPL2"`                   // 平仓盈亏[逐笔] -  按建仓价计算
+}
+
+// TableName is TRADE_CLOSEDETAIL
+func (r *Tradeclosedetail) TableName() string {
+	return "TRADE_CLOSEDETAIL"
+}
+
+// Histradeclosedetail
+type Histradeclosedetail struct {
+	CLOSEID           int64     `json:"closeid" xorm:"CLOSEID"`                     //
+	TRADEID           int64     `json:"tradeid" xorm:"TRADEID"`                     //
+	OPENTRADEID       int64     `json:"opentradeid" xorm:"OPENTRADEID"`             //
+	TRADEDATE         string    `json:"tradedate" xorm:"TRADEDATE"`                 //
+	MARKETID          int32     `json:"marketid" xorm:"MARKETID"`                   //
+	GOODSID           int32     `json:"goodsid" xorm:"GOODSID"`                     //
+	ACCOUNTID         int64     `json:"accountid" xorm:"ACCOUNTID"`                 //
+	BUYORSELL         int32     `json:"buyorsell" xorm:"BUYORSELL"`                 //
+	OPENPRICE         float64   `json:"openprice" xorm:"OPENPRICE"`                 //
+	HOLDERPRICE       float64   `json:"holderprice" xorm:"HOLDERPRICE"`             //
+	CLOSEQTY          int64     `json:"closeqty" xorm:"CLOSEQTY"`                   //
+	CLOSEPRICE        float64   `json:"closeprice" xorm:"CLOSEPRICE"`               //
+	CLOSETIME         time.Time `json:"closetime" xorm:"CLOSETIME"`                 //
+	TRADEPROPERTY     int32     `json:"tradeproperty" xorm:"TRADEPROPERTY"`         //
+	OPTIONTYPE        int32     `json:"optiontype" xorm:"OPTIONTYPE"`               //
+	PREMIUM           float64   `json:"premium" xorm:"PREMIUM"`                     //
+	ISPREEXERCISE     int32     `json:"ispreexercise" xorm:"ISPREEXERCISE"`         //
+	PREEXERCISEPRICE  float64   `json:"preexerciseprice" xorm:"PREEXERCISEPRICE"`   //
+	ISCONFIRMEXERCISE int32     `json:"isconfirmexercise" xorm:"ISCONFIRMEXERCISE"` //
+	OPENTRADEDATE     string    `json:"opentradedate" xorm:"OPENTRADEDATE"`         //
+	RELEASECREDIT     float64   `json:"releasecredit" xorm:"RELEASECREDIT"`         //
+	HISTRADEDATE      string    `json:"histradedate" xorm:"HISTRADEDATE"`           //
+	ISVALIDDATA       int32     `json:"isvaliddata" xorm:"ISVALIDDATA"`             //
+	CLOSEPL           float64   `json:"closepl" xorm:"CLOSEPL"`                     //
+	CLOSEPL2          float64   `json:"closepl2" xorm:"CLOSEPL2"`                   //
+}
+
+// TableName is HIS_TRADE_CLOSEDETAIL
+func (r *Histradeclosedetail) TableName() string {
+	return "HIS_TRADE_CLOSEDETAIL"
+}
+
+// Userinfo 用户信息表
+type OriUserinfo struct {
+	USERID                   int64     `json:"userid" xorm:"USERID"`                                     // 用户ID
+	USERINFOTYPE             int32     `json:"userinfotype" xorm:"USERINFOTYPE"`                         // 用户信息类型 - 1:个人  2:企业
+	CUSTOMERNAME             string    `json:"customername" xorm:"CUSTOMERNAME"`                         // 客户名称(企业名称)
+	USERSTATUS               int32     `json:"userstatus" xorm:"USERSTATUS"`                             // 用户状态 - 1:正常 2:注销 3:停用
+	USERTYPE                 int32     `json:"usertype" xorm:"USERTYPE"`                                 // 账户类型 -  1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户 7:企业成员(云平台)
+	OPENMODE                 int32     `json:"openmode" xorm:"OPENMODE"`                                 // 开户方式 -  1:管理端开户 2:网上开户注册(会员官网) 3:微信开户 4:网页交易端注册 5:安卓手机端注册 6:苹果手机端注册 7:PC交易端注册 8:微信快速开户 9:支付宝快速开户 10:手机号快速开户
+	CARDTYPEID               int32     `json:"cardtypeid" xorm:"CARDTYPEID"`                             // 证件类型ID
+	CARDNUM                  string    `json:"cardnum" xorm:"CARDNUM"`                                   // 证件号码(加密存储)
+	HALFBODYPHOTOURL         string    `json:"halfbodyphotourl" xorm:"HALFBODYPHOTOURL"`                 // 半身照地址
+	CARDFRONTPHOTOURL        string    `json:"cardfrontphotourl" xorm:"CARDFRONTPHOTOURL"`               // 证件正面图片地址
+	CARDBACKPHOTOURL         string    `json:"cardbackphotourl" xorm:"CARDBACKPHOTOURL"`                 // 证件背面图片地址
+	BIZNATURE                int32     `json:"biznature" xorm:"BIZNATURE"`                               // 企业性质( 企业) - 1:国有控股企业 2:集体控股企业 3:私人控股企业 4:港澳台商控股企业 5:外商控股企业 6:其它
+	BIZSCOPE                 string    `json:"bizscope" xorm:"BIZSCOPE"`                                 // 企业经营范围(企业)
+	LEGALPERSONNAME          string    `json:"legalpersonname" xorm:"LEGALPERSONNAME"`                   // 法人姓名(企业)
+	CONTACTNAME              string    `json:"contactname" xorm:"CONTACTNAME"`                           // 联系人
+	SEX                      int32     `json:"sex" xorm:"SEX"`                                           // 用户性别  0: 女  1: 男
+	TELPHONE                 string    `json:"telphone" xorm:"TELPHONE"`                                 // 联系电话(加密存储)
+	MOBILE                   string    `json:"mobile" xorm:"MOBILE"`                                     // 手机号码(加密存储)
+	FAX                      string    `json:"fax" xorm:"FAX"`                                           // 传真(加密存储)
+	EMAIL                    string    `json:"email" xorm:"EMAIL"`                                       // 邮件(加密存储)
+	QQ                       string    `json:"qq" xorm:"QQ"`                                             // QQ(加密存储
+	WECHAT                   string    `json:"wechat" xorm:"WECHAT"`                                     // 微信(加密存储)
+	COUNTRYID                int32     `json:"countryid" xorm:"COUNTRYID"`                               // 国家
+	PROVINCEID               int32     `json:"provinceid" xorm:"PROVINCEID"`                             // 省
+	CITYID                   int32     `json:"cityid" xorm:"CITYID"`                                     // 市
+	DISTRICTID               int32     `json:"districtid" xorm:"DISTRICTID"`                             // 地区
+	COMPANY                  string    `json:"company" xorm:"COMPANY"`                                   // 公司(个人)
+	ADDRESS                  string    `json:"address" xorm:"ADDRESS"`                                   // 地址
+	POSTALCODE               string    `json:"postalcode" xorm:"POSTALCODE"`                             // 邮政编码
+	CREATETIME               time.Time `json:"createtime" xorm:"CREATETIME"`                             // 创建时间
+	CREATORID                int64     `json:"creatorid" xorm:"CREATORID"`                               // 创建人
+	MODIFIERTIME             time.Time `json:"modifiertime" xorm:"MODIFIERTIME"`                         // 修改时间
+	MODIFIERID               int64     `json:"modifierid" xorm:"MODIFIERID"`                             // 修改人
+	REMARK                   string    `json:"remark" xorm:"REMARK"`                                     // 备注
+	WSKHINFO                 string    `json:"wskhinfo" xorm:"WSKHINFO"`                                 // 开户申请信息(JSON)
+	SIGNPDFURL               string    `json:"signpdfurl" xorm:"SIGNPDFURL"`                             // 签约pdf文件
+	LEGALCARDFRONTPHOTOURL   string    `json:"legalcardfrontphotourl" xorm:"LEGALCARDFRONTPHOTOURL"`     // 法人身份证正面照地址
+	LEGALCARDBACKPHOTOURL    string    `json:"legalcardbackphotourl" xorm:"LEGALCARDBACKPHOTOURL"`       // 法人身份证背面照地址
+	OTHERURL                 string    `json:"otherurl" xorm:"OTHERURL"`                                 // 其它图片地址[使用分号分隔]
+	HASENCRYPT               int32     `json:"hasencrypt" xorm:"HASENCRYPT"`                             // 数据是否已加密 - 0:未加密 1:已加密
+	BANKNAME                 string    `json:"bankname" xorm:"BANKNAME"`                                 // 银行名称
+	BANKACCOUNT              string    `json:"bankaccount" xorm:"BANKACCOUNT"`                           // 银行帐号 (加密存储)
+	BANKCARDFRONTPHOTOURL    string    `json:"bankcardfrontphotourl" xorm:"BANKCARDFRONTPHOTOURL"`       // 银行卡正面照地址
+	NEEDINVOICE              int32     `json:"needinvoice" xorm:"NEEDINVOICE"`                           // 是否需要发票 - 0:不需要 1:需要
+	BANKID                   string    `json:"bankid" xorm:"BANKID"`                                     // 银行编码
+	ATTACHMENT1              string    `json:"attachment1" xorm:"ATTACHMENT1"`                           // 附件1
+	ATTACHMENT2              string    `json:"attachment2" xorm:"ATTACHMENT2"`                           // 附件2
+	BANKACCOUNTNAME          string    `json:"bankaccountname" xorm:"BANKACCOUNTNAME"`                   // 收款人名称
+	HEADURL                  string    `json:"headurl" xorm:"HEADURL"`                                   // 头像地址
+	NICKNAME                 string    `json:"nickname" xorm:"NICKNAME"`                                 // 昵称:默认为名称脱敏(张**) 或 手机号脱敏(139****9999)
+	MOBILE2                  string    `json:"mobile2" xorm:"MOBILE2"`                                   // 手机号码[明文-尚志]
+	BIZTYPE                  int32     `json:"biztype" xorm:"BIZTYPE"`                                   // 企业类型 - 1:进口/生产 2:销售 3:零售 4:运输 5:仓储
+	PROXYSTATEMENTURL        string    `json:"proxystatementurl" xorm:"PROXYSTATEMENTURL"`               // 授权委托书
+	CONTACTCARDFRONTPHOTOURL string    `json:"contactcardfrontphotourl" xorm:"CONTACTCARDFRONTPHOTOURL"` // 联系人证件正面图片地址
+	CONTACTCARDBACKPHOTOURL  string    `json:"contactcardbackphotourl" xorm:"CONTACTCARDBACKPHOTOURL"`   // 联系人证件背面图片地址
+	ATTACHMENT3              string    `json:"attachment3" xorm:"ATTACHMENT3"`                           // 附件3
+	ATTACHMENT4              string    `json:"attachment4" xorm:"ATTACHMENT4"`                           // 附件4
+	ATTACHMENT5              string    `json:"attachment5" xorm:"ATTACHMENT5"`                           // 附件5
+	TAXPAYERNUM              string    `json:"taxpayernum" xorm:"TAXPAYERNUM"`                           // 纳税人识别号
+	BIRTHDAY                 time.Time `json:"birthday" xorm:"BIRTHDAY"`                                 // 生日(个人:年月日)
+	MODIFYSRC                int32     `json:"modifysrc" xorm:"MODIFYSRC"`                               // 修改来源 - 1:管理端 2:终端
+	LOGINCODE                string    `json:"logincode" xorm:"LOGINCODE"`                               // 登录代码
+}
+
+// TableName is USERINFO
+func (r *OriUserinfo) TableName() string {
+	return "USERINFO"
+}

+ 109 - 0
models/sbyj.go

@@ -599,3 +599,112 @@ func (r *Tradeholderdetailex) GetDataByPage() (interface{}, error, int, int, int
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+type TradeCloseDetail struct {
+	CLOSEID           int64     `json:"closeid" xorm:"CLOSEID"`                                         // 平仓明细ID(104+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	TRADEID           int64     `json:"tradeid" xorm:"TRADEID"`                                         // 成交单号
+	OPENTRADEID       int64     `json:"opentradeid" xorm:"OPENTRADEID"`                                 // 关联建仓成交单号
+	TRADEDATE         string    `json:"tradedate" xorm:"TRADEDATE"`                                     // 交易日(yyyyMMdd)
+	MARKETID          int32     `json:"marketid" xorm:"MARKETID"`                                       // 市场ID
+	GOODSID           int32     `json:"goodsid" xorm:"GOODSID"`                                         // 商品ID
+	ACCOUNTID         int64     `json:"accountid" xorm:"ACCOUNTID" form:"accountid" binding:"required"` // 账号ID
+	BUYORSELL         int32     `json:"buyorsell" xorm:"BUYORSELL"`                                     // 方向 - 0:买 1:卖
+	OPENPRICE         float64   `json:"openprice" xorm:"OPENPRICE"`                                     // 建仓价格
+	HOLDERPRICE       float64   `json:"holderprice" xorm:"HOLDERPRICE"`                                 // 持仓价格
+	CLOSEQTY          int64     `json:"closeqty" xorm:"CLOSEQTY"`                                       // 平仓数量
+	CLOSEPRICE        float64   `json:"closeprice" xorm:"CLOSEPRICE"`                                   // 平仓价格
+	CLOSETIME         time.Time `json:"closetime" xorm:"CLOSETIME"`                                     // 平仓时间
+	TRADEPROPERTY     int32     `json:"tradeproperty" xorm:"TRADEPROPERTY"`                             // 交易属性
+	OPTIONTYPE        int32     `json:"optiontype" xorm:"OPTIONTYPE"`                                   // 期权类型 - 1:认购(看涨) 2:认沽(看跌)
+	PREMIUM           float64   `json:"premium" xorm:"PREMIUM"`                                         // 权利金 - [持仓单的权利金]
+	ISPREEXERCISE     int32     `json:"ispreexercise" xorm:"ISPREEXERCISE"`                             // 是否预申报- 0:否 1:是
+	PREEXERCISEPRICE  float64   `json:"preexerciseprice" xorm:"PREEXERCISEPRICE"`                       // 预申报价格
+	ISCONFIRMEXERCISE int32     `json:"isconfirmexercise" xorm:"ISCONFIRMEXERCISE"`                     // 是否确认行权- 0:否 1:是
+	OPENTRADEDATE     string    `json:"opentradedate" xorm:"OPENTRADEDATE"`                             // 建仓成交单交易日
+	RELEASECREDIT     float64   `json:"releasecredit" xorm:"RELEASECREDIT"`                             // 释放授信金额
+	CLOSEPL           float64   `json:"closepl" xorm:"CLOSEPL"`                                         // 平仓盈亏 - 按持仓价计算
+
+	GOODSFULLNAME string `json:"goodsfullname" xorm:"GOODSFULLNAME"` // 商品名称
+	OPENNUM       string `json:"opennum" xorm:"OPENNUM"`             // 开仓数量(带单位)
+	CLOSENUM      string `json:"closenum" xorm:"CLOSENUM"`           // 平仓数量(带单位)
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *TradeCloseDetail) calc() {
+
+}
+
+func (r *TradeCloseDetail) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select qt.opentradeid,
+       qt.closeid,
+       qt.accountid,
+       qt.goodsid,
+       qt.buyorsell,
+       qt.openqty,
+       qt.openprice,
+       qt.closeqty,
+       qt.closeprice,
+       qt.closepl,
+       qt.closetime,
+	g.goodscode || '/' || g.goodsname "goodsfullname",
+       qt.openqty * g.agreeunit || ' ' || en.enumdicname "opennum",
+       qt.closeqty * g.agreeunit || ' ' || en.enumdicname "closenum"
+  from (select cd.opentradeid,
+               cd.closeid,
+               cd.accountid,
+               cd.goodsid,
+               hd.buyorsell,
+               hd.openqty,
+               hd.openprice,
+               cd.closeqty,
+               cd.closeprice,
+               cd.closepl,
+               cd.closetime
+          from trade_closedetail cd
+         inner join trade_holderdetailex hd
+            on hd.tradeid = cd.opentradeid
+           and hd.accountid = cd.accountid
+         where cd.accountid = %v
+        union
+        select cd.opentradeid,
+               cd.closeid,
+               cd.accountid,
+               cd.goodsid,
+               hd.buyorsell,
+               hd.openqty,
+               hd.openprice,
+               cd.closeqty,
+               cd.closeprice,
+               cd.closepl,
+               cd.closetime
+          from his_trade_closedetail cd
+         inner join trade_holderdetailex hd
+            on hd.tradeid = cd.opentradeid
+           and hd.accountid = cd.accountid
+         where cd.isvaliddata = 1
+           and cd.accountid = %v) qt
+  left join goods g
+    on qt.goodsid = g.goodsid
+  left join enumdicitem en
+    on en.enumitemname = g.goodunitid
+   and en.enumdiccode = 'goodsunit'
+ order by qt.closeid desc
+	`
+	sqlId.FormatParam(r.ACCOUNTID, r.ACCOUNTID)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *TradeCloseDetail) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]TradeCloseDetail, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}

+ 2 - 0
routers/router.go

@@ -107,6 +107,7 @@ func InitRouter() *gin.Engine {
 		userR.Use(token.Auth()).GET("/LoginQuery", user.LoginQuery)
 
 		userR.Use(token.Auth()).POST("/UpdateUserHeadUrl", user.UpdateUserHeadUrl)
+		userR.Use(token.Auth()).POST("/UpdateUserInfoWechatAndEmail", user.UpdateUserInfoWechatAndEmail)
 
 		userR.Use(token.Auth()).GET("/QueryMdUserSwapProtocol", user.QueryMdUserSwapProtocol)
 		userR.Use(token.Auth()).GET("/GetTodayAccountConfigInfo", user.GetTodayAccountConfigInfo)
@@ -798,6 +799,7 @@ func InitRouter() *gin.Engine {
 		sbyjR.Use(token.Auth()).GET("QueryMyDeliveryofflinedetail", sbyj.QueryMyDeliveryofflinedetail)
 		sbyjR.Use(token.Auth()).GET("QueryMyDeliveryofflineoperatelog", sbyj.QueryMyDeliveryofflineoperatelog)
 		sbyjR.Use(token.Auth()).GET("QueryTradeHolderDetailEx", sbyj.QueryTradeHolderDetailEx)
+		sbyjR.Use(token.Auth()).GET("QueryTradeCloseDetails", sbyj.QueryTradeCloseDetails)
 	}
 
 	bankR := apiR.Group("Bank")

+ 0 - 4
services/asign/http.go

@@ -26,10 +26,6 @@ import (
 // HttpPost
 //
 //	爱签HttpPost请求方法
-// @param  apiUrl  接口地址
-// @param  bizData formData入参
-// @return rspBody response body数据
-// @return err 错误
 func HttpPost(apiUrl string, bizData map[string]interface{}) (rspBody []byte, err error) {
 	appId := config.SerCfg.AsignCfg.AppId
 	privateKey := fmt.Sprintf("-----BEGIN PRIVATE KEY-----\n%s\n-----END PRIVATE KEY-----", config.SerCfg.AsignCfg.PrivateKey)