aa
This commit is contained in:
@@ -1966,7 +1966,7 @@ func ShareUnionLink(ctx *jxcontext.Context, jobID, linkType int) (link string, e
|
||||
return link, err
|
||||
}
|
||||
if handler := partner.GetHandler(job.VendorID); handler != nil {
|
||||
link, err = handler.ShareUnionLink(ctx, linkType, job.UnionActID, jobOrder.UserID)
|
||||
link, err = handler.ShareUnionLink(ctx, linkType, job.UnionActID, utils.Int64ToStr(jobOrder.ID))
|
||||
if job.VendorID == model.VendorIDMTWM && linkType == partner.LinkTypeWeiXinMini {
|
||||
if resBinary, _, err := jxutils.DownloadFileByURL(link + "?imageView2/1/w/100/h/100/q/75"); err == nil {
|
||||
if downloadURL, err := jxutils.UploadExportContent(resBinary, utils.Int64ToStr(time.Now().Unix())+link[strings.LastIndex(link, "/")+1:len(link)]); err == nil {
|
||||
|
||||
@@ -2,6 +2,7 @@ package cms
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/partner"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
@@ -186,3 +187,32 @@ func GetManageStatisticsJob(ctx *jxcontext.Context, cityCodes []int, fromTime, t
|
||||
)
|
||||
return dao.GetManageStatisticsJob(db, cityCodes, utils.Str2Time(fromTime), utils.Str2Time(toTime), jobIDs, offset, pageSize)
|
||||
}
|
||||
|
||||
func UnionOrderCallBack(unionOrder *partner.UnionOrderInfo) (err error) {
|
||||
globals.SugarLogger.Debugf("UnionOrderCallBack unionOrder: %v", utils.Format4Output(unionOrder, true))
|
||||
var (
|
||||
jobOrder = &model.JobOrder{}
|
||||
db = dao.GetDB()
|
||||
)
|
||||
jobOrder.ID = unionOrder.JobOrderID
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
if err := dao.GetEntity(db, jobOrder); err != nil {
|
||||
return err
|
||||
}
|
||||
userBill, err := dao.GetUserBill(db, jobOrder.UserID, "")
|
||||
if userBill == nil {
|
||||
return fmt.Errorf("未查询到该用户的账单!")
|
||||
}
|
||||
if err = financial.AddIncomeUpdateAccount(txDB, userBill, model.BillTypeUnionShare, int(unionOrder.Profit), jobOrder.JobID); err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
return err
|
||||
}
|
||||
dao.Commit(db, txDB)
|
||||
return err
|
||||
}
|
||||
|
||||
25
business/jxstore/partner/mt/callback.go
Normal file
25
business/jxstore/partner/mt/callback.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtunionapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func OnCallback(call *mtunionapi.CallBackResult) (err error) {
|
||||
if call.Status == mtunionapi.MtUnionOrderStatusFinished {
|
||||
if order, err := api.MtUnionAPI.Rtnotify(call.Orderid, call.Type); order != nil && err == nil {
|
||||
unionOrder := &partner.UnionOrderInfo{
|
||||
JobOrderID: utils.Str2Int64(order.Order.Sid),
|
||||
Profit: jxutils.StandardPrice2Int(utils.Str2Float64(order.Coupon[0].Profit)),
|
||||
VendorID: model.VendorIDMTWM,
|
||||
}
|
||||
cms.UnionOrderCallBack(unionOrder)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -15,6 +15,12 @@ const (
|
||||
LinkTypeH5 = 2 //H5
|
||||
)
|
||||
|
||||
type UnionOrderInfo struct {
|
||||
JobOrderID int64 `json:"jobOrderID"`
|
||||
Profit int64 `json:"profit"` //订单实际返佣金额
|
||||
VendorID int `json:"vendorID"`
|
||||
}
|
||||
|
||||
type ActivityList struct {
|
||||
ActID int `json:"actID"`
|
||||
ActName string `json:"actName"`
|
||||
|
||||
@@ -10,6 +10,7 @@ const (
|
||||
BillTypeJobDivide = 16 //做任务实得(被扣除分成后)
|
||||
BillTypeDropShipping = 17 //一件代发订单扣除
|
||||
BillTypeDropShippingDeposit = 18 //一件代发保证金
|
||||
BillTypeUnionShare = 19 //联盟任务分成
|
||||
|
||||
BillTypeMember = 20 //开通会员
|
||||
|
||||
|
||||
@@ -580,3 +580,17 @@ func (c *JobController) ShareUnionLink() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 查看接取的联盟任务执行情况
|
||||
// @Description 查看接取的联盟任务执行情况
|
||||
// @Param token header string true "认证token"
|
||||
// @Param jobOrderID query int true "接取任务ID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /ShareUnionLink [post]
|
||||
//func (c *JobController) ShareUnionLink() {
|
||||
// c.callShareUnionLink(func(params *tJobShareUnionLinkParams) (retVal interface{}, errCode string, err error) {
|
||||
// retVal, err = cms.ShareUnionLink(params.Ctx, params.JobID, params.LinkType)
|
||||
// return retVal, "", err
|
||||
// })
|
||||
//}
|
||||
|
||||
@@ -3,6 +3,7 @@ package controllers
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtunionapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/partner/mt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
@@ -18,7 +19,7 @@ func (c *MTWMController) UnionMsg() {
|
||||
call, err := api.MtUnionAPI.GetCallbackMsg(c.Ctx.Request)
|
||||
globals.SugarLogger.Debugf("mtunion callback callbackResponse:%s", utils.Format4Output(call, true))
|
||||
if err == nil {
|
||||
//err = financial.OnTLPayCallback(call)
|
||||
err = mt.OnCallback(call)
|
||||
}
|
||||
c.Data["json"] = &mtunionapi.CallBack{
|
||||
Errcode: "0",
|
||||
|
||||
Reference in New Issue
Block a user