var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class PConfigCtl extends CtlBase{
   constructor(){
     super(CtlBase.getServiceName(PConfigCtl));
     this.cacheManager=system.getObject("db.cacheManager");
     //this.appS=system.getObject("service.appSve");
   }

   async initNewInstance(queryobj,qobj){
     var u=uuidv4();
     var aid=u.replace(/\-/g,"");
     var rd={name:"",appid:aid}
     return system.getResult2(rd,null);
   }
   async getConfigValue(obj,req){
     var configType=obj.configType;
     var pconfig=await this.cacheManager["PConfigCache"].cachePConfig();
     var result= pconfig.find(item => {
         return item.configType === configType;
     });
     return result;
   }
}
module.exports=PConfigCtl;
