如何检查ionic 3已拥有/购买的非消耗性产品?

问题描述

我有一个视频列表页面。单击视频时,我必须检查视频是购买还是拥有的。所以写这样的代码

    gotoVideo(video:any){
    alert(JSON.stringify(video))
    if(video.product_id == null || video.product_id == ''){
      this.navCtrl.push(SingleVideoPage,{video:video,user_type:"student"});
    }else{
      if(video.owned == true){
        //go
        this.navCtrl.push(SingleVideoPage,user_type:"student"});
      }else{
        let iapProduct:IAPProduct = this.store.products.find(p => p.id == video.product_id);
        this.store.order(iapProduct).then(p => {
           // Purchase in progress!
          // alert(JSON.stringify(p))
        },e => {
          // alert(JSON.stringify(e))
          this.presentAlert(`Failed to purchase: ${e}`);
        }).catch((e)=>{
          // alert(JSON.stringify(e))
        });
        this.store.when('product')
        .owned((p: IAPProduct) => {
          alert('owned')
          p.finish();
          this.ref.detectChanges();
          return p.verify();
        });
        this.store.when('product')
        .approved((p: IAPProduct) => {
          alert('approved')
          p.finish();
         this.ref.detectChanges();
         return p.verify();
        });
  }
    }
 }

但是它不起作用。始终拥有:沙箱中的false 如何实现这一目标。请帮助我。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)