plugins/plugins/qixing_alipay_redpack/internal/po/query.go

54 lines
1.2 KiB
Go

package po
import (
"fmt"
"gitea.cdlsxd.cn/sdk/plugin/proto"
"plugins/qixing_alipay_redpack/internal/vo"
)
type QueryReq struct {
BizNo string `json:"bizNo" validate:"required"`
BatchId string `json:"batchId" validate:"required"`
}
type Data struct {
BatchId string `json:"batchId"`
WxAppId string `json:"wxAppId"`
OpenId string `json:"openId"`
Name string `json:"name"`
Phone string `json:"phone"`
Amount float32 `json:"amount"`
BizNo string `json:"bizNo"`
Status string `json:"status"`
FailMsg string `json:"failMsg"`
Expand string `json:"expand"`
MchId string `json:"mchId"`
SendName string `json:"sendName"`
Remark string `json:"remark"`
}
type QueryResp struct {
Code any `json:"code"`
Msg string `json:"msg"`
Data *Data `json:"data"`
}
func (o *QueryResp) IsSuccess() bool {
strCode := fmt.Sprintf("%v", o.Code)
return strCode == "000000"
}
func (o *QueryResp) GetMsg() string {
code := vo.Code(fmt.Sprintf("%v", o.Code))
t := code.GetText()
if t == "" {
t = o.Msg
}
return fmt.Sprintf("[%s]-[%s]", code, t)
}
func (o *QueryResp) GetOrderStatus() proto.Status {
return vo.Status(o.Data.Status).GetOrderStatus()
}