UNPKG

gosf-atk

Version:

shared atk api.

44 lines (40 loc) 1.49 kB
'use strict' ; const HttpRequestModule = require('../module/HttpRequestModule') ; module.exports = class EventInfoService extends HttpRequestModule { constructor( performId = '' ){ super() ; this.performId = performId ; this.memcachedKey = `EVENTINFO[id:${this.performId}]` ; } async doGetEventInfo(){ let resp = null ; try{ resp = await this.getDataMemcached( this.memcachedKey ) ; if( resp == null ){ resp = await this.prepareHttp( process.env.API_GET_EVENT_INFO , {performId : this.performId}).post() ; return resp.data.code == 100 ? resp.data.data : null ; } return JSON.parse( resp ) ; }catch(e){ throw e ; } } doGetEventRef( eventInfo = {} ){ let resultList = [] ; if( eventInfo.eventRefList && eventInfo.eventRefList.length > 0 ){ eventInfo.eventRefList.forEach( ( evt ) => { let obj = {} ; obj.performId = evt.performId ; obj.isFull = evt.isFull ; obj.isPromo = evt.isPromo ; if( eventInfo.performStatus == 'C' ){ obj.performStatus = 'C' ; }else{ obj.performStatus = '' ; } resultList.push( obj ) ; }); } return resultList ; } }