expresstrade opskins nodejs存款无法正常工作

时间:2019-05-13 12:43:11

标签: javascript node.js npm

  

null {状态:312,     时间:1557750971,     消息:“您必须提供输入 items_to_send 和/或 items_to_receive '}   (节点:30370)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“ offer”       在ET.ITrade.SendOfferToSteamId(/var/www/html/quickstart/socket/driver.js:426:73)       在Request.request [作为_callback](/var/www/html/quickstart/socket/node_modules/expresstrade/index.js:192:9)       在Request.self.callback(/var/www/html/quickstart/socket/node_modules/request/request.js:185:22)       在emitTwo(events.js:126:13)       在Request.emit(events.js:214:7)       应要求。 (/var/www/html/quickstart/socket/node_modules/request/request.js:1161:10)       在emitOne上(events.js:116:13)       在Request.emit(events.js:211:7)       在IncomingMessage。 (/var/www/html/quickstart/socket/node_modules/request/request.js:1083:12)       在Object.onceWrapper(events.js:313:30)   (节点:30370)UnhandledPromiseRejectionWarning:未处理的承诺拒绝。引发此错误的原因可能是抛出了一个没有catch块的异步函数,或者是拒绝了一个.catch()无法处理的承诺。 (拒绝ID:2)

我已经尝试过将items_to_send放进去,但是它没有任何帮助吗?

console.log(items)
    ET.ITrade.SendOfferToSteamId({steam_id: user.steamid, items: items},async(err, res) => {
      console.log(err,res)
      if(!err && res.status != 400){
        socket.emit('notify','success','depositOfferSent',[res.response.offer.id])
        await delay(250)
        await WaitAccept(res.response.offer.id,d.cost)
      }else{
        socket.emit('notify','error','depositFailed')
      } 
     })
    })
    async function WaitAccept(offerID,cost){
      let status =2
      while(status != 3 || status != 7){
        let status = await GetState(offerID)
        if(status==3){
          console.log('Trade accepted')
          socket.emit('notify','depositOfferAccepted',[offerID,cost])
          connection.query("UPDATE users SET wallet=wallet+"+cost+" WHERE steamid="+user.steamid,(err,data)=>{
            if(!err){
              socket.emit('notify','success','addedCoins',[cost])
            }
          })
          break
        }else if(status == 7){
          socket.emit('notify','error','depositDecline')
          break;
        }
        await delay(1000)
      }
    }
    async function GetState(offerID){
      return await(new Promise(resolve=>{
        ET.ITrade.GetOffer({offer_id:offerID},(err,data)=>{
          if(!err&& typeof data.response !='undefined'){
            resolve(data.response.offer.state)
          }
        })
      }))
  }
    async function delay(n) {
      console.log(`Wait ${n}ms\n`)
      return new Promise(resolve => setTimeout(resolve, n))
    }    

当我尝试将其存放时,我无法使其正常工作在vgohardcore.com上显示此错误

0 个答案:

没有答案