物流笑嘻嘻
This commit is contained in:
@@ -106,6 +106,8 @@ func Pay(ctx *jxcontext.Context, orderID string, payType int, vendorPayType, app
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
|
||||
// 给用户创建一个银行卡账户
|
||||
userBill, err := dao.GetUserBill(db, order.UserID, "")
|
||||
if userBill == nil {
|
||||
err = financial.AddUserBill(txDB, jxutils.GenBillID(), order.UserID)
|
||||
|
||||
@@ -321,11 +321,6 @@ func AddMyDeliveryAddress(ctx *jxcontext.Context, address *model.UserDeliveryAdd
|
||||
return list[0], err
|
||||
}
|
||||
|
||||
// GetAddressDetail 获取配送地址详情
|
||||
func GetAddressDetail(id int, userId string) {
|
||||
|
||||
}
|
||||
|
||||
func DeleteUserDeliveryAddress(ctx *jxcontext.Context, userID string, addressID int) (err error) {
|
||||
num, err := dao.DeleteEntityLogically(dao.GetDB(), &model.UserDeliveryAddress{}, nil, ctx.GetUserName(), map[string]interface{}{
|
||||
model.FieldID: addressID,
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
type Store4User struct {
|
||||
@@ -62,165 +53,166 @@ func (x Store4UserList) Swap(i, j int) {
|
||||
x[i], x[j] = x[j], x[i]
|
||||
}
|
||||
|
||||
func GetNearSupplyGoodsStoreByStoreID(ctx *jxcontext.Context, storeID int) (store *model.Store, err error) {
|
||||
var (
|
||||
stores []*model.Store
|
||||
db = dao.GetDB()
|
||||
)
|
||||
store2, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX)
|
||||
if store2 == nil {
|
||||
return nil, fmt.Errorf("该门店未绑定京西平台!storeID: %v", storeID)
|
||||
}
|
||||
if store2.IsSupplyGoods == model.YES {
|
||||
return nil, fmt.Errorf("该门店已经是货源门店,无法从其他货源门店进货!storeID: %v", storeID)
|
||||
}
|
||||
sql := `
|
||||
SELECT a.*
|
||||
FROM store a
|
||||
JOIN store_map b ON b.store_id = a.id
|
||||
JOIN store c ON c.city_code = a.city_code AND c.id = ?
|
||||
WHERE a.deleted_at = ?
|
||||
AND b.deleted_at = ?
|
||||
AND b.vendor_id = ?
|
||||
AND b.is_supply_goods = ?
|
||||
AND a.status = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
storeID,
|
||||
utils.DefaultTimeValue, utils.DefaultTimeValue,
|
||||
model.VendorIDJX, model.YES, model.StoreStatusOpened,
|
||||
}
|
||||
err = dao.GetRows(db, &stores, sql, sqlParams)
|
||||
if len(stores) > 0 {
|
||||
realDistance := float64(0)
|
||||
for _, v := range stores {
|
||||
distance := jxutils.EarthDistance(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat), jxutils.IntCoordinate2Standard(store2.Lng), jxutils.IntCoordinate2Standard(store2.Lat))
|
||||
if realDistance == 0 {
|
||||
realDistance = distance
|
||||
store = v
|
||||
} else {
|
||||
if realDistance > distance {
|
||||
realDistance = distance
|
||||
store = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return store, err
|
||||
}
|
||||
|
||||
func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, maxRadius int, needWalkDistance, isJds bool) (storeList []*Store4User, err error) {
|
||||
const (
|
||||
maxStoreCount4User = 5
|
||||
)
|
||||
|
||||
var (
|
||||
sql string
|
||||
sqlParams []interface{}
|
||||
)
|
||||
|
||||
lng2, _ := jxutils.ConvertDistanceToLogLat(lng, lat, float64(maxRadius), 90)
|
||||
_, lat2 := jxutils.ConvertDistanceToLogLat(lng, lat, float64(maxRadius), 0)
|
||||
lng1 := lng - (lng2 - lng)
|
||||
lat1 := lat - (lat2 - lat)
|
||||
// globals.SugarLogger.Debugf("%f,%f,%f,%f\n", lng1, lng2, lat1, lat2)
|
||||
if !isJds {
|
||||
sql = `
|
||||
SELECT t1.*,
|
||||
city.name city_name
|
||||
FROM store t1
|
||||
JOIN place city ON city.code = t1.city_code
|
||||
JOIN store_map sm ON sm.store_id = t1.id AND sm.vendor_id = ? AND sm.deleted_at = ? AND sm.status <> ?
|
||||
WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.lng > ? AND t1.lng < ? AND t1.lat > ? AND t1.lat < ?
|
||||
AND sm.is_order <> ?
|
||||
AND t1.id <> ?
|
||||
ORDER BY t1.id
|
||||
`
|
||||
sqlParams = []interface{}{
|
||||
model.VendorIDJX, utils.DefaultTimeValue, model.StoreStatusDisabled,
|
||||
utils.DefaultTimeValue, model.StoreStatusDisabled, jxutils.StandardCoordinate2Int(lng1), jxutils.StandardCoordinate2Int(lng2), jxutils.StandardCoordinate2Int(lat1), jxutils.StandardCoordinate2Int(lat2),
|
||||
model.YES,
|
||||
model.MatterStoreID,
|
||||
}
|
||||
} else {
|
||||
sql = `
|
||||
SELECT t1.*,
|
||||
city.name city_name
|
||||
FROM store t1
|
||||
JOIN place city ON city.code = t1.city_code
|
||||
JOIN store_map sm ON sm.store_id = t1.id AND sm.vendor_id = ? AND sm.deleted_at = ? AND sm.status = ?
|
||||
WHERE t1.deleted_at = ? AND t1.status = ? AND t1.lng > ? AND t1.lng < ? AND t1.lat > ? AND t1.lat < ?
|
||||
AND sm.is_order <> ?
|
||||
AND t1.id <> ?
|
||||
ORDER BY t1.id
|
||||
`
|
||||
sqlParams = []interface{}{
|
||||
model.VendorIDJDShop, utils.DefaultTimeValue, model.StoreStatusOpened,
|
||||
utils.DefaultTimeValue, model.StoreStatusOpened, jxutils.StandardCoordinate2Int(lng1), jxutils.StandardCoordinate2Int(lng2), jxutils.StandardCoordinate2Int(lat1), jxutils.StandardCoordinate2Int(lat2),
|
||||
model.YES,
|
||||
model.MatterStoreID,
|
||||
}
|
||||
}
|
||||
var storeList1 []*Store4User
|
||||
if err = dao.GetRows(dao.GetDB(), &storeList1, sql, sqlParams...); err == nil {
|
||||
var storeList2 []*Store4User
|
||||
for _, v := range storeList1 {
|
||||
distance := jxutils.Point2StoreDistance(lng, lat, v.Lng, v.Lat, v.DeliveryRangeType, v.DeliveryRange)
|
||||
if distance > 0 || (lng == jxutils.IntCoordinate2Standard(v.Lng) && lat == jxutils.IntCoordinate2Standard(v.Lat)) {
|
||||
v.Distance = distance
|
||||
storeList2 = append(storeList2, v)
|
||||
}
|
||||
}
|
||||
|
||||
// 为了审核用
|
||||
if len(storeList2) == 0 {
|
||||
sql2 := `
|
||||
SELECT t1.*,
|
||||
city.name city_name
|
||||
FROM store t1
|
||||
JOIN place city ON city.code = t1.city_code
|
||||
WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.id = ?
|
||||
`
|
||||
sqlParams2 := []interface{}{
|
||||
// model.VendorIDJX, utils.DefaultTimeValue, model.StoreStatusDisabled,
|
||||
utils.DefaultTimeValue,
|
||||
model.StoreStatusDisabled,
|
||||
// jxutils.StandardCoordinate2Int(0),
|
||||
// jxutils.StandardCoordinate2Int(10000),
|
||||
// jxutils.StandardCoordinate2Int(0),
|
||||
// jxutils.StandardCoordinate2Int(10000),
|
||||
// model.YES,
|
||||
102919, //商城模板店
|
||||
}
|
||||
dao.GetRows(dao.GetDB(), &storeList2, sql2, sqlParams2...)
|
||||
// if len(storeList2) > 1 {
|
||||
// storeList2 = storeList2[:1]
|
||||
// }
|
||||
}
|
||||
|
||||
// 如果要求以步行距离来算
|
||||
if needWalkDistance {
|
||||
var coordList []*autonavi.Coordinate
|
||||
for _, v := range storeList2 {
|
||||
coordList = append(coordList, &autonavi.Coordinate{
|
||||
Lng: v.FloatLng,
|
||||
Lat: v.FloatLat,
|
||||
})
|
||||
}
|
||||
if distanceList, err2 := api.AutonaviAPI.BatchWalkingDistance(lng, lat, coordList); err2 == nil {
|
||||
for k, v := range storeList2 {
|
||||
v.WalkDistance = int(distanceList[k])
|
||||
}
|
||||
} else {
|
||||
return nil, err2
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(Store4UserList(storeList2))
|
||||
storeList = storeList2
|
||||
if len(storeList) > maxStoreCount4User {
|
||||
storeList = storeList[:maxStoreCount4User]
|
||||
}
|
||||
}
|
||||
return storeList, err
|
||||
}
|
||||
//
|
||||
//func GetNearSupplyGoodsStoreByStoreID(ctx *jxcontext.Context, storeID int) (store *model.Store, err error) {
|
||||
// var (
|
||||
// stores []*model.Store
|
||||
// db = dao.GetDB()
|
||||
// )
|
||||
// store2, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX)
|
||||
// if store2 == nil {
|
||||
// return nil, fmt.Errorf("该门店未绑定京西平台!storeID: %v", storeID)
|
||||
// }
|
||||
// if store2.IsSupplyGoods == model.YES {
|
||||
// return nil, fmt.Errorf("该门店已经是货源门店,无法从其他货源门店进货!storeID: %v", storeID)
|
||||
// }
|
||||
// sql := `
|
||||
// SELECT a.*
|
||||
// FROM store a
|
||||
// JOIN store_map b ON b.store_id = a.id
|
||||
// JOIN store c ON c.city_code = a.city_code AND c.id = ?
|
||||
// WHERE a.deleted_at = ?
|
||||
// AND b.deleted_at = ?
|
||||
// AND b.vendor_id = ?
|
||||
// AND b.is_supply_goods = ?
|
||||
// AND a.status = ?
|
||||
// `
|
||||
// sqlParams := []interface{}{
|
||||
// storeID,
|
||||
// utils.DefaultTimeValue, utils.DefaultTimeValue,
|
||||
// model.VendorIDJX, model.YES, model.StoreStatusOpened,
|
||||
// }
|
||||
// err = dao.GetRows(db, &stores, sql, sqlParams)
|
||||
// if len(stores) > 0 {
|
||||
// realDistance := float64(0)
|
||||
// for _, v := range stores {
|
||||
// distance := jxutils.EarthDistance(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat), jxutils.IntCoordinate2Standard(store2.Lng), jxutils.IntCoordinate2Standard(store2.Lat))
|
||||
// if realDistance == 0 {
|
||||
// realDistance = distance
|
||||
// store = v
|
||||
// } else {
|
||||
// if realDistance > distance {
|
||||
// realDistance = distance
|
||||
// store = v
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return store, err
|
||||
//}
|
||||
//
|
||||
//func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, maxRadius int, needWalkDistance, isJds bool) (storeList []*Store4User, err error) {
|
||||
// const (
|
||||
// maxStoreCount4User = 5
|
||||
// )
|
||||
//
|
||||
// var (
|
||||
// sql string
|
||||
// sqlParams []interface{}
|
||||
// )
|
||||
//
|
||||
// lng2, _ := jxutils.ConvertDistanceToLogLat(lng, lat, float64(maxRadius), 90)
|
||||
// _, lat2 := jxutils.ConvertDistanceToLogLat(lng, lat, float64(maxRadius), 0)
|
||||
// lng1 := lng - (lng2 - lng)
|
||||
// lat1 := lat - (lat2 - lat)
|
||||
// // globals.SugarLogger.Debugf("%f,%f,%f,%f\n", lng1, lng2, lat1, lat2)
|
||||
// if !isJds {
|
||||
// sql = `
|
||||
// SELECT t1.*,
|
||||
// city.name city_name
|
||||
// FROM store t1
|
||||
// JOIN place city ON city.code = t1.city_code
|
||||
// JOIN store_map sm ON sm.store_id = t1.id AND sm.vendor_id = ? AND sm.deleted_at = ? AND sm.status <> ?
|
||||
// WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.lng > ? AND t1.lng < ? AND t1.lat > ? AND t1.lat < ?
|
||||
// AND sm.is_order <> ?
|
||||
// AND t1.id <> ?
|
||||
// ORDER BY t1.id
|
||||
// `
|
||||
// sqlParams = []interface{}{
|
||||
// model.VendorIDJX, utils.DefaultTimeValue, model.StoreStatusDisabled,
|
||||
// utils.DefaultTimeValue, model.StoreStatusDisabled, jxutils.StandardCoordinate2Int(lng1), jxutils.StandardCoordinate2Int(lng2), jxutils.StandardCoordinate2Int(lat1), jxutils.StandardCoordinate2Int(lat2),
|
||||
// model.YES,
|
||||
// model.MatterStoreID,
|
||||
// }
|
||||
// } else {
|
||||
// sql = `
|
||||
// SELECT t1.*,
|
||||
// city.name city_name
|
||||
// FROM store t1
|
||||
// JOIN place city ON city.code = t1.city_code
|
||||
// JOIN store_map sm ON sm.store_id = t1.id AND sm.vendor_id = ? AND sm.deleted_at = ? AND sm.status = ?
|
||||
// WHERE t1.deleted_at = ? AND t1.status = ? AND t1.lng > ? AND t1.lng < ? AND t1.lat > ? AND t1.lat < ?
|
||||
// AND sm.is_order <> ?
|
||||
// AND t1.id <> ?
|
||||
// ORDER BY t1.id
|
||||
// `
|
||||
// sqlParams = []interface{}{
|
||||
// model.VendorIDJDShop, utils.DefaultTimeValue, model.StoreStatusOpened,
|
||||
// utils.DefaultTimeValue, model.StoreStatusOpened, jxutils.StandardCoordinate2Int(lng1), jxutils.StandardCoordinate2Int(lng2), jxutils.StandardCoordinate2Int(lat1), jxutils.StandardCoordinate2Int(lat2),
|
||||
// model.YES,
|
||||
// model.MatterStoreID,
|
||||
// }
|
||||
// }
|
||||
// var storeList1 []*Store4User
|
||||
// if err = dao.GetRows(dao.GetDB(), &storeList1, sql, sqlParams...); err == nil {
|
||||
// var storeList2 []*Store4User
|
||||
// for _, v := range storeList1 {
|
||||
// distance := jxutils.Point2StoreDistance(lng, lat, v.Lng, v.Lat, v.DeliveryRangeType, v.DeliveryRange)
|
||||
// if distance > 0 || (lng == jxutils.IntCoordinate2Standard(v.Lng) && lat == jxutils.IntCoordinate2Standard(v.Lat)) {
|
||||
// v.Distance = distance
|
||||
// storeList2 = append(storeList2, v)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 为了审核用
|
||||
// if len(storeList2) == 0 {
|
||||
// sql2 := `
|
||||
// SELECT t1.*,
|
||||
// city.name city_name
|
||||
// FROM store t1
|
||||
// JOIN place city ON city.code = t1.city_code
|
||||
// WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.id = ?
|
||||
// `
|
||||
// sqlParams2 := []interface{}{
|
||||
// // model.VendorIDJX, utils.DefaultTimeValue, model.StoreStatusDisabled,
|
||||
// utils.DefaultTimeValue,
|
||||
// model.StoreStatusDisabled,
|
||||
// // jxutils.StandardCoordinate2Int(0),
|
||||
// // jxutils.StandardCoordinate2Int(10000),
|
||||
// // jxutils.StandardCoordinate2Int(0),
|
||||
// // jxutils.StandardCoordinate2Int(10000),
|
||||
// // model.YES,
|
||||
// 102919, //商城模板店
|
||||
// }
|
||||
// dao.GetRows(dao.GetDB(), &storeList2, sql2, sqlParams2...)
|
||||
// // if len(storeList2) > 1 {
|
||||
// // storeList2 = storeList2[:1]
|
||||
// // }
|
||||
// }
|
||||
//
|
||||
// // 如果要求以步行距离来算
|
||||
// if needWalkDistance {
|
||||
// var coordList []*autonavi.Coordinate
|
||||
// for _, v := range storeList2 {
|
||||
// coordList = append(coordList, &autonavi.Coordinate{
|
||||
// Lng: v.FloatLng,
|
||||
// Lat: v.FloatLat,
|
||||
// })
|
||||
// }
|
||||
// if distanceList, err2 := api.AutonaviAPI.BatchWalkingDistance(lng, lat, coordList); err2 == nil {
|
||||
// for k, v := range storeList2 {
|
||||
// v.WalkDistance = int(distanceList[k])
|
||||
// }
|
||||
// } else {
|
||||
// return nil, err2
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// sort.Sort(Store4UserList(storeList2))
|
||||
// storeList = storeList2
|
||||
// if len(storeList) > maxStoreCount4User {
|
||||
// storeList = storeList[:maxStoreCount4User]
|
||||
// }
|
||||
// }
|
||||
// return storeList, err
|
||||
//}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/q_bida"
|
||||
"github.com/astaxie/beego/client/orm"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -97,7 +98,6 @@ func (p *PayHandler) CreatePay(txDB orm.TxOrmer, subAppID string) (err error) {
|
||||
// TotalFee: int(order.ActualPayPrice),
|
||||
//}
|
||||
}
|
||||
|
||||
// 暂时不支持微信直接支付
|
||||
case model.PayTypeWX:
|
||||
param := &wxpayapi.CreateOrderParam{
|
||||
@@ -257,20 +257,26 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
t1, _ := time.ParseInLocation("20060102150405", call.PayTime, loc)
|
||||
order.PayFinishedAt = t1
|
||||
order.OriginalData = utils.Format4Output(call, true)
|
||||
payStatus := 0
|
||||
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
order.Status = model.OrderStatusFinished
|
||||
payStatus = model.OrderStatusSuccessPay
|
||||
} else {
|
||||
order.Status = model.OrderStatusCanceled
|
||||
payStatus = model.OrderStatusFailPay
|
||||
}
|
||||
|
||||
if _, err := dao.UpdateEntity(db, order); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := dao.UpdateEntity(db, &model.UserVendorOrder{LocalWayBill: order.OrderID, OrderStatus: payStatus}, "OrderStatus"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
switch order.OrderType {
|
||||
case model.PayType4Express:
|
||||
|
||||
err = q_bida.CreateOrder2QBiDa(order.OrderID)
|
||||
case model.PayType4Member, model.PayType4Recharge:
|
||||
err = OnPayFinished(order)
|
||||
}
|
||||
@@ -282,70 +288,34 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
}
|
||||
|
||||
func onTLpayRefund(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
// orderPayRefund := &model.OrderPayRefund{
|
||||
// RefundID: call.CusorderID,
|
||||
// }
|
||||
// db := dao.GetDB()
|
||||
// if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
||||
// if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
// orderPayRefund.Status = model.RefundStatusYes
|
||||
// } else {
|
||||
// orderPayRefund.Status = model.RefundStatusFailed
|
||||
// }
|
||||
// orderPayRefund.OriginalData = utils.Format4Output(call, true)
|
||||
// dao.UpdateEntity(db, orderPayRefund)
|
||||
// } else if dao.IsNoRowsError(err) {
|
||||
// globals.SugarLogger.Warnf("收到异常的退款事件, call:%s", utils.Format4Output(call, true))
|
||||
// }
|
||||
orderPayRefund := &model.OrderPayRefund{
|
||||
RefundID: call.CusorderID,
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
||||
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
orderPayRefund.Status = model.RefundStatusYes
|
||||
} else {
|
||||
orderPayRefund.Status = model.RefundStatusFailed
|
||||
}
|
||||
orderPayRefund.OriginalData = utils.Format4Output(call, true)
|
||||
dao.UpdateEntity(db, orderPayRefund)
|
||||
} else if dao.IsNoRowsError(err) {
|
||||
globals.SugarLogger.Warnf("收到异常的退款事件, call:%s", utils.Format4Output(call, true))
|
||||
}
|
||||
|
||||
// orderPay := &model.OrderPay{
|
||||
// VendorOrderID: orderPayRefund.VendorOrderID,
|
||||
// VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
|
||||
// PayType: model.PayTypeWX,
|
||||
// Status: model.PayStatusYes,
|
||||
// }
|
||||
// orderPay.DeletedAt = utils.DefaultTimeValue
|
||||
// if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
|
||||
// orderPay.Status = model.PayStatusRefund
|
||||
// dao.UpdateEntity(db, orderPay)
|
||||
// }
|
||||
orderPay := &model.Order{
|
||||
OrderID: orderPayRefund.VendorOrderID,
|
||||
}
|
||||
if err = dao.GetEntity(db, orderPay, "VendorOrderID"); err == nil {
|
||||
orderPay.Status = model.OrderStatusCancel
|
||||
dao.UpdateEntity(db, orderPay)
|
||||
}
|
||||
|
||||
dao.UpdateEntity(db, &model.UserVendorOrder{LocalWayBill: call.CusorderID, OrderStatus: model.OrderStatusCancel}, "OrderStatus")
|
||||
return err
|
||||
}
|
||||
|
||||
// func RefundOrderByTL(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
|
||||
// result, err := api.TLpayAPI.PayRefund(&tonglianpayapi.PayRefundParam{
|
||||
// Trxamt: refundFee,
|
||||
// Reqsn: utils.GetUUID(),
|
||||
// Remark: refundDesc,
|
||||
// OldTrxID: orderPay.TransactionID,
|
||||
// })
|
||||
// if err == nil {
|
||||
// orderPayRefund = &model.OrderPayRefund{
|
||||
// RefundID: refundID,
|
||||
// VendorRefundID: result.TrxID,
|
||||
// VendorOrderID: orderPay.VendorOrderID,
|
||||
// VendorID: orderPay.VendorID,
|
||||
// Status: model.RefundStatusNo,
|
||||
// TransactionID: orderPay.TransactionID,
|
||||
// RefundFee: refundFee,
|
||||
// RefundCreatedAt: time.Now(),
|
||||
// }
|
||||
// dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
|
||||
// db := dao.GetDB()
|
||||
// if result.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
// orderPayRefund.Status = model.RefundStatusYes
|
||||
// } else {
|
||||
// orderPayRefund.Status = model.RefundStatusFailed
|
||||
// }
|
||||
// orderPayRefund.OriginalData = utils.Format4Output(result, true)
|
||||
// dao.CreateEntity(db, orderPayRefund)
|
||||
|
||||
// orderPay.Status = model.PayStatusRefund
|
||||
// dao.UpdateEntity(db, orderPay)
|
||||
// }
|
||||
// return orderPayRefund, err
|
||||
// }
|
||||
|
||||
func OnWxPayCallback(msg *wxpayapi.CallbackMsg) (err error) {
|
||||
globals.SugarLogger.Debugf("OnWxPayCallback msg:%s", utils.Format4Output(msg, true))
|
||||
switch msg.MsgType {
|
||||
|
||||
Reference in New Issue
Block a user