1
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
|||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAuthBind(db *DaoDB, bindType int, authType, authID string) (authBind *model.AuthBind, err error) {
|
func GetAuthBind(db *DaoDB, bindType int, authType, authID string) (authBind *model.AuthBind, err error) {
|
||||||
@@ -62,7 +61,6 @@ func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []stri
|
|||||||
sqlParams = append(sqlParams, typeIDs)
|
sqlParams = append(sqlParams, typeIDs)
|
||||||
}
|
}
|
||||||
sql += " ORDER BY t1.type"
|
sql += " ORDER BY t1.type"
|
||||||
globals.SugarLogger.Debugf("GetUserBindAuthInfo sql=%s,sqlParams=%s", sql, utils.Format4Output(sqlParams, false))
|
|
||||||
err = GetRows(db, &authList, sql, sqlParams...)
|
err = GetRows(db, &authList, sql, sqlParams...)
|
||||||
return authList, err
|
return authList, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
||||||
|
domain3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/domain"
|
||||||
request3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/request"
|
request3156 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability3156/request"
|
||||||
domain591 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/domain"
|
domain591 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/domain"
|
||||||
request591 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/request"
|
request591 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/request"
|
||||||
@@ -64,6 +65,8 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal
|
|||||||
if needCallNew {
|
if needCallNew {
|
||||||
refundData := msg.(*tao_vegetable.UserApplyRefundCallBack)
|
refundData := msg.(*tao_vegetable.UserApplyRefundCallBack)
|
||||||
var afsOrder *model.AfsOrder
|
var afsOrder *model.AfsOrder
|
||||||
|
var api = getAPI("", 0, refundData.StoreId)
|
||||||
|
|
||||||
afsOrder = &model.AfsOrder{
|
afsOrder = &model.AfsOrder{
|
||||||
VendorID: model.VendorIDTaoVegetable,
|
VendorID: model.VendorIDTaoVegetable,
|
||||||
AfsOrderID: orderStatus.VendorOrderID,
|
AfsOrderID: orderStatus.VendorOrderID,
|
||||||
@@ -79,7 +82,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal
|
|||||||
ReasonDesc: refundData.RefundReason,
|
ReasonDesc: refundData.RefundReason,
|
||||||
ReasonImgList: utils.LimitUTF8StringLen(refundData.RefundPictures, 1024),
|
ReasonImgList: utils.LimitUTF8StringLen(refundData.RefundPictures, 1024),
|
||||||
RefundType: model.AfsTypeFullRefund,
|
RefundType: model.AfsTypeFullRefund,
|
||||||
VendorOrgCode: refundData.MerchantCode,
|
VendorOrgCode: api.GetVendorOrgCode(),
|
||||||
}
|
}
|
||||||
|
|
||||||
refundIds := make([]int64, 0, 0)
|
refundIds := make([]int64, 0, 0)
|
||||||
@@ -123,7 +126,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal
|
|||||||
return tao_vegetable.CallBackResultInfo(errors.New("订单号异常"))
|
return tao_vegetable.CallBackResultInfo(errors.New("订单号异常"))
|
||||||
}
|
}
|
||||||
queryOrderDetailParam.OrderGetRequest.BizOrderId = utils.Int64ToPointer(utils.Str2Int64(order.VendorOrderID))
|
queryOrderDetailParam.OrderGetRequest.BizOrderId = utils.Int64ToPointer(utils.Str2Int64(order.VendorOrderID))
|
||||||
skuList, err := getAPI("", 0, refundData.StoreId).QueryOrderDetail(queryOrderDetailParam)
|
skuList, err := api.QueryOrderDetail(queryOrderDetailParam)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return tao_vegetable.CallBackResultInfo(err)
|
return tao_vegetable.CallBackResultInfo(err)
|
||||||
}
|
}
|
||||||
@@ -212,14 +215,14 @@ func (c *PurchaseHandler) callbackAfsMsg2Status(status string, msg interface{})
|
|||||||
orderStatus.Status = c.GetAfsStatusFromVendorStatus(tao_vegetable.OrderStatusApplyAfs)
|
orderStatus.Status = c.GetAfsStatusFromVendorStatus(tao_vegetable.OrderStatusApplyAfs)
|
||||||
orderStatus.StatusTime = time.Now()
|
orderStatus.StatusTime = time.Now()
|
||||||
orderStatus.Remark = refundData.Remarks
|
orderStatus.Remark = refundData.Remarks
|
||||||
orderStatus.VendorOrderID = refundData.BizRefundId
|
orderStatus.VendorOrderID = refundData.RefundId
|
||||||
case tao_vegetable.OrderStatusCancelAfs: // 用户取消售后
|
case tao_vegetable.OrderStatusCancelAfs: // 用户取消售后
|
||||||
refundData := msg.(*tao_vegetable.UserCancelRefundApply)
|
refundData := msg.(*tao_vegetable.UserCancelRefundApply)
|
||||||
orderStatus.RefVendorOrderID = refundData.OutOrderId
|
orderStatus.RefVendorOrderID = refundData.OutOrderId
|
||||||
orderStatus.VendorStatus = fmt.Sprintf("%s:%s", tao_vegetable.OrderStatusCancelAfs, "用户取消售后申请")
|
orderStatus.VendorStatus = fmt.Sprintf("%s:%s", tao_vegetable.OrderStatusCancelAfs, "用户取消售后申请")
|
||||||
orderStatus.Status = c.GetAfsStatusFromVendorStatus(tao_vegetable.OrderStatusCancelAfs)
|
orderStatus.Status = c.GetAfsStatusFromVendorStatus(tao_vegetable.OrderStatusCancelAfs)
|
||||||
orderStatus.StatusTime = time.Now()
|
orderStatus.StatusTime = time.Now()
|
||||||
orderStatus.VendorOrderID = refundData.BizRefundId
|
orderStatus.VendorOrderID = refundData.RefundId
|
||||||
//case tao_vegetable.OrderStatusOnSaleCancel:
|
//case tao_vegetable.OrderStatusOnSaleCancel:
|
||||||
// refundData := msg.(*tao_vegetable.OnSaleCancel)
|
// refundData := msg.(*tao_vegetable.OnSaleCancel)
|
||||||
// orderStatus.RefVendorOrderID = utils.Int64ToStr(refundData.BizOrderId)
|
// orderStatus.RefVendorOrderID = utils.Int64ToStr(refundData.BizOrderId)
|
||||||
@@ -233,7 +236,7 @@ func (c *PurchaseHandler) callbackAfsMsg2Status(status string, msg interface{})
|
|||||||
orderStatus.VendorStatus = fmt.Sprintf("%s:%s", tao_vegetable.OrderStatusRefundSuccess, "用户售后退款成功")
|
orderStatus.VendorStatus = fmt.Sprintf("%s:%s", tao_vegetable.OrderStatusRefundSuccess, "用户售后退款成功")
|
||||||
orderStatus.Status = c.GetAfsStatusFromVendorStatus(tao_vegetable.OrderStatusRefundSuccess)
|
orderStatus.Status = c.GetAfsStatusFromVendorStatus(tao_vegetable.OrderStatusRefundSuccess)
|
||||||
orderStatus.StatusTime = time.Now()
|
orderStatus.StatusTime = time.Now()
|
||||||
orderStatus.VendorOrderID = refundData.BizSubRefundId
|
orderStatus.VendorOrderID = refundData.OutMainRefundId
|
||||||
}
|
}
|
||||||
order, _ := partner.CurOrderManager.LoadOrder2(orderStatus.RefVendorOrderID, model.VendorIDTaoVegetable)
|
order, _ := partner.CurOrderManager.LoadOrder2(orderStatus.RefVendorOrderID, model.VendorIDTaoVegetable)
|
||||||
if order != nil {
|
if order != nil {
|
||||||
@@ -256,11 +259,24 @@ func (c *PurchaseHandler) GetAfsStatusFromVendorStatus(notifyType string) int {
|
|||||||
// 审核售后单申请
|
// 审核售后单申请
|
||||||
func (c *PurchaseHandler) AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.AfsOrder, approveType int, reason string) (err error) {
|
func (c *PurchaseHandler) AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.AfsOrder, approveType int, reason string) (err error) {
|
||||||
if approveType == partner.AfsApproveTypeRefused {
|
if approveType == partner.AfsApproveTypeRefused {
|
||||||
|
// 加载子订单号
|
||||||
|
orderDetail, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, model.VendorIDTaoVegetable)
|
||||||
|
// 加载退款商品
|
||||||
|
afsSkuOrder, _ := dao.GetOrderRefundSkuList(dao.GetDB(), []string{order.VendorOrderID})
|
||||||
param := &request3156.AlibabaTclsAelophyRefundAgreeRequest{
|
param := &request3156.AlibabaTclsAelophyRefundAgreeRequest{
|
||||||
StoreId: utils.String2Pointer(order.VendorStoreID),
|
StoreId: utils.String2Pointer(order.VendorStoreID),
|
||||||
OutOrderId: utils.String2Pointer(order.VendorOrderID),
|
OutOrderId: utils.String2Pointer(orderDetail.VendorOrderID2),
|
||||||
|
RefundId: utils.String2Pointer(order.AfsOrderID),
|
||||||
OrderFrom: utils.Int64ToPointer(utils.Str2Int64(tao_vegetable.TaoVegetableChannelCode)),
|
OrderFrom: utils.Int64ToPointer(utils.Str2Int64(tao_vegetable.TaoVegetableChannelCode)),
|
||||||
}
|
}
|
||||||
|
subRefundList := make([]domain3156.AlibabaTclsAelophyRefundAgreeSubrefundlist, 0, len(afsSkuOrder))
|
||||||
|
for _, v := range afsSkuOrder {
|
||||||
|
subRefundList = append(subRefundList, domain3156.AlibabaTclsAelophyRefundAgreeSubrefundlist{
|
||||||
|
OutSubOrderId: utils.String2Pointer(v.VendorSubOrderID),
|
||||||
|
RefundFee: utils.Int64ToPointer(v.UserMoney),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
param.SubRefundList = &subRefundList
|
||||||
param.AuditMemo = utils.String2Pointer(fmt.Sprintf("商户同意退款"))
|
param.AuditMemo = utils.String2Pointer(fmt.Sprintf("商户同意退款"))
|
||||||
if reason != "" {
|
if reason != "" {
|
||||||
param.AuditMemo = utils.String2Pointer(*param.AuditMemo + fmt.Sprintf(",%s", reason))
|
param.AuditMemo = utils.String2Pointer(*param.AuditMemo + fmt.Sprintf(",%s", reason))
|
||||||
|
|||||||
Reference in New Issue
Block a user