order query
This commit is contained in:
parent
295923cccc
commit
465192e6fd
|
|
@ -92,8 +92,7 @@ func (this *CmbService) QueryOrder(ctx http.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *CmbService) QueryByOrderNo(ctx http.Context) error {
|
func (this *CmbService) QueryByOrderNo(ctx http.Context) error {
|
||||||
|
// 获取访问 ip
|
||||||
// 获取访问ip
|
|
||||||
ip := ctx.Request().Header.Get("X-Forwarded-For")
|
ip := ctx.Request().Header.Get("X-Forwarded-For")
|
||||||
if len(ip) == 0 {
|
if len(ip) == 0 {
|
||||||
ip = ctx.Request().RemoteAddr
|
ip = ctx.Request().RemoteAddr
|
||||||
|
|
@ -107,22 +106,11 @@ func (this *CmbService) QueryByOrderNo(ctx http.Context) error {
|
||||||
return fmt.Errorf("orderNo is empty")
|
return fmt.Errorf("orderNo is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
order, err := this.VoucherBiz.OrderQuery(ctx, orderNo)
|
order, err := this.VoucherBiz.OrderQuery(ctx.Request().Context(), orderNo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := "# <font color='green'>" +
|
|
||||||
"<h1>订单查询</h1>" +
|
|
||||||
"</font> \n" +
|
|
||||||
"<font color='black'>" +
|
|
||||||
"查询结果" +
|
|
||||||
"[<font color='red'>%s</font>]悉知" +
|
|
||||||
"</font>"
|
|
||||||
|
|
||||||
s := "\n订单号:%s\n招行订单号:%s\n订单状态:%s\nopenid:%s\n微信券ID:%s\n商品编号:%s\n批次号:%s\n商户号:%s\nappId:%s\n订单创建时间:%s\n" +
|
|
||||||
"领取成功时间(成功即有该值):%s\n最后一次核销时间(核销即有该值):%s\n订单备注说明(失败说明):%s\n"
|
|
||||||
|
|
||||||
receiveSuccessTimeStr := ""
|
receiveSuccessTimeStr := ""
|
||||||
if order.ReceiveSuccessTime != nil {
|
if order.ReceiveSuccessTime != nil {
|
||||||
receiveSuccessTimeStr = order.ReceiveSuccessTime.Format("2006-01-02 15:04:05")
|
receiveSuccessTimeStr = order.ReceiveSuccessTime.Format("2006-01-02 15:04:05")
|
||||||
|
|
@ -131,7 +119,99 @@ func (this *CmbService) QueryByOrderNo(ctx http.Context) error {
|
||||||
if order.LastUseTime != nil {
|
if order.LastUseTime != nil {
|
||||||
lastUseTimeStr = order.LastUseTime.Format("2006-01-02 15:04:05")
|
lastUseTimeStr = order.LastUseTime.Format("2006-01-02 15:04:05")
|
||||||
}
|
}
|
||||||
orderMsg := fmt.Sprintf(s,
|
|
||||||
|
html := `
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>订单查询结果</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>订单查询</h1>
|
||||||
|
<p>查询结果 [<span style="color: red;">%s</span>] 悉知</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>订单号</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>招行订单号</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>订单状态</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>openid</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>微信券 ID</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>商品编号</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>批次号</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>商户号</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>appId</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>订单创建时间</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>领取成功时间(成功即有该值)</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>最后一次核销时间(核销即有该值)</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>订单备注说明(失败说明)</th>
|
||||||
|
<td>%s</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`
|
||||||
|
|
||||||
|
str := fmt.Sprintf(html,
|
||||||
|
orderNo,
|
||||||
orderNo,
|
orderNo,
|
||||||
order.OutBizNo,
|
order.OutBizNo,
|
||||||
order.Status.GetText(),
|
order.Status.GetText(),
|
||||||
|
|
@ -147,7 +227,5 @@ func (this *CmbService) QueryByOrderNo(ctx http.Context) error {
|
||||||
order.Remark,
|
order.Remark,
|
||||||
)
|
)
|
||||||
|
|
||||||
str := fmt.Sprintf(msg, orderMsg)
|
|
||||||
|
|
||||||
return ctx.String(http2.StatusOK, str)
|
return ctx.String(http2.StatusOK, str)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue