From 7c072a125b6eaf6c8dcfaf9ecedba3cea08db092 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 26 Aug 2024 16:35:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/md/agent_bank_info.go | 10 ++--- app/md/agent_contact_info.go | 8 ++-- app/md/agent_list.go | 24 +++++------ app/svc/svc_qualification.go | 82 +++++++++++++++++++++++++++++------- docs/docs.go | 42 +++++++++--------- docs/swagger.json | 42 +++++++++--------- docs/swagger.yaml | 42 +++++++++--------- 7 files changed, 151 insertions(+), 99 deletions(-) diff --git a/app/md/agent_bank_info.go b/app/md/agent_bank_info.go index 7170bb0..2230cd7 100644 --- a/app/md/agent_bank_info.go +++ b/app/md/agent_bank_info.go @@ -1,12 +1,12 @@ package md type AgentBankInfo struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` - AgentId int `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` - State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` + Id string `json:"id" xorm:"not null pk autoincr INT(11)"` + Uuid string `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` + AgentId string `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` + State string `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` Memo string `json:"memo" xorm:"comment('备注 审核时填写的') VARCHAR(255)"` - CurrencyConf int `json:"currency_conf" xorm:"default 0 comment('结算币种 1人民币') TINYINT(1)"` + CurrencyConf string `json:"currency_conf" xorm:"default 0 comment('结算币种 1人民币') TINYINT(1)"` Bank string `json:"bank" xorm:"comment('开户银行') VARCHAR(255)"` BankBranch string `json:"bank_branch" xorm:"comment('开户银行分行') VARCHAR(255)"` BankNo string `json:"bank_no" xorm:"comment('银行卡号') VARCHAR(255)"` diff --git a/app/md/agent_contact_info.go b/app/md/agent_contact_info.go index 255c08a..4f91ac5 100644 --- a/app/md/agent_contact_info.go +++ b/app/md/agent_contact_info.go @@ -1,10 +1,10 @@ package md type AgentContactInfo struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` - AgentId int `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` - State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` + Id string `json:"id" xorm:"not null pk autoincr INT(11)"` + Uuid string `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` + AgentId string `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` + State string `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` Memo string `json:"memo" xorm:"comment('备注 审核时填写的') VARCHAR(255)"` Name string `json:"name" xorm:"comment('联系人') VARCHAR(255)"` Email string `json:"email" xorm:"comment('邮箱地址') VARCHAR(255)"` diff --git a/app/md/agent_list.go b/app/md/agent_list.go index d0b9571..ba76672 100644 --- a/app/md/agent_list.go +++ b/app/md/agent_list.go @@ -1,26 +1,26 @@ package md type AgentList struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` - AgentId int `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` - Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:企业 2:个人)') TINYINT(1)"` + Id string `json:"id" xorm:"not null pk autoincr INT(11)"` + Uuid string `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` + AgentId string `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` + Kind string `json:"kind" xorm:"not null default 1 comment('类型(1:企业 2:个人)') TINYINT(1)"` CompanyName string `json:"company_name" xorm:"not null default '' comment('公司名称') VARCHAR(255)"` CompanyAbbreviation string `json:"company_abbreviation" xorm:"not null default '' comment('公司简称') VARCHAR(255)"` UnifiedSocialCreditCode string `json:"unified_social_credit_code" xorm:"not null default '' comment('统一社会信用代码') VARCHAR(255)"` - CertificateType int `json:"certificate_type" xorm:"not null default 1 comment('证件类型 2级类目id') TINYINT(1)"` - CertificateFirstType int `json:"certificate_first_type" xorm:"not null default 1 comment('证件类型 1级类目id') TINYINT(1)"` + CertificateType string `json:"certificate_type" xorm:"not null default 1 comment('证件类型 2级类目id') TINYINT(1)"` + CertificateFirstType string `json:"certificate_first_type" xorm:"not null default 1 comment('证件类型 1级类目id') TINYINT(1)"` BusinessLicenseImgUrl string `json:"business_license_img_url" xorm:"not null default '' comment('营业执照照片') VARCHAR(255)"` LegalRepresentative string `json:"legal_representative" xorm:"not null default '' comment('法定代表人') CHAR(50)"` - CountryRegionId int `json:"country_region_id" xorm:"not null default 1 comment('国家地区id') TINYINT(3)"` + CountryRegionId string `json:"country_region_id" xorm:"not null default 1 comment('国家地区id') TINYINT(3)"` CountryRegion string `json:"country_region" xorm:"not null default '' comment('国家地区') CHAR(50)"` - RegisteredAddressCountryId int `json:"registered_address_country_id" xorm:"not null default 0 comment('注册地址-国家id') INT(11)"` - RegisteredAddressProvinceId int `json:"registered_address_province_id" xorm:"not null default 0 comment('注册地址-省份id') INT(11)"` - RegisteredAddressCityId int `json:"registered_address_city_id" xorm:"not null default 0 comment('注册地址-市id') INT(11)"` - RegisteredAddressCountyId int `json:"registered_address_county_id" xorm:"not null default 0 comment('注册地址-县/区id') INT(11)"` + RegisteredAddressCountryId string `json:"registered_address_country_id" xorm:"not null default 0 comment('注册地址-国家id') INT(11)"` + RegisteredAddressProvinceId string `json:"registered_address_province_id" xorm:"not null default 0 comment('注册地址-省份id') INT(11)"` + RegisteredAddressCityId string `json:"registered_address_city_id" xorm:"not null default 0 comment('注册地址-市id') INT(11)"` + RegisteredAddressCountyId string `json:"registered_address_county_id" xorm:"not null default 0 comment('注册地址-县/区id') INT(11)"` RegisteredAddress string `json:"registered_address" xorm:"not null default '' comment('注册地址') VARCHAR(255)"` BusinessLicenseAddress string `json:"business_license_address" xorm:"not null default '' comment('营业执照地址') VARCHAR(255)"` CertificateValidity string `json:"certificate_validity" xorm:"not null default '0000-00-00' comment('证件有效期') CHAR(50)"` - State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` + State string `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` } diff --git a/app/svc/svc_qualification.go b/app/svc/svc_qualification.go index be97ecd..257da1b 100644 --- a/app/svc/svc_qualification.go +++ b/app/svc/svc_qualification.go @@ -19,27 +19,55 @@ func QualificationInfo(c *gin.Context) { if Agent == nil { Agent = &model2.AgentList{Uuid: utils.StrToInt(c.GetString("mid")), AgentId: admin.AgentId} } + var AgentNew md.AgentList + copier.Copy(&AgentNew, &Agent) + AgentNew.Id = utils.IntToStr(Agent.Id) + AgentNew.Uuid = utils.IntToStr(Agent.Uuid) + AgentNew.AgentId = utils.IntToStr(Agent.AgentId) + AgentNew.Kind = utils.IntToStr(Agent.Kind) + AgentNew.CertificateType = utils.IntToStr(Agent.CertificateType) + AgentNew.CertificateFirstType = utils.IntToStr(Agent.CertificateFirstType) + AgentNew.CountryRegionId = utils.IntToStr(Agent.CountryRegionId) + AgentNew.RegisteredAddressCountryId = utils.IntToStr(Agent.RegisteredAddressCountryId) + AgentNew.RegisteredAddressProvinceId = utils.IntToStr(Agent.RegisteredAddressProvinceId) + AgentNew.RegisteredAddressCountyId = utils.IntToStr(Agent.RegisteredAddressCountyId) + AgentNew.RegisteredAddressCityId = utils.IntToStr(Agent.RegisteredAddressCityId) + AgentNew.State = utils.IntToStr(Agent.State) enterprise := map[string]interface{}{ - "state": Agent.State, - "data": Agent, + "state": AgentNew.State, + "data": AgentNew, } NewAgentBankInfoDb := implement.NewAgentBankInfoDb(db.Db) bank, _ := NewAgentBankInfoDb.GetAgentBankInfoList(admin.AgentId) if bank == nil { bank = &model2.AgentBankInfo{Uuid: Agent.Uuid, AgentId: Agent.AgentId} } + var bankNew md.AgentBankInfo + copier.Copy(&bankNew, &bank) + bankNew.State = utils.IntToStr(bank.State) + bankNew.Id = utils.IntToStr(bank.Id) + bankNew.Uuid = utils.IntToStr(bank.Uuid) + bankNew.AgentId = utils.IntToStr(bank.AgentId) + bankNew.CurrencyConf = utils.IntToStr(bank.CurrencyConf) + bankInfo := map[string]interface{}{ - "state": bank.State, - "data": bank, + "state": bankNew.State, + "data": bankNew, } NewAgentContactInfoDb := implement.NewAgentContactInfoDb(db.Db) contact, _ := NewAgentContactInfoDb.GetAgentContactInfoList(admin.AgentId) if contact == nil { contact = &model2.AgentContactInfo{Uuid: Agent.Uuid, AgentId: Agent.AgentId} } + var contactNew md.AgentContactInfo + copier.Copy(&contactNew, &contact) + contactNew.State = utils.IntToStr(contact.State) + contactNew.Id = utils.IntToStr(contact.Id) + contactNew.Uuid = utils.IntToStr(contact.Uuid) + contactNew.AgentId = utils.IntToStr(contact.AgentId) contactInfo := map[string]interface{}{ - "state": 0, - "data": contact, + "state": contactNew.State, + "data": contactNew, } res := map[string]interface{}{ "enterprise": enterprise, @@ -84,13 +112,25 @@ func QualificationSelectBase(c *gin.Context) { return } func QualificationEnterpriseSave(c *gin.Context, req md.AgentList) error { - req.State = 1 + req.State = "1" var data model2.AgentList copier.Copy(&data, &req) data.UpdateAt = time.Now().Format("2006-01-02 15:04:05") - if req.Id > 0 { + data.Id = utils.StrToInt(req.Id) + data.Uuid = utils.StrToInt(req.Uuid) + data.AgentId = utils.StrToInt(req.AgentId) + data.Kind = utils.StrToInt(req.Kind) + data.CertificateType = utils.StrToInt(req.CertificateType) + data.CertificateFirstType = utils.StrToInt(req.CertificateFirstType) + data.CountryRegionId = utils.StrToInt(req.CountryRegionId) + data.RegisteredAddressCountryId = utils.StrToInt(req.RegisteredAddressCountryId) + data.RegisteredAddressProvinceId = utils.StrToInt(req.RegisteredAddressProvinceId) + data.RegisteredAddressCountyId = utils.StrToInt(req.RegisteredAddressCountyId) + data.RegisteredAddressCityId = utils.StrToInt(req.RegisteredAddressCityId) + data.State = utils.StrToInt(req.State) + if utils.StrToInt(req.Id) > 0 { listDb := implement.NewAgentListDb(db.Db) - list, _ := listDb.GetAgentList(req.AgentId) + list, _ := listDb.GetAgentList(utils.StrToInt(req.AgentId)) if list.State == 1 { return e.NewErr(400, "该记录已提交审核") } @@ -105,14 +145,20 @@ func QualificationEnterpriseSave(c *gin.Context, req md.AgentList) error { return nil } func QualificationBankSave(c *gin.Context, req md.AgentBankInfo) error { - req.State = 1 + req.State = "1" + var data model2.AgentBankInfo copier.Copy(&data, &req) + data.State = utils.StrToInt(req.State) + data.Id = utils.StrToInt(req.Id) + data.Uuid = utils.StrToInt(req.Uuid) + data.AgentId = utils.StrToInt(req.AgentId) + data.CurrencyConf = utils.StrToInt(req.CurrencyConf) data.UpdateAt = time.Now() + if utils.StrToInt(req.Id) > 0 { - if req.Id > 0 { listDb := implement.NewAgentBankInfoDb(db.Db) - list, _ := listDb.GetAgentBankInfoList(req.AgentId) + list, _ := listDb.GetAgentBankInfoList(utils.StrToInt(req.AgentId)) if list.State == 1 { return e.NewErr(400, "该记录已提交审核") } @@ -127,13 +173,19 @@ func QualificationBankSave(c *gin.Context, req md.AgentBankInfo) error { return nil } func QualificationContactSave(c *gin.Context, req md.AgentContactInfo) error { - req.State = 1 + req.State = "1" + var data model2.AgentContactInfo copier.Copy(&data, &req) + data.State = utils.StrToInt(req.State) + data.Id = utils.StrToInt(req.Id) + data.Uuid = utils.StrToInt(req.Uuid) + data.AgentId = utils.StrToInt(req.AgentId) data.UpdateAt = time.Now() - if req.Id > 0 { + if utils.StrToInt(req.Id) > 0 { + listDb := implement.NewAgentContactInfoDb(db.Db) - list, _ := listDb.GetAgentContactInfoList(req.AgentId) + list, _ := listDb.GetAgentContactInfoList(utils.StrToInt(req.AgentId)) if list.State == 1 { return e.NewErr(400, "该记录已提交审核") } diff --git a/docs/docs.go b/docs/docs.go index ff05e2a..3202db2 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1331,7 +1331,7 @@ const docTemplate = `{ "type": "object", "properties": { "agent_id": { - "type": "integer" + "type": "string" }, "bank": { "type": "string" @@ -1343,10 +1343,10 @@ const docTemplate = `{ "type": "string" }, "currency_conf": { - "type": "integer" + "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "licence": { "type": "string" @@ -1355,10 +1355,10 @@ const docTemplate = `{ "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1369,13 +1369,13 @@ const docTemplate = `{ "type": "string" }, "agent_id": { - "type": "integer" + "type": "string" }, "email": { "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" @@ -1387,10 +1387,10 @@ const docTemplate = `{ "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1398,7 +1398,7 @@ const docTemplate = `{ "type": "object", "properties": { "agent_id": { - "type": "integer" + "type": "string" }, "business_license_address": { "type": "string" @@ -1407,10 +1407,10 @@ const docTemplate = `{ "type": "string" }, "certificate_first_type": { - "type": "integer" + "type": "string" }, "certificate_type": { - "type": "integer" + "type": "string" }, "certificate_validity": { "type": "string" @@ -1425,13 +1425,13 @@ const docTemplate = `{ "type": "string" }, "country_region_id": { - "type": "integer" + "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "kind": { - "type": "integer" + "type": "string" }, "legal_representative": { "type": "string" @@ -1443,25 +1443,25 @@ const docTemplate = `{ "type": "string" }, "registered_address_city_id": { - "type": "integer" + "type": "string" }, "registered_address_country_id": { - "type": "integer" + "type": "string" }, "registered_address_county_id": { - "type": "integer" + "type": "string" }, "registered_address_province_id": { - "type": "integer" + "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "unified_social_credit_code": { "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, diff --git a/docs/swagger.json b/docs/swagger.json index 9c84670..23ff792 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1323,7 +1323,7 @@ "type": "object", "properties": { "agent_id": { - "type": "integer" + "type": "string" }, "bank": { "type": "string" @@ -1335,10 +1335,10 @@ "type": "string" }, "currency_conf": { - "type": "integer" + "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "licence": { "type": "string" @@ -1347,10 +1347,10 @@ "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1361,13 +1361,13 @@ "type": "string" }, "agent_id": { - "type": "integer" + "type": "string" }, "email": { "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" @@ -1379,10 +1379,10 @@ "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1390,7 +1390,7 @@ "type": "object", "properties": { "agent_id": { - "type": "integer" + "type": "string" }, "business_license_address": { "type": "string" @@ -1399,10 +1399,10 @@ "type": "string" }, "certificate_first_type": { - "type": "integer" + "type": "string" }, "certificate_type": { - "type": "integer" + "type": "string" }, "certificate_validity": { "type": "string" @@ -1417,13 +1417,13 @@ "type": "string" }, "country_region_id": { - "type": "integer" + "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "kind": { - "type": "integer" + "type": "string" }, "legal_representative": { "type": "string" @@ -1435,25 +1435,25 @@ "type": "string" }, "registered_address_city_id": { - "type": "integer" + "type": "string" }, "registered_address_country_id": { - "type": "integer" + "type": "string" }, "registered_address_county_id": { - "type": "integer" + "type": "string" }, "registered_address_province_id": { - "type": "integer" + "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "unified_social_credit_code": { "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index db888c6..947baba 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -80,7 +80,7 @@ definitions: md.AgentBankInfo: properties: agent_id: - type: integer + type: string bank: type: string bank_branch: @@ -88,28 +88,28 @@ definitions: bank_no: type: string currency_conf: - type: integer + type: string id: - type: integer + type: string licence: type: string memo: type: string state: - type: integer + type: string uuid: - type: integer + type: string type: object md.AgentContactInfo: properties: address: type: string agent_id: - type: integer + type: string email: type: string id: - type: integer + type: string memo: type: string name: @@ -117,22 +117,22 @@ definitions: phone: type: string state: - type: integer + type: string uuid: - type: integer + type: string type: object md.AgentList: properties: agent_id: - type: integer + type: string business_license_address: type: string business_license_img_url: type: string certificate_first_type: - type: integer + type: string certificate_type: - type: integer + type: string certificate_validity: type: string company_abbreviation: @@ -142,11 +142,11 @@ definitions: country_region: type: string country_region_id: - type: integer + type: string id: - type: integer + type: string kind: - type: integer + type: string legal_representative: type: string memo: @@ -154,19 +154,19 @@ definitions: registered_address: type: string registered_address_city_id: - type: integer + type: string registered_address_country_id: - type: integer + type: string registered_address_county_id: - type: integer + type: string registered_address_province_id: - type: integer + type: string state: - type: integer + type: string unified_social_credit_code: type: string uuid: - type: integer + type: string type: object md.BindAdminRoleReq: properties: