mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-19 01:36:38 +08:00
opt: compatible wechat old message format for parsing wechat transfer message
This commit is contained in:
parent
27b68c1174
commit
378e6ec9af
@ -69,7 +69,7 @@ func (b *Bot) messageHandler(msg *openwechat.Message) {
|
||||
logger.Infof("解析到收款信息:%+v", transaction)
|
||||
var item model.Reward
|
||||
res := b.db.Where("tx_id = ?", transaction.TransId).First(&item)
|
||||
if res.Error == nil {
|
||||
if item.Id > 0 {
|
||||
logger.Error("当前交易 ID 己经存在!")
|
||||
return
|
||||
}
|
||||
|
@ -47,6 +47,20 @@ func parseTransactionMessage(xmlData string) *Message {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 兼容旧版消息记录
|
||||
if message.Url == "" {
|
||||
var msg struct {
|
||||
XMLName xml.Name `xml:"msg"`
|
||||
AppMsg struct {
|
||||
Des string `xml:"des"`
|
||||
Url string `xml:"url"`
|
||||
} `xml:"appmsg"`
|
||||
}
|
||||
if err := xml.Unmarshal([]byte(xmlData), &msg); err == nil {
|
||||
message.Url = msg.AppMsg.Url
|
||||
}
|
||||
}
|
||||
return &message
|
||||
}
|
||||
|
||||
@ -81,5 +95,6 @@ func extractTransaction(message *Message) Transaction {
|
||||
if err == nil {
|
||||
tx.TransId = parse.Query().Get("id")
|
||||
}
|
||||
|
||||
return tx
|
||||
}
|
||||
|
@ -202,6 +202,7 @@ const fetch = () => {
|
||||
// 编辑
|
||||
const curIndex = ref(0)
|
||||
const rowEdit = function (index, row) {
|
||||
title.value = "编辑函数"
|
||||
curIndex.value = index
|
||||
item.value = copyObj(row)
|
||||
// initialize parameters
|
||||
|
Loading…
Reference in New Issue
Block a user