aa
This commit is contained in:
@@ -1966,7 +1966,7 @@ func GetUnionActList(ctx *jxcontext.Context, vendorID, actType int) (actList []*
|
|||||||
return actList, err
|
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 (
|
var (
|
||||||
job = &model.Job{}
|
job = &model.Job{}
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
@@ -2009,7 +2009,7 @@ func ShareUnionLink(ctx *jxcontext.Context, jobID, shareType, linkType, resource
|
|||||||
}
|
}
|
||||||
//2、分享链接
|
//2、分享链接
|
||||||
if handler != nil {
|
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 vendorID == model.VendorIDMTWM || vendorID == model.VendorIDTB {
|
||||||
if linkType == partner.LinkTypeWeiXinMini {
|
if linkType == partner.LinkTypeWeiXinMini {
|
||||||
if resBinary, _, err := jxutils.DownloadFileByURL(link); err == nil {
|
if resBinary, _, err := jxutils.DownloadFileByURL(link); err == nil {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func init() {
|
|||||||
partner.UnionHandlerMap[model.VendorIDJDShop] = unionHandler
|
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
|
return "jds", err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"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 linkType == partner.LinkTypeWeiXinMini {
|
||||||
if qrCode, err := api.MtUnionAPI.MiniCode(unionActID, sID); err == nil {
|
if qrCode, err := api.MtUnionAPI.MiniCode(unionActID, sID); err == nil {
|
||||||
if qrCode != "" {
|
if qrCode != "" {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UnionInterface interface {
|
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)
|
GetUnionActList(ctx *jxcontext.Context, actType int) (result []*ActivityList, err error)
|
||||||
CreateUnionPosition(ctx *jxcontext.Context, userID string) (sID string, 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)
|
GetUnionMatterList(ctx *jxcontext.Context, vendorCatID, keyword string, page, pageSize, sortType int, listID string) (result *MatterList, err error)
|
||||||
|
|||||||
@@ -23,19 +23,38 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
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, err := api.PddAPI.ResourceURLGen(sID, resourceType); err == nil {
|
//传了goodsID表示是商品分享
|
||||||
switch linkType {
|
if goodsID != "" {
|
||||||
case partner.LinkTypeWeiXinMini:
|
authBindFlag, err := api.PddAPI.MemberAuthorityQuery(sID)
|
||||||
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
case partner.LinTypeH5:
|
}
|
||||||
return result.SingleURLList.URL, err
|
if result, err := api.PddAPI.GoodsPromotionURLGen(sID, goodsID, !authBindFlag); err == nil {
|
||||||
case partner.LinTypeWx:
|
switch linkType {
|
||||||
return result.WeAppInfo.PagePath, err
|
case partner.LinTypeH5:
|
||||||
default:
|
return result.MobileURL, err
|
||||||
return link, fmt.Errorf("暂不支持此链接类型!")
|
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
|
return link, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"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 {
|
if result, err2 := api.TbUnionAPI.ActivityInfoGet(userID, utils.Int2Str(unionActID), utils.Str2Int64(sID)); err2 == nil {
|
||||||
switch linkType {
|
switch linkType {
|
||||||
case partner.LinkTypeWeiXinMini:
|
case partner.LinkTypeWeiXinMini:
|
||||||
|
|||||||
@@ -29,16 +29,17 @@ func (c *UnionController) GetUnionActList() {
|
|||||||
// @Title 分享联盟链接
|
// @Title 分享联盟链接
|
||||||
// @Description 分享联盟链接
|
// @Description 分享联盟链接
|
||||||
// @Param token header string true "认证token"
|
// @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 shareType formData int true "分享类型,1为当前用户分享给别人,2为当前用户自己领取"
|
||||||
// @Param resourceType formData int false "资源类型"
|
// @Param resourceType formData int false "资源类型"
|
||||||
// @Param linkType formData int true "链接类型,1 h5链接 2 deeplink(唤起)链接 3 中间页唤起链接 4 微信小程序唤起路径, 5为小程序二维码"
|
// @Param linkType formData int true "链接类型,1 h5链接 2 deeplink(唤起)链接 3 中间页唤起链接 4 微信小程序唤起路径, 5为小程序二维码"
|
||||||
|
// @Param goodsID formData string false "分享商品时的商品ID"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /ShareUnionLink [post]
|
// @router /ShareUnionLink [post]
|
||||||
func (c *UnionController) ShareUnionLink() {
|
func (c *UnionController) ShareUnionLink() {
|
||||||
c.callShareUnionLink(func(params *tUnionShareUnionLinkParams) (retVal interface{}, errCode string, err error) {
|
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
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user