This commit is contained in:
suyl
2021-04-28 14:25:32 +08:00
parent e216a3b5ae
commit dfb91baa09
7 changed files with 38 additions and 18 deletions

View File

@@ -1966,7 +1966,7 @@ func GetUnionActList(ctx *jxcontext.Context, vendorID, actType int) (actList []*
return actList, err
}
func ShareUnionLink(ctx *jxcontext.Context, jobID, shareType, linkType, resourceType int) (link string, err error) {
func ShareUnionLink(ctx *jxcontext.Context, jobID, shareType, linkType, resourceType int, goodsID string) (link string, err error) {
var (
job = &model.Job{}
db = dao.GetDB()
@@ -2009,7 +2009,7 @@ func ShareUnionLink(ctx *jxcontext.Context, jobID, shareType, linkType, resource
}
//2、分享链接
if handler != nil {
if link, err = handler.ShareUnionLink(ctx, linkType, job.UnionActID, sid, userID, resourceType); err == nil {
if link, err = handler.ShareUnionLink(ctx, linkType, job.UnionActID, sid, userID, resourceType, goodsID); err == nil {
if vendorID == model.VendorIDMTWM || vendorID == model.VendorIDTB {
if linkType == partner.LinkTypeWeiXinMini {
if resBinary, _, err := jxutils.DownloadFileByURL(link); err == nil {

View File

@@ -17,7 +17,7 @@ func init() {
partner.UnionHandlerMap[model.VendorIDJDShop] = unionHandler
}
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error) {
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int, goodsID string) (link string, err error) {
return "jds", err
}

View File

@@ -8,7 +8,7 @@ import (
"strings"
)
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error) {
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int, goodsID string) (link string, err error) {
if linkType == partner.LinkTypeWeiXinMini {
if qrCode, err := api.MtUnionAPI.MiniCode(unionActID, sID); err == nil {
if qrCode != "" {

View File

@@ -79,7 +79,7 @@ func init() {
}
type UnionInterface interface {
ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error)
ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int, goodsID string) (link string, err error)
GetUnionActList(ctx *jxcontext.Context, actType int) (result []*ActivityList, err error)
CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, err error)
GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (result *MatterList, err error)

View File

@@ -23,19 +23,38 @@ var (
}
)
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error) {
if result, err := api.PddAPI.ResourceURLGen(sID, resourceType); err == nil {
switch linkType {
case partner.LinkTypeWeiXinMini:
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int, goodsID string) (link string, err error) {
//传了goodsID表示是商品分享
if goodsID != "" {
authBindFlag, err := api.PddAPI.MemberAuthorityQuery(sID)
if err != nil {
return "", err
case partner.LinTypeH5:
return result.SingleURLList.URL, err
case partner.LinTypeWx:
return result.WeAppInfo.PagePath, err
default:
return link, fmt.Errorf("暂不支持此链接类型!")
}
if result, err := api.PddAPI.GoodsPromotionURLGen(sID, goodsID, !authBindFlag); err == nil {
switch linkType {
case partner.LinTypeH5:
return result.MobileURL, err
case partner.LinTypeWx:
return result.WeAppInfo.PagePath, err
default:
return link, fmt.Errorf("暂不支持此链接类型!")
}
}
} else {
if result, err := api.PddAPI.ResourceURLGen(sID, resourceType); err == nil {
switch linkType {
case partner.LinkTypeWeiXinMini:
return "", err
case partner.LinTypeH5:
return result.SingleURLList.URL, err
case partner.LinTypeWx:
return result.WeAppInfo.PagePath, err
default:
return link, fmt.Errorf("暂不支持此链接类型!")
}
}
}
return link, err
}

View File

@@ -8,7 +8,7 @@ import (
"git.rosy.net.cn/jx-callback/globals/api"
)
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int) (link string, err error) {
func (s *UnionHandler) ShareUnionLink(ctx *jxcontext.Context, linkType, unionActID int, sID, userID string, resourceType int, goodsID string) (link string, err error) {
if result, err2 := api.TbUnionAPI.ActivityInfoGet(userID, utils.Int2Str(unionActID), utils.Str2Int64(sID)); err2 == nil {
switch linkType {
case partner.LinkTypeWeiXinMini:

View File

@@ -29,16 +29,17 @@ func (c *UnionController) GetUnionActList() {
// @Title 分享联盟链接
// @Description 分享联盟链接
// @Param token header string true "认证token"
// @Param jobID formData int false "任务ID"
// @Param jobID formData int true "任务ID"
// @Param shareType formData int true "分享类型1为当前用户分享给别人2为当前用户自己领取"
// @Param resourceType formData int false "资源类型"
// @Param linkType formData int true "链接类型1 h5链接 2 deeplink(唤起)链接 3 中间页唤起链接 4 微信小程序唤起路径, 5为小程序二维码"
// @Param goodsID formData string false "分享商品时的商品ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /ShareUnionLink [post]
func (c *UnionController) ShareUnionLink() {
c.callShareUnionLink(func(params *tUnionShareUnionLinkParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.ShareUnionLink(params.Ctx, params.JobID, params.ShareType, params.LinkType, params.ResourceType)
retVal, err = cms.ShareUnionLink(params.Ctx, params.JobID, params.ShareType, params.LinkType, params.ResourceType, params.GoodsID)
return retVal, "", err
})
}