Преглед на файлове

更新Swagger;更换部分接口路由

Simon Zhou преди 5 години
родител
ревизия
2ef0209a81
променени са 9 файла, в които са добавени 269 реда и са изтрити 26 реда
  1. 3 3
      config/config.xml
  2. 2 2
      controllers/common/table.go
  3. 3 3
      controllers/user/login.go
  4. 58 0
      controllers/user/user.go
  5. 38 4
      docs/docs.go
  6. 38 4
      docs/swagger.json
  7. 26 4
      docs/swagger.yaml
  8. 94 0
      models/accountModels.go
  9. 7 6
      routers/router.go

+ 3 - 3
config/config.xml

@@ -7,7 +7,7 @@
     </WebSetting>
 
     <LogSetting>
-        <LogPath value="log/mtp2_if"/>
+        <LogPath value="log"/>
         <LogLevel value="5"/>
     </LogSetting>
 
@@ -16,12 +16,12 @@
         <DbAddress value="192.168.31.117"/>
         <DbName    value="orcl"/>
         <DbPort    value="1521"/>
-        <DbUser    value="mtp2_test104"/>
+        <DbUser    value="mtp2_test16"/>
         <DbPwd     value="muchinfo"/>
     </DbSetting>
 
     <RedisSetting>
-        <Address   value="192.168.31.104"/>
+        <Address   value="192.168.30.213"/>
         <Port      value="5007"/>
         <Timeout   value="3"/>
         <ConnNum   value="1"/>

+ 2 - 2
controllers/common/table.go

