后台,订单字段调整fix
This commit is contained in:
parent
a7cf191437
commit
0ac4feb07a
|
@ -47,16 +47,17 @@ var MsgEN = map[int]string{
|
||||||
}
|
}
|
||||||
|
|
||||||
var MsgZH = map[int]string{
|
var MsgZH = map[int]string{
|
||||||
Success: "请求成功",
|
Success: "请求成功",
|
||||||
ParamError: "参数错误",
|
ParamError: "参数错误",
|
||||||
NotFound: "数据不存在",
|
NotFound: "数据不存在",
|
||||||
NotAuth: "未经授权",
|
NotAuth: "未经授权",
|
||||||
NotLogin: "未登录",
|
NotLogin: "未登录",
|
||||||
RequestTimeOut: "请求超时",
|
RequestTimeOut: "请求超时",
|
||||||
MerchantNotFound: "商户不存在",
|
MerchantNotFound: "商户不存在",
|
||||||
AppNotFound: "app_id未找到",
|
AppNotFound: "app_id未找到",
|
||||||
AppDisabled: "app通道关闭",
|
AppDisabled: "app通道关闭",
|
||||||
AppIpNotAllow: "ip不在白名单内",
|
AppIpNotAllow: "ip不在白名单内",
|
||||||
|
SystemError: "系统错误",
|
||||||
PayChannelNotFound: "支付方式不存在",
|
PayChannelNotFound: "支付方式不存在",
|
||||||
}
|
}
|
||||||
var MsgMap map[string]map[int]string = map[string]map[int]string{"en": MsgZH}
|
var MsgMap map[string]map[int]string = map[string]map[int]string{"en": MsgZH}
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (m *OrderRepo) OrdersBackendList(conn builder.Cond, pageFilter entities.Pag
|
||||||
}
|
}
|
||||||
repo = repo.Join("left", "app", "app.id = orders.app_id").
|
repo = repo.Join("left", "app", "app.id = orders.app_id").
|
||||||
Join("left", "merchant", "merchant.id = orders.merchant_id").
|
Join("left", "merchant", "merchant.id = orders.merchant_id").
|
||||||
Join("left", "pay_channel", "pay_channel.id = orders.pay_id")
|
Join("left", "pay_channel", "pay_channel.id = orders.pay_channel_id")
|
||||||
return repo.Desc("create_time").FindAndCount(orderList)
|
return repo.Desc("create_time").FindAndCount(orderList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,27 +12,27 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderListRequest struct {
|
type OrderListRequest struct {
|
||||||
Id int64 `json:"id" form:"id"`
|
Id int64 `json:"id" form:"id"`
|
||||||
MerchantId int64 `json:"merchant_id" form:"merchant_id"`
|
MerchantId int64 `json:"merchant_id" form:"merchant_id"`
|
||||||
PayId int64 `json:"pay_id" form:"pay_id"`
|
PayChannelId int64 `json:"pay_channel_id" form:"pay_channel_id"`
|
||||||
AppId int64 `json:"app_id" form:"app_id"`
|
AppId int64 `json:"app_id" form:"app_id"`
|
||||||
MerchantOrderId string `json:"merchant_order_id" form:"merchant_order_id"`
|
OutTreadNo string `json:"out_tread_no" form:"out_tread_no"`
|
||||||
Status int `json:"status" form:"status"`
|
Status int `json:"status" form:"status"`
|
||||||
OrderType int `json:"order_type" form:"order_type"`
|
OrderType int `json:"order_type" form:"order_type"`
|
||||||
StartTime string `json:"start_time" form:"start_time"`
|
StartTime string `json:"start_time" form:"start_time"`
|
||||||
EndTime string `json:"end_time" form:"end_time"`
|
EndTime string `json:"end_time" form:"end_time"`
|
||||||
entities.PageRequest
|
entities.PageRequest
|
||||||
}
|
}
|
||||||
type OrderList struct {
|
type OrderList struct {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
MerchantId int64 `json:"merchant_id"`
|
MerchantId int64 `json:"merchant_id"`
|
||||||
PayId int64 `json:"pay_id"`
|
PayChannelId int64 `json:"pay_channel_id"`
|
||||||
AppId int64 `json:"app_id"`
|
AppId int64 `json:"app_id"`
|
||||||
MerchantOrderId string `json:"merchant_order_id"`
|
OutTreadNo string `json:"out_tread_no"`
|
||||||
Status int `json:"status"`
|
Status int `json:"status"`
|
||||||
OrderType int `json:"order_type"`
|
OrderType int `json:"order_type"`
|
||||||
StartTime time.Time `json:"start_time"`
|
StartTime time.Time `json:"start_time"`
|
||||||
EndTime time.Time `json:"end_time"`
|
EndTime time.Time `json:"end_time"`
|
||||||
entities.PageRequest
|
entities.PageRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ func (o *OrderListRequest) ValidateRequest() (r OrderList, err error) {
|
||||||
|
|
||||||
r.Id = o.Id
|
r.Id = o.Id
|
||||||
r.MerchantId = o.MerchantId
|
r.MerchantId = o.MerchantId
|
||||||
r.PayId = o.PayId
|
r.PayChannelId = o.PayChannelId
|
||||||
r.AppId = o.AppId
|
r.AppId = o.AppId
|
||||||
r.MerchantOrderId = o.MerchantOrderId
|
r.OutTreadNo = o.OutTreadNo
|
||||||
r.Status = o.Status
|
r.Status = o.Status
|
||||||
r.OrderType = o.OrderType
|
r.OrderType = o.OrderType
|
||||||
r.PageRequest = o.PageRequest
|
r.PageRequest = o.PageRequest
|
||||||
|
@ -65,24 +65,20 @@ func (o *OrderListRequest) ValidateRequest() (r OrderList, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrdersResponse struct {
|
type OrdersResponse struct {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
MerchantId int64 `json:"merchant_id"`
|
MerchantId int64 `json:"merchant_id"`
|
||||||
PayChannelId int64 `json:"pay_channel_id"`
|
PayChannelId int64 `json:"pay_channel_id"`
|
||||||
AppId int64 `json:"app_id"`
|
AppId int64 `json:"app_id"`
|
||||||
OutTreadNo string `json:"out_tread_no"`
|
OutTreadNo string `json:"out_tread_no"`
|
||||||
Status int `json:"status"`
|
Status int `json:"status"`
|
||||||
OrderType int `json:"order_type"`
|
OrderType int `json:"order_type"`
|
||||||
Amount int `json:"amount"`
|
Amount int `json:"amount"`
|
||||||
IpAddress string `json:"ip_address"`
|
ExtJson string `json:"ext_json"`
|
||||||
MerchantRequest string `json:"merchant_request"`
|
CreateTime string `json:"create_time"`
|
||||||
MerchantResponse string `json:"merchant_response"`
|
UpdateTime string `json:"update_time"`
|
||||||
OrderResponse string `json:"order_response"`
|
MerchantName string `json:"merchant_name"`
|
||||||
ExtJson string `json:"ext_json"`
|
PayName string `json:"pay_name"`
|
||||||
CreateTime string `json:"create_time"`
|
AppName string `json:"app_name"`
|
||||||
UpdateTime string `json:"update_time"`
|
|
||||||
MerchantName string `json:"merchant_name"`
|
|
||||||
PayName string `json:"pay_name"`
|
|
||||||
AppName string `json:"app_name"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OrdersResponse) ResponseFromDb(db ordersmodel.OrdersBackendList) {
|
func (o *OrdersResponse) ResponseFromDb(db ordersmodel.OrdersBackendList) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ type PayChannelResponse struct {
|
||||||
AppId string `json:"app_id"`
|
AppId string `json:"app_id"`
|
||||||
ExpireTime string `json:"expire_time"`
|
ExpireTime string `json:"expire_time"`
|
||||||
CreateTime string `json:"create_time"`
|
CreateTime string `json:"create_time"`
|
||||||
AliPayPayChannel *AliPayPayChannel `json:"ali_pay_pay_channel,omitempty"`
|
AliPayChannel *AliPayChannel `json:"ali_pay_channel,omitempty"`
|
||||||
WechatPayChannel *WechatPayChannel `json:"wechat_pay_channel,omitempty"`
|
WechatPayChannel *WechatPayChannel `json:"wechat_pay_channel,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func (p *PayChannelResponse) ResponseFromDb(db paychannelmodel.PayChannel) {
|
||||||
case common.PAY_CHANNEL_WECHAT_H5, common.PAY_CHANNEL_WECHAT_JSAPI, common.PAY_CHANNEL_WECHAT_NATIVE, common.PAY_CHANNEL_WECHAT_APP, common.PAY_CHANNEL_WECHAT_MINI:
|
case common.PAY_CHANNEL_WECHAT_H5, common.PAY_CHANNEL_WECHAT_JSAPI, common.PAY_CHANNEL_WECHAT_NATIVE, common.PAY_CHANNEL_WECHAT_APP, common.PAY_CHANNEL_WECHAT_MINI:
|
||||||
_ = json.Unmarshal([]byte(db.ExtJson), &p.WechatPayChannel)
|
_ = json.Unmarshal([]byte(db.ExtJson), &p.WechatPayChannel)
|
||||||
case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI:
|
case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI:
|
||||||
_ = json.Unmarshal([]byte(db.ExtJson), &p.AliPayPayChannel)
|
_ = json.Unmarshal([]byte(db.ExtJson), &p.AliPayChannel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ type PayChannelCreateRequest struct {
|
||||||
ChannelType int `json:"channel_type" validate:"required" label:"支付渠道"` //支付渠道枚举,1微信JSAPI,2微信H5,3微信app,4微信Native,5微信小程序,6支付宝网页&移动应用,7支付宝小程序,8支付宝JSAPI
|
ChannelType int `json:"channel_type" validate:"required" label:"支付渠道"` //支付渠道枚举,1微信JSAPI,2微信H5,3微信app,4微信Native,5微信小程序,6支付宝网页&移动应用,7支付宝小程序,8支付宝JSAPI
|
||||||
AppId string `json:"app_id" validate:"required" label:"应用appId"`
|
AppId string `json:"app_id" validate:"required" label:"应用appId"`
|
||||||
ExpireTime string `json:"expire_time"`
|
ExpireTime string `json:"expire_time"`
|
||||||
AliPayPayChannel AliPayPayChannel `json:"ali_pay_pay_channel,omitempty"`
|
AliPayChannel AliPayChannel `json:"ali_pay_channel,omitempty"`
|
||||||
WechatPayChannel WechatPayChannel `json:"wechat_pay_channel,omitempty"`
|
WechatPayChannel WechatPayChannel `json:"wechat_pay_channel,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ type WechatPayChannel struct {
|
||||||
PrivateKey string `json:"private_key"` // 私钥 apiclient_key.pem 读取后的内容
|
PrivateKey string `json:"private_key"` // 私钥 apiclient_key.pem 读取后的内容
|
||||||
}
|
}
|
||||||
|
|
||||||
type AliPayPayChannel struct {
|
type AliPayChannel struct {
|
||||||
PrivateKey string `json:"private_key"` // 应用私钥
|
PrivateKey string `json:"private_key"` // 应用私钥
|
||||||
AppPublicCert string `json:"app_public_cert"` // 应用公钥
|
AppPublicCert string `json:"app_public_cert"` // 应用公钥
|
||||||
AlipayRootCert string `json:"alipay_root_cert"` // 支付宝根证书
|
AlipayRootCert string `json:"alipay_root_cert"` // 支付宝根证书
|
||||||
|
@ -78,7 +78,7 @@ func (p *PayChannelCreateRequest) RequestToDb() (db paychannelmodel.PayChannel,
|
||||||
b, _ := json.Marshal(p.WechatPayChannel)
|
b, _ := json.Marshal(p.WechatPayChannel)
|
||||||
db.ExtJson = string(b)
|
db.ExtJson = string(b)
|
||||||
case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI:
|
case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI:
|
||||||
b, _ := json.Marshal(p.AliPayPayChannel)
|
b, _ := json.Marshal(p.AliPayChannel)
|
||||||
db.ExtJson = string(b)
|
db.ExtJson = string(b)
|
||||||
default:
|
default:
|
||||||
err = errors.New("支付渠道类型错误")
|
err = errors.New("支付渠道类型错误")
|
||||||
|
@ -98,7 +98,7 @@ type PayChannelUpdateRequest struct {
|
||||||
ChannelType int `json:"channel_type" validate:"required" label:"支付渠道"` //支付渠道枚举,1微信JSAPI,2微信H5,3微信app,4微信Native,5微信小程序,6支付宝网页&移动应用,7支付宝小程序,8支付宝JSAPI
|
ChannelType int `json:"channel_type" validate:"required" label:"支付渠道"` //支付渠道枚举,1微信JSAPI,2微信H5,3微信app,4微信Native,5微信小程序,6支付宝网页&移动应用,7支付宝小程序,8支付宝JSAPI
|
||||||
AppId string `json:"app_id" validate:"required" label:"应用appId"`
|
AppId string `json:"app_id" validate:"required" label:"应用appId"`
|
||||||
ExpireTime string `json:"expire_time"`
|
ExpireTime string `json:"expire_time"`
|
||||||
AliPayPayChannel AliPayPayChannel `json:"ali_pay_pay_channel,omitempty"`
|
AliPayChannel AliPayChannel `json:"ali_pay_channel,omitempty"`
|
||||||
WechatPayChannel WechatPayChannel `json:"wechat_pay_channel,omitempty"`
|
WechatPayChannel WechatPayChannel `json:"wechat_pay_channel,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ func (p PayChannelUpdateRequest) RequestToDb() (db paychannelmodel.PayChannel, e
|
||||||
b, _ := json.Marshal(p.WechatPayChannel)
|
b, _ := json.Marshal(p.WechatPayChannel)
|
||||||
db.ExtJson = string(b)
|
db.ExtJson = string(b)
|
||||||
case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI:
|
case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI:
|
||||||
b, _ := json.Marshal(p.AliPayPayChannel)
|
b, _ := json.Marshal(p.AliPayChannel)
|
||||||
db.ExtJson = string(b)
|
db.ExtJson = string(b)
|
||||||
default:
|
default:
|
||||||
err = errors.New("支付渠道类型错误")
|
err = errors.New("支付渠道类型错误")
|
||||||
|
|
|
@ -21,14 +21,14 @@ func OrderList(req backend.OrderList) (result []ordersmodel.OrdersBackendList, t
|
||||||
if req.MerchantId > 0 {
|
if req.MerchantId > 0 {
|
||||||
conn = conn.And(builder.Eq{"merchant_id": req.MerchantId})
|
conn = conn.And(builder.Eq{"merchant_id": req.MerchantId})
|
||||||
}
|
}
|
||||||
if req.PayId > 0 {
|
if req.PayChannelId > 0 {
|
||||||
conn = conn.And(builder.Eq{"pay_id": req.PayId})
|
conn = conn.And(builder.Eq{"pay_channel_id": req.PayChannelId})
|
||||||
}
|
}
|
||||||
if req.AppId > 0 {
|
if req.AppId > 0 {
|
||||||
conn = conn.And(builder.Eq{"app_id": req.AppId})
|
conn = conn.And(builder.Eq{"app_id": req.AppId})
|
||||||
}
|
}
|
||||||
if req.MerchantOrderId != "" {
|
if req.OutTreadNo != "" {
|
||||||
conn = conn.And(builder.Like{"merchant_order_id", req.MerchantOrderId})
|
conn = conn.And(builder.Like{"out_tread_no", req.OutTreadNo})
|
||||||
}
|
}
|
||||||
if req.Status > 0 {
|
if req.Status > 0 {
|
||||||
conn = conn.And(builder.Eq{"status": req.Status})
|
conn = conn.And(builder.Eq{"status": req.Status})
|
||||||
|
|
Loading…
Reference in New Issue