sfps callback

This commit is contained in:
richboo111
2023-06-01 17:22:38 +08:00
parent 69183b4802
commit 2e0dc42f72
4 changed files with 46 additions and 27 deletions

View File

@@ -1,7 +1,9 @@
package controllers
import (
"bytes"
"encoding/json"
"fmt"
"git.rosy.net.cn/jx-callback/business/partner/purchase/im"
"github.com/astaxie/beego/server/web"
@@ -78,12 +80,17 @@ func (c *IMController) SetImMsgRead() {
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SendToVendor [post]
//func (c *IMController) SendToVendor() {
// c.callSendToVendor(func(params *tImSendToVendorParams) (retVal interface{}, errCode string, err error) {
// var sendData im.SendData
// if err = json.Unmarshal([]byte(params.SendData), &sendData); err == nil {
// im.SendToVendor(sendData)
// }
// return nil, "", err
// })
//}
func (c *IMController) SendToVendor() {
c.callSendToVendor(func(params *tImSendToVendorParams) (retVal interface{}, errCode string, err error) {
var sendData im.SendData
b := bytes.NewBufferString(params.SendData)
decoder := json.NewDecoder(b)
_ = decoder.Decode(&sendData)
fmt.Println(sendData)
if dataStr, err := json.Marshal(sendData); err == nil {
im.SendToVendor(dataStr)
}
return nil, "", err
})
}