This commit is contained in:
2024-09-14 10:48:09 +08:00
commit a5fa833937
192 changed files with 87641 additions and 0 deletions

105
model/model/antifraud.go Normal file
View File

@@ -0,0 +1,105 @@
package model
import "qnc-server/model/request"
type AntiFraud struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
CardNo string `gorm:"column:card_no;type:varchar(255);not null"` // 卡号
Name string `gorm:"column:name;type:varchar(255);not null"` // 姓名
Mobile string `gorm:"column:mobile;type:varchar(255);not null"` // 手机号
FraudScoreResp string `gorm:"column:fraud_score_resp;type:varchar(600)"` // FIN025 反欺诈评分
RiskAssessmentResp string `gorm:"column:risk_assessment_resp;type:varchar(600)"` // FIN030 综合风险评估 输入姓名
MobileRiskCheckResp string `gorm:"column:mobile_risk_check_resp;type:varchar(600)"` // MOB032 风险手机号列表核验
NegativeSecurityCheckResp string `gorm:"column:negative_security_check_resp;type:varchar(600)"` // P_C_B019 社会负面安全核验
RiskPersonV2Resp string `gorm:"column:risk_person_v2_resp;type:varchar(600)"` // RIS010 风险人员V2
AntiFraudGamblingResp string `gorm:"column:anti_fraud_gambling_resp;type:varchar(600)"` // RIS031 反诈反赌核验
TelecomFraudListResp string `gorm:"column:telecom_fraud_list_resp;type:varchar(600)"` // RIS035 电信诈骗名单
PersonalCredibilityResp string `gorm:"column:personal_credibility_resp;type:varchar(600)"` // HRD015 个人可信度查询
OrderID uint `gorm:"column:order_id;not null"`
}
func (AntiFraud) TableName() string {
return "fraud_prevention"
}
var AntiFraudProdIDs = []string{
"FIN025", // 反欺诈评分
"FIN030", // 综合风险评估 输入姓名
"MOB032", // 风险手机号列表核验
//暂时不可用 "P_C_B019", // 社会负面安全核验
"RIS010", // 风险人员V2
"RIS031", // 反诈反赌核验
"RIS035", // 电信诈骗名单
"HRD015", // 个人可信度查询
}
var AntiFraudFieldMapping = map[string]string{
"FIN025": "FraudScoreResp",
"FIN030": "RiskAssessmentResp",
"MOB032": "MobileRiskCheckResp",
"P_C_B019": "NegativeSecurityCheckResp",
"RIS010": "RiskPersonV2Resp",
"RIS031": "AntiFraudGamblingResp",
"RIS035": "TelecomFraudListResp",
"HRD015": "PersonalCredibilityResp",
}
type AntiFraudReqPayload struct {
request.AntiFraudQueryReq
ProdID string
}
var AntiFraudProdIDParams = map[string][]string{
"FIN025": {"cardNo", "name", "mobile"},
"FIN030": {"cardNo", "name", "mobile"},
"MOB032": {"mobile"},
"P_C_B019": {"cardNo", "name"},
"RIS010": {"name", "cardNo", "mobile"},
"RIS031": {"type", "keyWord"},
"RIS035": {"cardNo", "name"},
"HRD015": {"name", "cardNo"},
}
type YuShanResponse[T any] struct {
ResponseSn string `json:"response_sn"` // 响应序列号
Retdata T `json:"retdata"` // 返回数据
Version string `json:"version"` // 版本号
RequestSn string `json:"request_sn"` // 请求序列号
Retmsg string `json:"retmsg"` // 返回消息
Retdate int64 `json:"retdate"` // 返回日期(时间戳)
Retcode string `json:"retcode"` // 返回代码
}
type FraudScoreRetData struct {
BjScore float64 `json:"bj_score"`
}
type RiskAssessmentRetData struct {
BjScore float64 `json:"bj_score"`
}
type MobileRiskCheckRetData struct {
phonePrimaryInfo float64 `json:"bj_score"`
//phoneRiskLabels
}
// 报告
type AntiFraudReport struct {
FraudScore struct {
Score int
Comment string
} `json:"fraud_score"` // FIN025 反欺诈评分
RiskAssessment struct {
Score int
Comment string
} `json:"risk_assessment"` // FIN030 综合风险评估
MobileRiskCheck map[string]interface{} `json:"mobile_risk_check"` // MOB032 风险手机号列表核验
//NegativeSecurityCheck map[string]interface{} `json:"negative_security_check"` // P_C_B019 社会负面安全核验
RiskPersonV2 map[string]interface{} `json:"risk_person_v2"` // RIS010 风险人员V2
AntiFraudGambling map[string]interface{} `json:"anti_fraud_gambling"` // RIS031 反诈反赌核验
TelecomFraudList map[string]interface{} `json:"telecom_fraud_list"` // RIS035 电信诈骗名单
PersonalCredibility map[string]interface{} `json:"personal_credibility"` // HRD015 个人可信度查询
IDInfo IDInfo `json:"id_info"`
Name string `json:"name" `
Mobile string `json:"mobile"`
CardNo string `json:"card_no" `
}

13
model/model/base.go Normal file
View File

@@ -0,0 +1,13 @@
package model
import (
"gorm.io/gorm"
"time"
)
type BaseModel struct {
ID uint `gorm:"primarykey" json:"ID"` // 主键ID
CreatedAt time.Time // 创建时间
UpdatedAt time.Time // 更新时间
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
}

148
model/model/car.go Normal file
View File

@@ -0,0 +1,148 @@
package model
import "qnc-server/model/request"
type CarInsurance struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
Resp string `gorm:"column:resp;type:text;not null"`
OrderID uint `gorm:"column:order_id;not null"`
}
func (CarInsurance) TableName() string {
return "car_insurance"
}
type CarInsuranceVerify struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarInsuranceVerify) TableName() string {
return "car_insurance_verify"
}
type CarInsurancePayload struct {
request.CarInsuranceReq
ProdID string
}
type CarMaintenance struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
LicenseImage string `gorm:"column:license_image;type:varchar(255);not null"`
OrderID uint `gorm:"column:order_id;not null"`
YuShanOrderID string `gorm:"column:yu_shan_order_id;type:varchar(255);not null"`
NotifySN string `gorm:"column:notify_sn;type:varchar(255);not null"`
Resp string `gorm:"column:resp;type:text"`
Status string `gorm:"column:status;type:varchar(50);not null"`
}
const (
StatusPending = "查询中"
StatusSuccess = "查询成功"
StatusFailed = "查询失败"
)
func (CarMaintenance) TableName() string {
return "car_maintenance"
}
// 人车核验 CAR012
type CarPersonCarVerify struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Name string `gorm:"column:name;type:varchar(255);not null"` //人名
CarType string `gorm:"column:car_type;not null"`
CarNumber string `gorm:"column:car_number;type:varchar(255);not null"` // 车牌
OrderID uint `gorm:"column:order_id;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarPersonCarVerify) TableName() string {
return "car_person_car_verify"
}
// CAR061名下车辆
type CarUnderName struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
OrderID uint `gorm:"column:order_id;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarUnderName) TableName() string {
return "car_under_name"
}
// CAR070车辆上险信息 CAR095车五项 合并
type CarInsuranceInfo struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
OrderID uint `gorm:"column:order_id;not null"`
FiveResp string `gorm:"column:five_resp;type:text;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarInsuranceInfo) TableName() string {
return "car_insurance_info"
}
// 新能源动力电池报告
type CarNewEnergyPower struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
OrderID uint `gorm:"column:order_id;not null"`
YuShanOrderID string `gorm:"column:yu_shan_order_id;type:varchar(255);not null"`
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarNewEnergyPower) TableName() string {
return "car_new_energy_power"
}
// vin查车辆信息
type CarVinCheckInfo struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
OrderID uint `gorm:"column:order_id;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarVinCheckInfo) TableName() string {
return "car_vin_check_info"
}
// 车辆过户次数 Car066
type CarVehicleTransfer struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
OrderID uint `gorm:"column:order_id;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarVehicleTransfer) TableName() string {
return "car_vehicle_transfer"
}
// 车辆估值 CAR100
type CarVehicleValuation struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Vin string `gorm:"column:vin;type:varchar(255);not null"` //车架号
CarNumber string `gorm:"column:car_number;type:varchar(255);not null"` // 车牌
OrderID uint `gorm:"column:order_id;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
}
func (CarVehicleValuation) TableName() string {
return "car_vehicle_valuation"
}

14
model/model/common.go Normal file
View File

@@ -0,0 +1,14 @@
package model
type Region struct {
FullRegion string `json:"fullRegion"`
Province string `json:"province"`
City string `json:"city"`
Region string `json:"region"`
}
type IDInfo struct {
Location string `json:"location"`
BirthDate string `json:"birth_date"`
Gender string `json:"gender"`
}

66
model/model/ent.go Normal file
View File

@@ -0,0 +1,66 @@
package model
type EntFeature struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
OrderID uint `gorm:"column:order_id;not null"`
Resp string `gorm:"column:resp;type:text"`
FeatureName string `gorm:"column:Feature_name;type:varchar(255);not null"`
}
func (EntFeature) TableName() string {
return "ent_feature"
}
var Links = map[string]string{
"search": "open/search/2.0", // 搜索
"baseinfo": "open/ic/baseinfoV2/2.0", // 企业基本信息(含企业联系方式)
"holder": "open/ic/holder/2.0", // 企业股东
"changeinfo": "open/ic/changeinfo/2.0", // 变更记录
"judicial": "open/cb/judicial/2.0", // 司法风险
"consumptionRestriction": "open/jr/consumptionRestriction/2.0", // 限制消费令
"appbkInfo": "open/m/appbkInfo/2.0", // 产品信息
"mortgageInfo": "open/mr/mortgageInfo/2.0", // 动产抵押
"historicalMortgageInfo": "open/hi/mortgageInfo/2.0", // 历史动产抵押
"landMortgage": "open/mr/landMortgage/2.0", // 土地抵押
"historicalIC": "open/hi/ic/2.0", // 历史工商信息
"profile": "v4/open/profile", // 企业简介
"trademarkDetail": "open/ipr/tm/detail/2.0", // 商标信息详情
"historicalAbnormal": "open/hi/abnormal/2.0", // 历史经营异常
"landMortgageDetail": "open/mr/landMortgage/detail/2.0", // 土地抵押详情
"companyType": "open/ic/companyType", // 企业类型
"historicalMembers": "open/hi/members", // 历史主要人员
"staff": "open/ic/staff/2.0", // 主要人员
"lawSuitDetail": "open/jr/lawSuit/detail", // 法律诉讼详情
"courtAnnouncement": "open/jr/courtAnnouncement/2.0", // 法院公告
"lawSuit": "open/jr/lawSuit/3.0", // 法律诉讼
"historicalLawSuit": "open/hi/lawSuit/3.0", // 历史法律诉讼
"historicalZhixing": "open/hi/zhixing/2.0", // 历史被执行人
"announcement": "open/hi/announcement/2.0", // 历史开庭公告
"historicalCourtAnnouncement": "open/hi/court/2.0", // 历史法院公告
"historicalDishonest": "open/hi/dishonest/2.0", // 历史失信人
"ktAnnouncement": "open/jr/ktannouncement/2.0", // 开庭公告
"zhixingInfo": "open/jr/zhixinginfo/2.0", // 被执行人
"endCase": "open/jr/endCase/2.0", // 终本案件
"sendAnnouncement": "open/jr/sendAnnouncement/2.0", // 送达公告
"courtRegister": "open/jr/courtRegister/2.0", // 立案信息
"dishonest": "open/jr/dishonest/2.0", // 失信人
"taxpayer": "open/m/taxpayer/2.0", // 一般纳税人
"publicWeChat": "open/ipr/publicWeChat/2.0", // 企业微信公账号
"customer": "open/m/customer/2.0", // 客户
"supply": "open/m/supply/2.0", // 供应商
"weibo": "open/m/weibo/2.0", // 企业微博
"getPledgeReg": "v4/open/getPledgeReg", // 知识产权出质
"equityInfo": "open/mr/equityInfo/2.0", // 股权出质
"ownTax": "open/mr/ownTax/2.0", // 欠税公告
"judicialSale": "open/mr/judicialSale/3.0", // 司法拍卖
"stockPledge": "open/mr/stockPledge/detail/2.0", // 质押明细详情
"abnormal": "open/mr/abnormal/2.0", // 经营异常
"punishmentInfo": "open/mr/punishmentInfo/3.0", // 行政处罚
"patents": "open/ipr/patents/3.0", // 企业专利信息
"copyReg": "open/ipr/copyReg/2.0", // 软件著作权
"companyholding": "open/human/companyholding/2.0", // 人员控股企业
"annualreport": "open/ic/annualreport/2.0", // 企业年报
"development": "open/cb/development/2.0", // 企业发展
"partners": "v4/open/partners", // 人员所有合作伙伴
}

View File

@@ -0,0 +1,18 @@
package model
import (
"qnc-server/model/types"
)
type JusticeLawsuit struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
LawsuitType types.LawsuitType `gorm:"column:lawsuit_type;type:tinyint(1);not null"`
Resp string `gorm:"column:list_resp;type:MEDIUMTEXT;"`
Mobile string `gorm:"column:mobile;type:varchar(255);not null"` // 手机号
OrderID uint `gorm:"column:order_id;not null"`
}
func (Lawsuit) TableName() string {
return "lawsuit"
}

41
model/model/lawsuit.go Normal file
View File

@@ -0,0 +1,41 @@
package model
import "encoding/json"
type Lawsuit struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
CardNo string `gorm:"column:card_no;type:varchar(255);not null"` // 卡号
Name string `gorm:"column:name;type:varchar(255);not null"` // 姓名
Mobile string `gorm:"column:mobile;type:varchar(255);not null"` // 手机号
ListResp string `gorm:"column:list_resp;type:text;"`
SxrResp string `gorm:"column:srx_resp;type:text;"`
LimitHightResp string `gorm:"column:limit_hight_resp;type:text;"`
OrderID uint `gorm:"column:order_id;not null"`
}
func (JusticeLawsuit) TableName() string {
return "justice_lawsuit"
}
type LawsuitInfo struct {
Msg string `json:"msg"`
Code string `json:"code"`
Data json.RawMessage `json:"data"`
}
type LawsuitInnerData struct {
PersonInfo *LawsuitInfo `json:"lawsuit_person_info,omitempty"`
CompanyInfo *LawsuitInfo `json:"lawsuit_company_info,omitempty"`
QueryID string `json:"query_id"`
}
type LawsuitData struct {
Data LawsuitInnerData `json:"data"`
ErrMsg string `json:"err_msg"`
ErrCode string `json:"err_code"`
}
type LawsuitResponse struct {
Data LawsuitData `json:"data"`
}

View File

@@ -0,0 +1,73 @@
package model
import (
"qnc-server/model/request"
)
type LoanEvaluation struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
CardNo string `gorm:"column:card_no;type:varchar(255);not null"` // 卡号
Name string `gorm:"column:name;type:varchar(255);not null"` // 姓名
Mobile string `gorm:"column:mobile;type:varchar(255);not null"` // 手机号
MobileMonthlyConsumptionLevelResp string `gorm:"column:mobile_monthly_consumption_level_resp;type:varchar(600)"` // MOB035 手机月消费档次
RecentSixMonthsSuspendedTimesResp string `gorm:"column:recent_six_months_suspended_times_resp;type:varchar(600)"` // MOB029 近六个月欠费停机次数查询
OverdueSelectionIndexResp string `gorm:"column:overdue_selection_index_resp;type:varchar(600)"` // RIS011 逾选指数
PaymentSelectionIndexResp string `gorm:"column:payment_selection_index_resp;type:varchar(600)"` // RIS012 付选指数
LoanSelectionIndexResp string `gorm:"column:loan_selection_index_resp;type:varchar(600)"` // RIS013 贷选指数
BorrowSelectionIndexResp string `gorm:"column:borrow_selection_index_resp;type:text"` // RIS015 借选指数
FinancialBlacklistResp string `gorm:"column:financial_blacklist_resp;type:varchar(600)"` // RIS029 金融黑名单
OrderID uint `gorm:"column:order_id;not null"`
}
func (LoanEvaluation) TableName() string {
return "loan_evaluation"
}
type LoanEvaluationReqPayload struct {
request.LoanEvaluationQueryReq
ProdID string
}
var LoanEvaluationProdIDs = []string{
"MOB035", // 手机月消费档次
"MOB029", // 近六个月欠费停机次数查询
"RIS011", // 逾选指数
"RIS012", // 付选指数
"RIS013", // 贷选指数
"RIS015", // 借选指数
"RIS029", // 金融黑名单
}
var LoanEvaluationFieldMapping = map[string]string{
"MOB035": "MobileMonthlyConsumptionLevelResp",
"MOB029": "RecentSixMonthsSuspendedTimesResp",
"RIS011": "OverdueSelectionIndexResp",
"RIS012": "PaymentSelectionIndexResp",
"RIS013": "LoanSelectionIndexResp",
"RIS015": "BorrowSelectionIndexResp",
"RIS029": "FinancialBlacklistResp",
}
var LoanEvaluationProdIDParams = map[string][]string{
"MOB035": {"mobile"},
"MOB029": {"mobile"},
"RIS011": {"mobile"},
"RIS012": {"mobile", "cardNo", "name"},
"RIS013": {"mobile", "cardNo", "name"},
"RIS015": {"mobile", "cardNo", "name"},
"RIS029": {"idCard", "name", "encryptionType", "phone"},
}
// 报告
type LoanEvaluationReport struct {
MobileMonthlyConsumptionLevel map[string]interface{} `json:"mobile_monthly_consumption_level"` // MOB035 手机月消费档次
RecentSixMonthsSuspendedTimes map[string]interface{} `json:"recent_six_months_suspended_times"` // MOB029 近六个月欠费停机次数查询
OverdueSelectionIndex map[string]interface{} `json:"overdue_selection_index"` // RIS011 逾选指数
PaymentSelectionIndex map[string]interface{} `json:"payment_selection_index"` // RIS012 付选指数
LoanSelectionIndex map[string]interface{} `json:"loan_selection_index"` // RIS013 贷选指数
BorrowSelectionIndex map[string]interface{} `json:"borrow_selection_index"` // RIS015 借选指数
FinancialBlacklist map[string]interface{} `json:"financial_blacklist"` // RIS029 金融黑名单
IDInfo IDInfo `json:"id_info"`
Name string `json:"name" `
Mobile string `json:"mobile"`
CardNo string `json:"card_no" `
}

49
model/model/pay.go Normal file
View File

@@ -0,0 +1,49 @@
package model
type PayOrder struct {
BaseModel
OutTradeNo string `gorm:"type:varchar(50);" json:"out_trade_no"` //商户单号
TransactionId string `gorm:"type:varchar(50);" json:"transaction_id"` //微信单号
AliTradeNo string `gorm:"type:varchar(50);" json:"ali_trade_no"`
Remarks string `gorm:"type:varchar(255)" json:"remarks"` // 备注
Amount int64 `gorm:"type:int" json:"amount"` //金额
Userid uint `gorm:"" json:"userid"`
PayStatus string `gorm:"type:varchar(20)" json:"pay_status"` // 支付状态
HasConsumed uint `gorm:"default:0" json:"has_consumed"` // 0未消费 1已消费
ProductID uint `gorm:"" json:"product_id"` // 外键关联Product
Product *Product `gorm:"foreignKey:ProductID"` // 关联的Product
Platform string `gorm:"type:varchar(20)" json:"platform"` //支付时的平套
PaymentMethod PaymentMethod `gorm:"type:varchar(20)" json:"payment_method"` // 支付平台
}
// 支付订单
func (PayOrder) TableName() string {
return "pay_order"
}
const (
PayStatusSuccess string = "SUCCESS" // 支付成功
PayStatusNotPay string = "NOTPAY" // 未支付
PayStatusPayError string = "PAYERROR" // 支付失败
PayStatusUnderRefund string = "UNDERREFUND" // 退款中
PayStatusRefund string = "REFUND" // 退款
PayStatusRefundError string = "REFUNDError" // 退款失败
PayStatusOther string = "OTHER" // 其他
)
type PaymentMethod string
const (
PaymentMethod_WECHAT PaymentMethod = "WECHAT"
PaymentMethod_ALIPAY PaymentMethod = "ALIPAY"
)
const (
NotConsumed uint = 0 // 支付成功
HasConsumed uint = 1 // 未支付
)
const (
PlatformMPWEIXIN = "mp-weixin"
PlatformMPH5 = "mp-h5"
PlatformH5 = "h5"
)

17
model/model/product.go Normal file
View File

@@ -0,0 +1,17 @@
package model
type Product struct {
BaseModel
ProductName string `gorm:"type:varchar(50)" json:"product_name"` // 服务名
ProductEn string `gorm:"type:varchar(50)" json:"product_en"` // 英文名
Description string `gorm:"type:varchar(255)" json:"description"` // 描述
Notes string `gorm:"type:text" json:"notes"`
CostPrice int `gorm:"type:int" json:"cost_price"` // 成本
SellPrice int `gorm:"type:int" json:"sell_price"` //售价
PayOrders []PayOrder `gorm:"foreignKey:ProductID"` // 与PayOrder的一对多关系
}
// 设置表名
func (Product) TableName() string {
return "product"
}

16
model/model/query.go Normal file
View File

@@ -0,0 +1,16 @@
package model
type Query struct {
ID uint `gorm:"primaryKey"`
OrderID uint `gorm:"not null"` // 外键关联到 Order 表
Order *PayOrder `gorm:"foreignKey:OrderID"` // 与 Order 表建立一对一的关系
ProductID uint `gorm:"not null"`
Product *Product `gorm:"foreignKey:ProductID"`
Code string `gorm:"type:varchar(255)"` // 存储手机号码
SignFile string `gorm:"type:varchar(255)"`
Userid uint `gorm:"not null"` // 外键关联到 User 表的 userid
}
func (Query) TableName() string {
return "query"
}

59
model/model/render.go Normal file
View File

@@ -0,0 +1,59 @@
package model
type Render struct {
BaseModel
Title string `json:"title" gorm:"column:title;type:varchar(255);not null"`
Description string `json:"description" gorm:"column:description;type:varchar(255)"`
Remark string `json:"remark" gorm:"column:remark;type:varchar(255)"`
Enable bool `json:"enable" gorm:"column:enable;type:tinyint(1);not null"`
}
func (Render) TableName() string {
return "render"
}
type CarRender struct {
BaseModel
Title string `json:"title" gorm:"column:title;type:varchar(255);not null"`
Feature string `json:"feature" gorm:"column:feature;type:varchar(255);not null"`
Enable bool `json:"enable" gorm:"column:enable;type:tinyint(1);not null"`
}
func (CarRender) TableName() string {
return "car_render"
}
type VerifyRender struct {
BaseModel
Title string `json:"title" gorm:"column:title;type:varchar(255);not null"`
Feature string `json:"feature" gorm:"column:feature;type:varchar(255);not null"`
Enable bool `json:"enable" gorm:"column:enable;type:tinyint(1);not null"`
}
func (VerifyRender) TableName() string {
return "verify_render"
}
type GlobalNotification struct {
BaseModel
Show bool `gorm:"column:show;default:true"`
Title string `gorm:"column:title;type:varchar(255)"`
Image string `gorm:"column:image;type:text"`
Content string `gorm:"column:content;type:text"`
Platform string `gorm:"column:platform;type:varchar(10)"`
System string `gorm:"column:system;type:varchar(10)"`
Url string `gorm:"column:url;type:varchar(4096)"`
}
func (GlobalNotification) TableName() string {
return "global_notification"
}
type RenderShadow struct {
ID uint `gorm:"primarykey" json:"ID"` // 主键ID
Show bool `gorm:"column:show;default:false"`
}
func (RenderShadow) TableName() string {
return "render_shadow"
}

View File

@@ -0,0 +1,40 @@
package model
import "qnc-server/model/request"
type EvaluateMarriage struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
CardNo string `gorm:"column:card_no;type:varchar(255)"` // 卡号
Name string `gorm:"column:name;type:varchar(255)"` // 姓名
Mobile string `gorm:"column:mobile;type:varchar(255)"` // 手机号
Resp string `gorm:"column:overdue_selection_index_resp;type:varchar(3000)"`
OrderID uint `gorm:"column:order_id;not null"`
}
func (EvaluateMarriage) TableName() string {
return "evaluate_marriage"
}
type EvaluateMarriagePayload struct {
request.EvaluateMarriageReq
ProdID string
}
var SingleQueryProdIDParams = map[string][]string{
"FIN013": {"bcNo"},
"FIN019": {"mobile", "cardNo", "name", "bcNo"},
"IDV041": {"cardNo", "name", "pageNo", "pageSize"},
}
var SingleQueryProdIDs = map[string]string{
"BankCardGamblingAndFraud": "FIN013",
"BankCardBlacklistV1": "FIN019",
"EvaluateMarriage": "IDV041",
}
type MerryResponse struct {
Msg string `json:"msg"`
Code int `json:"code"`
Data string `json:"data"`
Success bool `json:"success"`
}

79
model/model/user.go Normal file
View File

@@ -0,0 +1,79 @@
package model
import (
"gorm.io/gorm"
"qnc-server/config"
"time"
)
// 全能查用户 结构体 User
type User struct {
BaseModel
Userid uint `json:"userid" form:"userid" gorm:"column:userid;comment:" binding:"required"` //userid
Phone string `json:"phone" form:"phone" gorm:"column:phone;"`
Disable *bool `json:"disable" form:"disable" gorm:"default:false;column:disable;comment:;" binding:"required"` //禁用
Inside bool `json:"inside" form:"inside" gorm:"column:inside;type:tinyint(1);comment:;default:0"`
}
// TableName 全能查用户 User自定义表名 user
func (User) TableName() string {
return "user"
}
type AuthType string
const (
AUTHTYPE_WECHAT_H5 AuthType = "wechat_h5"
AUTHTYPE_WECHAT_MP AuthType = "wechat_mp"
AUTHTYPE_PHONE AuthType = "phone"
)
type AuthIdentifier struct {
OpenID string `json:"openid" `
UnionID string `json:"unionid"`
Phone string `json:"phone"`
}
type Authentication struct {
ID uint `gorm:"primaryKey"`
UserID uint `gorm:"not null"`
AuthType AuthType `gorm:"type:ENUM('wechat_h5', 'wechat_mp', 'phone');not null"`
OpenID string `json:"openid"`
UnionID string `json:"unionid"`
Phone string `json:"phone"`
AuthData string
CreatedAt time.Time
UpdatedAt time.Time
User User `gorm:"foreignKey:UserID"`
}
func (Authentication) TableName() string {
return "authentication"
}
// BeforeCreate GORM的钩子在创建记录之前触发
func (user *User) BeforeCreate(tx *gorm.DB) (err error) {
// 查询当前数据库中最大的userid
var maxUserID uint
var StartingUserID = config.ConfigData.System.StartingUserId
if err = tx.Model(&User{}).Select("COALESCE(MAX(userid), 0)").Row().Scan(&maxUserID); err != nil {
return
}
// 确定下一个可用的userid要确保大于StartingUserID
if maxUserID >= StartingUserID {
maxUserID++
user.Userid = maxUserID
} else {
user.Userid = StartingUserID
}
return
}
type WxLoginResponse struct {
OpenId string `json:"openid"`
SessionKey string `json:"session_key"`
ErrCode int `json:"errcode"`
ErrMsg string `json:"errmsg"`
}

47
model/model/verify.go Normal file
View File

@@ -0,0 +1,47 @@
package model
type VerifyPhoneName struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Code string `gorm:"column:code;type:varchar(255);not null"`
Resp string `gorm:"column:resp;type:text;not null"`
OrderID uint `gorm:"column:order_id;not null"`
}
func (VerifyPhoneName) TableName() string {
return "verify_phone_name"
}
type VerifyCardName struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
OrderID uint `gorm:"column:order_id;not null"`
}
func (VerifyCardName) TableName() string {
return "verify_card_name"
}
type VerifyBankCard struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Code string `gorm:"column:code;type:varchar(255);not null"`
Resp string `gorm:"column:resp;type:text;not null"`
OrderID uint `gorm:"column:order_id;not null"`
}
func (VerifyBankCard) TableName() string {
return "verify_bank_card"
}
type VerifySkillCert struct {
BaseModel
UserID uint `gorm:"column:userid;not null"`
Resp string `gorm:"column:resp;type:text;not null"`
OrderID uint `gorm:"column:order_id;not null"`
}
func (VerifySkillCert) TableName() string {
return "verify_skill_cert"
}