收藏
回答

为什么部分用户无法获取激励广告?

    xiazai: function(t) {

      var url = t.currentTarget.dataset.url;      // 获取全局广告数据      const globalAdData = getApp().globalData.adData;
      console.log('globalAdData',globalAdData)
      // 然后继续处理广告数据
      const adData = globalAdData.find(item => item.name === '**********');
      if (adData) {
        console.log(adData.adstate);
        if (adData.adstate) {
          wx.showModal({
            title'提示',
            content'需要观看广告才能获取哦,是否继续?',
            successfunction(res{
              if (res.confirm) {
                let rewardedVideoAd = wx.createRewardedVideoAd({ adUnitId'adunit-************' });
    
                rewardedVideoAd.onLoad(() => {
                  console.log('激励广告加载完成');
                });
    
                rewardedVideoAd.onError((err) => {
                  console.log('激励广告错误', err);
                  wx.showModal({
                    title'提示',
                    content'激励广告加载失败',
                    showCancelfalse
                  });
                  rewardedVideoAd.offError();
                });
    
                rewardedVideoAd.onClose((res) => {
                  if (res && res.isEnded) {
                    wx.setClipboardData({
                      data: url,
                      successfunction() {
                        wx.showToast({
                          title'复制成功',
                          icon'success',
                          duration2000
                        });
                      }
                    });
                  } else {
                    wx.showModal({
                      title'提示',
                      content'观看完整广告才能下载哦',
                      showCancelfalse
                    });
                  }
                });
    
                rewardedVideoAd.load().then(() => {
                  rewardedVideoAd.show().catch(() => {
                    wx.showModal({
                      title'提示',
                      content'广告展示失败,请稍后重试。电脑端无法获取广告',
                      showCancelfalse
                    });
                  });
                }).catch(() => {
                  wx.showModal({
                    title'提示',
                    content'广告展示失败,请稍后重试。电脑端无法获取广告',
                    showCancelfalse
                  });
                });
              }
            }
          });
        } else {
          wx.setClipboardData({
            data: url,
            successfunction() {
              wx.showToast({
                title'复制成功',
                icon'success',
                duration2000
              });
            }
          });
        }
      }
    },
回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    2023-08-11

    你好,麻烦在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点

    2023-08-11
    有用
    回复
登录 后发表内容