收藏
回答

A 微信邀请 C,C 进入游戏后,A 金币+1,C 金币+1 结合定向分享能力请问是如何实现的呢?


设置query

var getsome=wx.setMessageToFriendQuery({

            shareMessageToFriendScene: 1

          })

然后子域分享给好友

        wx.shareMessageToFriend({

        openId: self.openid,

        })

好友通过分享进游戏 主域

 if(wx.getLaunchOptionsSync().query.shareMessageToFriendScene==1)

        {

            

        GameInfo.instance.openDataContext.postMessage({

            text:"onshare",

        })

        } 子域

        wx.onMessage(function (data){

            console.log("SHowRank");

            console.log("SHowRank");

            console.log("SHowRank");

            console.log("SHowRank");

            if(data.text=="showRank")

            {

                self.getWxData(data.openId);            }

            else if(data.text=="onshare")

            {

                self.onshare();

            }

        })

    onshare()

    {

            

        wx.modifyFriendInteractiveStorage({

            key: '1',

            opNum: 1,

            operation: 'add',

            quiet:true,

            success: (res=> { 

              // 后台验证通过

              console.log("后台验证通过modifyFriendInteractiveStorage");

            },

            fail: (err=> {

              // 后台验证不通过

              // other code ...

              console.log(err);

              console.log("后台验证失败modifyFriendInteractiveStorage");

            }

          })

    },

无法实现A 金币+1,C 金币+1



回答关注问题邀请回答
收藏
登录 后发表内容
问题标签