@@ -74,7 +74,7 @@ type OperationTabMenu struct {
 // @Success 200 {object} QueryTraderMenuRsp
 // @Failure 500 {object} app.Response
 // @Router /Common/QueryTraderMenu [get]
-// @Tags 通用
+// @Tags 通用服务
 func QueryTraderMenu(c *gin.Context) {
 	appG := app.Gin{C: c}
 
@@ -292,7 +292,7 @@ type QueryTableColumnConfigReq struct {
 // @Success 200 {object} models.Tablecolumnconfig
 // @Failure 500 {object} app.Response
 // @Router /Common/QueryTableColumnConfig [get]
-// @Tags 通用
+// @Tags 通用服务
 func QueryTableColumnConfig(c *gin.Context) {
 	appG := app.Gin{C: c}
 

+ 3 - 3
controllers/login/login.go → controllers/user/login.go

@@ -1,4 +1,4 @@
-package login
+package user
 
 import (
 	"fmt"
@@ -23,8 +23,8 @@ type GetLoginIDReq struct {
 // @Param username query string true "登录代码"
 // @Success 200 {object} app.Response
 // @Failure 500 {object} app.Response
-// @Router /Login/GetLoginID [get]
-// @Tags 登录
+// @Router /User/GetLoginID [get]
+// @Tags 用户信息
 func GetLoginID(c *gin.Context) {
 	appG := app.Gin{C: c}
 

+ 58 - 0
controllers/user/user.go

@@ -0,0 +1,58 @@
+package user
+
+import (
+	"fmt"
+	"mtp2_if/db"
+	"mtp2_if/global/app"
+	"mtp2_if/global/e"
+	"mtp2_if/logger"
+	"mtp2_if/models"
+	"net/http"
+
+	"github.com/gin-gonic/gin"
+)
+
+// QueryUserReferNumReq 获取用户邀请码请求参数
+type QueryUserReferNumReq struct {
+	UserID string `form:"userID" binding:"required"`
+}
+
+// QueryUserReferNum 获取用户邀请码
+// @Summary 获取用户邀请码
+// @Produce json
+// @Param username query string true "登录代码"
+// @Success 200 {object} app.Response
+// @Failure 500 {object} app.Response
+// @Router /User/QueryUserReferNum [get]
+// @Tags 用户信息
+func QueryUserReferNum(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req GetLoginIDReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryPreasleApply failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 查询数据
+	engine := db.GetEngine()
+	var loginaccount models.Loginaccount
+
+	loginid := req.UserName // 如果找不到,则直接把登录代码返回去
+	has, err := engine.Where("Logincode = ?", req.UserName).Get(&loginaccount)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("GetLoginID failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+	if has {
+		loginid = fmt.Sprintf("%v", loginaccount.Loginid)
+	}
+
+	// 查询成功
+	logger.GetLogger().Infof("GetLoginID successed: %v", loginaccount)
+	appG.Response(http.StatusOK, e.SUCCESS, loginid)
+}

+ 38 - 4
docs/docs.go

@@ -375,7 +375,7 @@ var doc = `{
                     "application/json"
                 ],
                 "tags": [
-                    "通用"
+                    "通用服务"
                 ],
                 "summary": "查询交易端列表头信息",
                 "parameters": [
@@ -408,7 +408,7 @@ var doc = `{
                     "application/json"
                 ],
                 "tags": [
-                    "通用"
+                    "通用服务"
                 ],
                 "summary": "查询交易端菜单",
                 "parameters": [
@@ -615,13 +615,13 @@ var doc = `{
                 }
             }
         },
-        "/Login/GetLoginID": {
+        "/User/GetLoginID": {
             "get": {
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
-                    "登录"
+                    "用户信息"
                 ],
                 "summary": "获取登录ID",
                 "parameters": [
@@ -649,6 +649,40 @@ var doc = `{
                 }
             }
         },
+        "/User/QueryUserReferNum": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "用户信息"
+                ],
+                "summary": "获取用户邀请码",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "登录代码",
+                        "name": "username",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WRTrade/GetAllDeliveryGoods": {
             "get": {
                 "security": [

+ 38 - 4
docs/swagger.json

@@ -359,7 +359,7 @@
                     "application/json"
                 ],
                 "tags": [
-                    "通用"
+                    "通用服务"
                 ],
                 "summary": "查询交易端列表头信息",
                 "parameters": [
@@ -392,7 +392,7 @@
                     "application/json"
                 ],
                 "tags": [
-                    "通用"
+                    "通用服务"
                 ],
                 "summary": "查询交易端菜单",
                 "parameters": [
@@ -599,13 +599,13 @@
                 }
             }
         },
-        "/Login/GetLoginID": {
+        "/User/GetLoginID": {
             "get": {
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
-                    "登录"
+                    "用户信息"
                 ],
                 "summary": "获取登录ID",
                 "parameters": [
@@ -633,6 +633,40 @@
                 }
             }
         },
+        "/User/QueryUserReferNum": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "用户信息"
+                ],
+                "summary": "获取用户邀请码",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "登录代码",
+                        "name": "username",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WRTrade/GetAllDeliveryGoods": {
             "get": {
                 "security": [

+ 26 - 4
docs/swagger.yaml

@@ -1468,7 +1468,7 @@ paths:
             $ref: '#/definitions/app.Response'
       summary: 查询交易端列表头信息
       tags:
-      - 通用
+      - 通用服务
   /Common/QueryTraderMenu:
     get:
       parameters:
@@ -1490,7 +1490,7 @@ paths:
             $ref: '#/definitions/app.Response'
       summary: 查询交易端菜单
       tags:
-      - 通用
+      - 通用服务
   /Delivery/QueryDeliveryRelation:
     get:
       parameters:
@@ -1602,7 +1602,7 @@ paths:
       summary: 查询现货合同表信息(指定策略ID、未结束的)
       tags:
       - 风险管理
-  /Login/GetLoginID:
+  /User/GetLoginID:
     get:
       parameters:
       - description: 登录代码
@@ -1623,7 +1623,29 @@ paths:
             $ref: '#/definitions/app.Response'
       summary: 获取登录ID
       tags:
-      - 登录
+      - 用户信息
+  /User/QueryUserReferNum:
+    get:
+      parameters:
+      - description: 登录代码
+        in: query
+        name: username
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/app.Response'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      summary: 获取用户邀请码
+      tags:
+      - 用户信息
   /WRTrade/GetAllDeliveryGoods:
     get:
       produces:

+ 94 - 0
models/accountModels.go

@@ -117,3 +117,97 @@ type Taaccountmarket struct {
 func (Taaccountmarket) TableName() string {
 	return "TAACCOUNTMARKET"
 }
+
+// Useraccount 用户表
+type Useraccount struct {
+	Userid           uint64    `json:"userid"  xorm:"'USERID'" binding:"required"`  // 用户ID
+	Usertype         uint32    `json:"usertype"  xorm:"'USERTYPE'"`                 // 账户类型 -  1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户
+	Accountname      string    `json:"accountname"  xorm:"'ACCOUNTNAME'"`           // 账户名称(机构名称)
+	Parentuserid     uint64    `json:"parentuserid"  xorm:"'PARENTUSERID'"`         // 所属机构ID
+	Broker           uint64    `json:"broker"  xorm:"'BROKER'"`                     // 所属经纪人ID
+	Subarealevelpath string    `json:"subarealevelpath"  xorm:"'SUBAREALEVELPATH'"` // 子机构层级路径(逗号分隔,首尾加逗号)
+	Refereeuserid    uint64    `json:"refereeuserid"  xorm:"'REFEREEUSERID'"`       // 推荐人ID
+	Memberuserid     uint64    `json:"memberuserid"  xorm:"'MEMBERUSERID'"`         // 所属会员ID
+	Accountstatus    uint32    `json:"accountstatus"  xorm:"'ACCOUNTSTATUS'"`       // 账户状态 -  1:待激活 2:待审核 3:待复审 4:正常 5:审核拒绝 6:注销
+	Reckonaccountid  uint64    `json:"reckonaccountid"  xorm:"'RECKONACCOUNTID'"`   // 默认结算资金账号ID(机构分润使用) 作废
+	Modifystatus     uint32    `json:"modifystatus"  xorm:"'MODIFYSTATUS'"`         // 变更状态 1 未变更 2 变更中 3 变更待审核 4 变更待复核(投资者)
+	Createtime       time.Time `json:"createtime"  xorm:"'CREATETIME'"`             // 创建时间
+	Creatorid        uint64    `json:"creatorid"  xorm:"'CREATORID'"`               // 创建人
+	Audittime        time.Time `json:"audittime"  xorm:"'AUDITTIME'"`               // 审核时间
+	Audituserid      uint64    `json:"audituserid"  xorm:"'AUDITUSERID'"`           // 审核人
+	Auditremark      string    `json:"auditremark"  xorm:"'AUDITREMARK'"`           // 审核备注
+	Canceltime       time.Time `json:"canceltime"  xorm:"'CANCELTIME'"`             // 销户时间
+	Canceluserid     uint64    `json:"canceluserid"  xorm:"'CANCELUSERID'"`         // 销户人
+	Modifytime       time.Time `json:"modifytime"  xorm:"'MODIFYTIME'"`             // 修改时间
+	Modifierid       uint64    `json:"modifierid"  xorm:"'MODIFIERID'"`             // 修改人
+	Modifyremark     string    `json:"modifyremark"  xorm:"'MODIFYREMARK'"`         // 变更备注
+	Maxinvestornum   uint64    `json:"maxinvestornum"  xorm:"'MAXINVESTORNUM'"`     // 最大用户数(经纪会员下投资者个数)
+	Hasauth          uint32    `json:"hasauth"  xorm:"'HASAUTH'"`                   // 是否已实名认证 - 0:未认证 1:已认证 2:已提交(待审核) 3:已拒绝
+	Refercount       uint32    `json:"refercount"  xorm:"'REFERCOUNT'"`             // 推荐总人数
+	Refernum         string    `json:"refernum"  xorm:"'REFERNUM'"`                 // 推荐码
+}
+
+// TableName is USERACCOUNT
+func (Useraccount) TableName() string {
+	return "USERACCOUNT"
+}
+
+// Userinfo 用户信息表
+type Userinfo struct {
+	Userid                 uint64    `json:"userid"  xorm:"'USERID'" binding:"required"`              // 用户ID
+	Userinfotype           uint32    `json:"userinfotype"  xorm:"'USERINFOTYPE'"`                     // 用户信息类型 - 1:个人  2:企业
+	Customername           string    `json:"customername"  xorm:"'CUSTOMERNAME'"`                     // 客户名称(企业名称)
+	Userstatus             uint32    `json:"userstatus"  xorm:"'USERSTATUS'"`                         // 用户状态 - 1:正常 2:注销
+	Usertype               uint32    `json:"usertype"  xorm:"'USERTYPE'"`                             // 账户类型 -  1:交易所 2:机构 3:会员子机构 4:经纪人 5:投资者 6:客户
+	Openmode               uint32    `json:"openmode"  xorm:"'OPENMODE'"`                             // 开户方式 -  1:管理端开户 2:网上开户注册(会员官网) 3:微信开户 4:网页交易端注册 5:安卓手机端注册 6:苹果手机端注册 7:PC交易端注册 8:微信快速开户 9:支付宝快速开户 10:手机号快速开户
+	Cardtypeid             uint32    `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              uint32    `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                    uint32    `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              uint32    `json:"countryid"  xorm:"'COUNTRYID'"`                           // 国家
+	Provinceid             uint32    `json:"provinceid"  xorm:"'PROVINCEID'"`                         // 省
+	Cityid                 uint32    `json:"cityid"  xorm:"'CITYID'"`                                 // 市
+	Districtid             uint32    `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              uint64    `json:"creatorid"  xorm:"'CREATORID'"`                           // 创建人
+	Modifiertime           time.Time `json:"modifiertime"  xorm:"'MODIFIERTIME'"`                     // 修改时间
+	Modifierid             uint64    `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             uint32    `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            uint32    `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'"`                               // 手机号码[明文-尚志]
+}
+
+// TableName is USERINFO
+func (Userinfo) TableName() string {
+	return "USERINFO"
+}

+ 7 - 6
routers/router.go

@@ -6,7 +6,7 @@ import (
 	"mtp2_if/controllers/cptrade"
 	"mtp2_if/controllers/delivery"
 	"mtp2_if/controllers/erms2"
-	"mtp2_if/controllers/login"
+	"mtp2_if/controllers/user"
 	"mtp2_if/controllers/wrtrade"
 	"mtp2_if/logger"
 	"mtp2_if/token"
@@ -39,13 +39,14 @@ func InitRouter() *gin.Engine {
 	// 主业务路由分组
 	apiR := r.Group("/api")
 	// apiR.Use(token.Auth())
-	// ************************ 账号登录 ************************
-	loginR := apiR.Group("Login")
-	loginR.Use()
+	// ************************ 账户信息 ************************
+	userR := apiR.Group("User")
+	userR.Use()
 	{
-		loginR.GET("/GetLoginID", login.GetLoginID)
+		// 获取登录ID
+		userR.GET("/GetLoginID", user.GetLoginID)
 	}
-	// ************************ 通用功能 ************************
+	// ************************ 通用服务 ************************
 	commonR := apiR.Group("Common")
 	commonR.Use()
 	{