From ea434eabb4ed341e3ee0406a57e048ffc43c9e4e Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 26 Aug 2024 16:29:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E8=B4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/md/medium_bank_info.go | 10 ++--- app/md/medium_contact_info.go | 8 ++-- app/md/medium_list.go | 24 +++++------ app/svc/svc_qualification.go | 80 ++++++++++++++++++++++++++++------- docs/docs.go | 42 +++++++++--------- docs/swagger.json | 42 +++++++++--------- docs/swagger.yaml | 42 +++++++++--------- 7 files changed, 148 insertions(+), 100 deletions(-) diff --git a/app/md/medium_bank_info.go b/app/md/medium_bank_info.go index 06db295..1fb389e 100644 --- a/app/md/medium_bank_info.go +++ b/app/md/medium_bank_info.go @@ -1,12 +1,12 @@ package md type MediumBankInfo 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)"` - MediumId int `json:"medium_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)"` + MediumId string `json:"medium_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)"` + CurrencyConf string `json:"currency_conf" xorm:"default 0 comment('结算币种 1人民币') TINYINT(1)"` Memo string `json:"memo" xorm:"comment('备注 审核时填写的') VARCHAR(255)"` - CurrencyConf int `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/medium_contact_info.go b/app/md/medium_contact_info.go index ea91241..b9450da 100644 --- a/app/md/medium_contact_info.go +++ b/app/md/medium_contact_info.go @@ -1,10 +1,10 @@ package md type MediumContactInfo 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)"` - MediumId int `json:"medium_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)"` + MediumId string `json:"medium_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/medium_list.go b/app/md/medium_list.go index 17e5ff5..794ee47 100644 --- a/app/md/medium_list.go +++ b/app/md/medium_list.go @@ -1,26 +1,26 @@ package md type MediumList 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)"` - MediumId int `json:"medium_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)"` + MediumId string `json:"medium_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)"` + 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)"` + CountryRegionId string `json:"country_region_id" xorm:"not null default 1 comment('国家地区id') TINYINT(3)"` + 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)"` + State string `json:"state" xorm:"not null default 0 comment('状态(0:待审核 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)"` 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)"` 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)"` 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)"` 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 d785336..b264102 100644 --- a/app/svc/svc_qualification.go +++ b/app/svc/svc_qualification.go @@ -19,9 +19,23 @@ func QualificationInfo(c *gin.Context) { if medium == nil { medium = &model2.MediumList{Uuid: utils.StrToInt(c.GetString("mid")), MediumId: admin.MediumId} } + var mediumNew md.MediumList + copier.Copy(&mediumNew, &medium) + mediumNew.Id = utils.IntToStr(medium.Id) + mediumNew.Uuid = utils.IntToStr(medium.Uuid) + mediumNew.MediumId = utils.IntToStr(medium.MediumId) + mediumNew.Kind = utils.IntToStr(medium.Kind) + mediumNew.CertificateType = utils.IntToStr(medium.CertificateType) + mediumNew.CertificateFirstType = utils.IntToStr(medium.CertificateFirstType) + mediumNew.CountryRegionId = utils.IntToStr(medium.CountryRegionId) + mediumNew.RegisteredAddressCountryId = utils.IntToStr(medium.RegisteredAddressCountryId) + mediumNew.RegisteredAddressProvinceId = utils.IntToStr(medium.RegisteredAddressProvinceId) + mediumNew.RegisteredAddressCountyId = utils.IntToStr(medium.RegisteredAddressCountyId) + mediumNew.RegisteredAddressCityId = utils.IntToStr(medium.RegisteredAddressCityId) + mediumNew.State = utils.IntToStr(medium.State) enterprise := map[string]interface{}{ - "state": medium.State, - "data": medium, + "state": mediumNew.State, + "data": mediumNew, } NewMediumBankInfoDb := implement.NewMediumBankInfoDb(db.Db) @@ -29,18 +43,32 @@ func QualificationInfo(c *gin.Context) { if bank == nil { bank = &model2.MediumBankInfo{Uuid: medium.Uuid, MediumId: medium.MediumId} } + var bankNew md.MediumBankInfo + copier.Copy(&bankNew, &bank) + bankNew.State = utils.IntToStr(bank.State) + bankNew.Id = utils.IntToStr(bank.Id) + bankNew.Uuid = utils.IntToStr(bank.Uuid) + bankNew.MediumId = utils.IntToStr(bank.MediumId) + bankNew.CurrencyConf = utils.IntToStr(bank.CurrencyConf) + bankInfo := map[string]interface{}{ - "state": bank.State, - "data": bank, + "state": bankNew.State, + "data": bankNew, } NewMediumContactInfoDb := implement.NewMediumContactInfoDb(db.Db) contact, _ := NewMediumContactInfoDb.GetMediumContactInfoList(admin.MediumId) if contact == nil { contact = &model2.MediumContactInfo{Uuid: medium.Uuid, MediumId: medium.MediumId} } + var contactNew md.MediumContactInfo + copier.Copy(&contactNew, &contact) + contactNew.State = utils.IntToStr(contact.State) + contactNew.Id = utils.IntToStr(contact.Id) + contactNew.Uuid = utils.IntToStr(contact.Uuid) + contactNew.MediumId = utils.IntToStr(contact.MediumId) contactInfo := map[string]interface{}{ - "state": 0, - "data": contact, + "state": contactNew.State, + "data": contactNew, } res := map[string]interface{}{ "enterprise": enterprise, @@ -77,13 +105,25 @@ func QualificationSelectBase(c *gin.Context) { return } func QualificationEnterpriseSave(c *gin.Context, req md.MediumList) error { - req.State = 1 + req.State = "1" var data model2.MediumList copier.Copy(&data, &req) + data.Id = utils.StrToInt(req.Id) + data.Uuid = utils.StrToInt(req.Uuid) + data.MediumId = utils.StrToInt(req.MediumId) + 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) data.UpdateAt = time.Now().Format("2006-01-02 15:04:05") - if req.Id > 0 { + if utils.StrToInt(req.Id) > 0 { listDb := implement.NewMediumListDb(db.Db) - list, _ := listDb.GetMediumList(req.MediumId) + list, _ := listDb.GetMediumList(utils.StrToInt(req.MediumId)) if list.State == 1 { return e.NewErr(400, "该记录已提交审核") } @@ -98,13 +138,18 @@ func QualificationEnterpriseSave(c *gin.Context, req md.MediumList) error { return nil } func QualificationBankSave(c *gin.Context, req md.MediumBankInfo) error { - req.State = 1 + req.State = "1" var data model2.MediumBankInfo copier.Copy(&data, &req) + data.State = utils.StrToInt(req.State) + data.Id = utils.StrToInt(req.Id) + data.Uuid = utils.StrToInt(req.Uuid) + data.MediumId = utils.StrToInt(req.MediumId) + data.CurrencyConf = utils.StrToInt(req.CurrencyConf) data.UpdateAt = time.Now() - if req.Id > 0 { + if utils.StrToInt(req.Id) > 0 { listDb := implement.NewMediumBankInfoDb(db.Db) - list, _ := listDb.GetMediumBankInfoList(req.MediumId) + list, _ := listDb.GetMediumBankInfoList(utils.StrToInt(req.MediumId)) if list.State == 1 { return e.NewErr(400, "该记录已提交审核") } @@ -119,14 +164,17 @@ func QualificationBankSave(c *gin.Context, req md.MediumBankInfo) error { return nil } func QualificationContactSave(c *gin.Context, req md.MediumContactInfo) error { - req.State = 1 + req.State = "1" var data model2.MediumContactInfo copier.Copy(&data, &req) data.UpdateAt = time.Now() - - if req.Id > 0 { + data.State = utils.StrToInt(req.State) + data.Id = utils.StrToInt(req.Id) + data.Uuid = utils.StrToInt(req.Uuid) + data.MediumId = utils.StrToInt(req.MediumId) + if utils.StrToInt(req.Id) > 0 { listDb := implement.NewMediumContactInfoDb(db.Db) - list, _ := listDb.GetMediumContactInfoList(req.MediumId) + list, _ := listDb.GetMediumContactInfoList(utils.StrToInt(req.MediumId)) if list.State == 1 { return e.NewErr(400, "该记录已提交审核") } diff --git a/docs/docs.go b/docs/docs.go index d9ab26b..46abee7 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1821,25 +1821,25 @@ const docTemplate = `{ "type": "string" }, "currency_conf": { - "type": "integer" + "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "licence": { "type": "string" }, "medium_id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1853,10 +1853,10 @@ const docTemplate = `{ "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "medium_id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" @@ -1868,10 +1868,10 @@ const docTemplate = `{ "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1885,10 +1885,10 @@ const docTemplate = `{ "type": "string" }, "certificate_first_type": { - "type": "integer" + "type": "string" }, "certificate_type": { - "type": "integer" + "type": "string" }, "certificate_validity": { "type": "string" @@ -1903,19 +1903,19 @@ 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" }, "medium_id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" @@ -1924,25 +1924,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 03583f4..80c09e9 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1813,25 +1813,25 @@ "type": "string" }, "currency_conf": { - "type": "integer" + "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "licence": { "type": "string" }, "medium_id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1845,10 +1845,10 @@ "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "medium_id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" @@ -1860,10 +1860,10 @@ "type": "string" }, "state": { - "type": "integer" + "type": "string" }, "uuid": { - "type": "integer" + "type": "string" } } }, @@ -1877,10 +1877,10 @@ "type": "string" }, "certificate_first_type": { - "type": "integer" + "type": "string" }, "certificate_type": { - "type": "integer" + "type": "string" }, "certificate_validity": { "type": "string" @@ -1895,19 +1895,19 @@ "type": "string" }, "country_region_id": { - "type": "integer" + "type": "string" }, "id": { - "type": "integer" + "type": "string" }, "kind": { - "type": "integer" + "type": "string" }, "legal_representative": { "type": "string" }, "medium_id": { - "type": "integer" + "type": "string" }, "memo": { "type": "string" @@ -1916,25 +1916,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 b57eb7d..29299a1 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -315,19 +315,19 @@ definitions: bank_no: type: string currency_conf: - type: integer + type: string id: - type: integer + type: string licence: type: string medium_id: - type: integer + type: string memo: type: string state: - type: integer + type: string uuid: - type: integer + type: string type: object md.MediumContactInfo: properties: @@ -336,9 +336,9 @@ definitions: email: type: string id: - type: integer + type: string medium_id: - type: integer + type: string memo: type: string name: @@ -346,9 +346,9 @@ definitions: phone: type: string state: - type: integer + type: string uuid: - type: integer + type: string type: object md.MediumList: properties: @@ -357,9 +357,9 @@ definitions: 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: @@ -369,33 +369,33 @@ 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 medium_id: - type: integer + type: string memo: type: string 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.Response: properties: