qnc init
This commit is contained in:
38
model/response/common.go
Normal file
38
model/response/common.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package response
|
||||
|
||||
type ThreeElementsResp struct {
|
||||
Data ThreeElementsRespData `json:"data"` // 使用指针和omitempty处理可能缺失的字段
|
||||
Resp ThreeElementsRespResp `json:"resp"`
|
||||
}
|
||||
type ThreeElementsRespData struct {
|
||||
AreaCode string `json:"areacode"`
|
||||
ISP string `json:"isp"`
|
||||
ID string `json:"id"`
|
||||
City string `json:"city"`
|
||||
Mobile string `json:"Mobile"`
|
||||
Name string `json:"Name"`
|
||||
Postcode string `json:"postcode"`
|
||||
}
|
||||
|
||||
type ThreeElementsRespResp struct {
|
||||
Code string `json:"code"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
// Data 结构体表示响应中的数据部分
|
||||
type TwoElementsData struct {
|
||||
Birthday string `json:"birthday"`
|
||||
Result int `json:"result"`
|
||||
Address string `json:"address"`
|
||||
OrderNo string `json:"orderNo"`
|
||||
Sex string `json:"sex"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
// Response 结构体表示整个响应
|
||||
type TwoElementsResp struct {
|
||||
Msg string `json:"msg"`
|
||||
Success bool `json:"success"`
|
||||
Code int `json:"code"`
|
||||
Data *TwoElementsData `json:"data"` // 使用指针类型,以便在失败响应时处理为 nil
|
||||
}
|
||||
24
model/response/ent.go
Normal file
24
model/response/ent.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package response
|
||||
|
||||
type EntResponse struct {
|
||||
ErrorCode int `json:"error_code"`
|
||||
Reason string `json:"reason"`
|
||||
Result interface{} `json:"result"`
|
||||
}
|
||||
|
||||
var EntRepsStatusCodeMap = map[int]string{
|
||||
0: "请求成功",
|
||||
300000: "经查无结果",
|
||||
300001: "请求失败",
|
||||
300002: "账号失效",
|
||||
300003: "账号过期",
|
||||
300004: "访问频率过快",
|
||||
300005: "无权限访问此api",
|
||||
300006: "余额不足",
|
||||
300007: "剩余次数不足",
|
||||
300008: "缺少必要参数",
|
||||
300009: "账号信息有误",
|
||||
300010: "URL不存在",
|
||||
300011: "此IP无权限访问此api",
|
||||
300012: "报告生成中",
|
||||
}
|
||||
17
model/response/feature.go
Normal file
17
model/response/feature.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package response
|
||||
|
||||
// 成功的 OCR 响应结构
|
||||
type OcrSuccessResponse struct {
|
||||
WordsResult []struct {
|
||||
Words string `json:"words"`
|
||||
} `json:"words_result"`
|
||||
WordsResultNum int `json:"words_result_num"`
|
||||
LogID int `json:"log_id"`
|
||||
}
|
||||
|
||||
// 失败的 OCR 响应结构
|
||||
type OcrErrorResponse struct {
|
||||
LogID string `json:"log_id"`
|
||||
ErrorMsg string `json:"error_msg"`
|
||||
ErrorCode int `json:"error_code"`
|
||||
}
|
||||
78
model/response/lawsuitQuery.go
Normal file
78
model/response/lawsuitQuery.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package response
|
||||
|
||||
import "qnc-server/model/model"
|
||||
|
||||
type CombinedResponse struct {
|
||||
ListResp []CaseDetail `json:"listResp"`
|
||||
SxrResp []SxrDetail `json:"sxrResp"`
|
||||
LimitHightResp []LimitHightDetail `json:"limitHightResp"`
|
||||
IDInfo model.IDInfo `json:"id_info"`
|
||||
Name string `json:"name" `
|
||||
Mobile string `json:"mobile"`
|
||||
CardNo string `json:"card_no" `
|
||||
}
|
||||
type LawsuitQueryListResponse struct {
|
||||
OrderNo string `json:"orderNo"`
|
||||
Rc string `json:"rc"`
|
||||
Msg string `json:"msg"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type LawsuitQueryListData struct {
|
||||
Count int `json:"count"`
|
||||
List []CaseDetail `json:"list"`
|
||||
}
|
||||
type CaseDetail struct {
|
||||
Content string `json:"content"`
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
CaseCode string `json:"caseCode"`
|
||||
Court string `json:"court"`
|
||||
StandPoint string `json:"standPoint"`
|
||||
PublishDate string `json:"publishDate"`
|
||||
}
|
||||
type SxrDetail struct {
|
||||
EntityName string `json:"entityName"`
|
||||
EntityID string `json:"entityId"`
|
||||
CaseCode string `json:"caseCode"`
|
||||
Age string `json:"age"`
|
||||
Sex string `json:"sex"`
|
||||
BusinessEntity string `json:"bussinessEntity"` // 注意这里是原始 JSON 中的拼写错误,应为 "businessEntity"
|
||||
CourtName string `json:"courtName"`
|
||||
AreaName string `json:"areaName"`
|
||||
PartyTypeName string `json:"partyTypeName"`
|
||||
GistID string `json:"gistId"`
|
||||
RegDate string `json:"regDate"`
|
||||
GistUnit string `json:"gistUnit"`
|
||||
Duty string `json:"duty"`
|
||||
Performance string `json:"performance"`
|
||||
PerformedPart string `json:"performedPart"`
|
||||
UnperformPart string `json:"unPerformPart"` // 注意这里是原始 JSON 中的拼写错误,应为 "unperformPart"
|
||||
DisruptTypeName string `json:"disruptTypeName"`
|
||||
PublishDate string `json:"publishDate"`
|
||||
RelateType string `json:"relateType"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type LawsuitLimitHightQueryListResponse struct {
|
||||
Data interface{} `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
Success bool `json:"success"`
|
||||
Code int `json:"code"`
|
||||
TaskNo string `json:"taskNo"`
|
||||
}
|
||||
type LimitHightData struct {
|
||||
CaseCount int `json:"caseCount"`
|
||||
CaseList []LimitHightDetail `json:"caseList"`
|
||||
}
|
||||
type LimitHightDetail struct {
|
||||
Datatype string `json:"datatype"`
|
||||
IName string `json:"iname"`
|
||||
SexName string `json:"sexname"`
|
||||
Age string `json:"age"`
|
||||
CaseCode string `json:"casecode"`
|
||||
AreaName string `json:"areaname"`
|
||||
CourtName string `json:"courtname"`
|
||||
RegDate string `json:"regdate"`
|
||||
PublishDate string `json:"publishdate"`
|
||||
}
|
||||
8
model/response/pay.go
Normal file
8
model/response/pay.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package response
|
||||
|
||||
import "github.com/wechatpay-apiv3/wechatpay-go/services/payments/jsapi"
|
||||
|
||||
type PrepayResponse struct {
|
||||
Resp *jsapi.PrepayWithRequestPaymentResponse `json:"resp"`
|
||||
Result string `json:"result"`
|
||||
}
|
||||
93
model/response/response.go
Normal file
93
model/response/response.go
Normal file
@@ -0,0 +1,93 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Response struct {
|
||||
Code int `json:"code"`
|
||||
Data interface{} `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
const (
|
||||
SUCCESS = 0 //成功
|
||||
EMPTY = 1 //为空
|
||||
SIGN = 2
|
||||
NOTIFY = 3 //通知
|
||||
NeedAuth = 4 //需要登录
|
||||
NeedManualAuth = 5 //需要手动授权登录
|
||||
Wait = 6 //等待结果
|
||||
ERROR = 7 //报错
|
||||
NeedPay = 8 //需要支付
|
||||
Refund = 9 //查询为空或错误,提示退款
|
||||
)
|
||||
|
||||
func Result(code int, data interface{}, msg string, c *gin.Context) {
|
||||
c.JSON(http.StatusOK, Response{
|
||||
code,
|
||||
data,
|
||||
msg,
|
||||
})
|
||||
}
|
||||
|
||||
func Ok(c *gin.Context) {
|
||||
Result(SUCCESS, map[string]interface{}{}, "操作成功", c)
|
||||
}
|
||||
func OkWithMessage(message string, c *gin.Context) {
|
||||
Result(SUCCESS, map[string]interface{}{}, message, c)
|
||||
}
|
||||
|
||||
func OkWithData(data interface{}, c *gin.Context) {
|
||||
Result(SUCCESS, data, "查询成功", c)
|
||||
}
|
||||
|
||||
func OkWithDetailed(data interface{}, message string, c *gin.Context) {
|
||||
Result(SUCCESS, data, message, c)
|
||||
}
|
||||
func OkWithEmpty(c *gin.Context) {
|
||||
Result(EMPTY, map[string]interface{}{}, "查询为空", c)
|
||||
}
|
||||
func Fail(c *gin.Context) {
|
||||
Result(ERROR, map[string]interface{}{}, "操作失败", c)
|
||||
}
|
||||
|
||||
func FailWithMessage(message string, c *gin.Context) {
|
||||
Result(ERROR, map[string]interface{}{}, message, c)
|
||||
}
|
||||
|
||||
func NoAuth(message string, c *gin.Context) {
|
||||
c.JSON(http.StatusUnauthorized, Response{
|
||||
NeedAuth,
|
||||
nil,
|
||||
message,
|
||||
})
|
||||
}
|
||||
func ManualAuth(c *gin.Context) {
|
||||
c.JSON(SUCCESS, Response{
|
||||
NeedManualAuth,
|
||||
nil,
|
||||
"需要手动授权",
|
||||
})
|
||||
}
|
||||
func FailWithDetailed(data interface{}, message string, c *gin.Context) {
|
||||
Result(ERROR, data, message, c)
|
||||
}
|
||||
|
||||
func OkNeedPay(c *gin.Context) {
|
||||
Result(NeedPay, map[string]interface{}{}, "请支付", c)
|
||||
}
|
||||
|
||||
func FailRefund(c *gin.Context) {
|
||||
Result(Refund, map[string]interface{}{}, "无相关记录或系统错误", c)
|
||||
}
|
||||
func OkWait(c *gin.Context) {
|
||||
Result(Wait, map[string]interface{}{}, "提交成功", c)
|
||||
}
|
||||
func FailNotify(c *gin.Context) {
|
||||
Result(NOTIFY, map[string]interface{}{}, "通知", c)
|
||||
}
|
||||
func OkNeedSign(c *gin.Context) {
|
||||
Result(SIGN, map[string]interface{}{}, "需要签名", c)
|
||||
}
|
||||
41
model/response/user.go
Normal file
41
model/response/user.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package response
|
||||
|
||||
import "qnc-server/model/model"
|
||||
|
||||
type WxLoginResp struct {
|
||||
OpenId string `json:"openid"`
|
||||
SessionKey string `json:"session_key"`
|
||||
Unionid string `json:"unionid"`
|
||||
ErrCode int `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
}
|
||||
type WxH5LoginResp struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
ExpiresIn int `json:"expires_in"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
Openid string `json:"openid"`
|
||||
Scope string `json:"scope"`
|
||||
IsSnapshotuser int `json:"is_snapshotuser"`
|
||||
Unionid string `json:"unionid"`
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
}
|
||||
type WeChatUserInfoResp struct {
|
||||
OpenID string `json:"openid"`
|
||||
Nickname string `json:"nickname"`
|
||||
Sex int `json:"sex"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
Country string `json:"country"`
|
||||
HeadImgURL string `json:"headimgurl"`
|
||||
Privilege []string `json:"privilege"`
|
||||
UnionID string `json:"unionid"`
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
}
|
||||
type LoginResponse struct {
|
||||
User model.User `json:"user"`
|
||||
Token string `json:"token"`
|
||||
//AuthIdentifier model.AuthIdentifier `json:"auth_identifier"`
|
||||
ExpiresAt int64 `json:"expiresAt"`
|
||||
}
|
||||
28
model/response/verify.go
Normal file
28
model/response/verify.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package response
|
||||
|
||||
type VerifyPhoneRespData struct {
|
||||
Result string `json:"result"`
|
||||
ResultMsg string `json:"resultMsg"`
|
||||
}
|
||||
|
||||
type VerifyPhoneResp struct {
|
||||
Data VerifyPhoneRespData `json:"data"`
|
||||
}
|
||||
|
||||
// 通用的响应结构体
|
||||
type VerifyCardResp struct {
|
||||
Msg string `json:"msg"`
|
||||
Success bool `json:"success"`
|
||||
Code int `json:"code"`
|
||||
Data *VerifyCardRespData `json:"data"` // 使用 json.RawMessage 暂存 data 字段的数据
|
||||
}
|
||||
|
||||
// 成功时的数据结构体
|
||||
type VerifyCardRespData struct {
|
||||
Birthday string `json:"birthday,omitempty"`
|
||||
Result int `json:"result,omitempty"` // 1.不一致 0.一致
|
||||
Address string `json:"address,omitempty"`
|
||||
OrderNo string `json:"orderNo,omitempty"`
|
||||
Sex string `json:"sex,omitempty"`
|
||||
Desc string `json:"desc,omitempty"`
|
||||
}
|
||||
19
model/response/westdex.go
Normal file
19
model/response/westdex.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package response
|
||||
|
||||
type WestdexResp struct {
|
||||
Message string `json:"message"`
|
||||
Code string `json:"code"`
|
||||
Data string `json:"data"`
|
||||
ID string `json:"id"`
|
||||
ErrorCode *int `json:"error_code"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
type Wrapper[T any] struct {
|
||||
Data T `json:"data"`
|
||||
}
|
||||
|
||||
type ThreeElementsResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
PhoneType string `json:"phoneType"`
|
||||
}
|
||||
Reference in New Issue
Block a user