using Microsoft.Extensions.Options; using Repository.Models; namespace Repository.Helper { public interface IBackEndConfigHelper { /// /// 取得url_slot /// /// string GetUrlSlot(); /// /// 取得obixQuery /// /// string GetobixQuery(); string GetobixHisBqlQuery(); string GetobixHisUrlQuery(); /// /// 取 tag 分8段 or 5 段 /// /// string Getobixtag_quantity(); string Getobixtag_acc(); string Getobixtag_pass(); } public class BackEndConfigHelper : IBackEndConfigHelper { private NiagaraDataSyncConfig _NiagaraDataSyncConfig; private EDFunction ed; public BackEndConfigHelper(IOptions BackEndConfig) { _NiagaraDataSyncConfig = BackEndConfig.Value.NiagaraDataSyncConfig; ed = new EDFunction(); } public string GetUrlSlot() { return ed.AESDecrypt(_NiagaraDataSyncConfig.UrlSlot); } public string GetobixQuery() { return ed.AESDecrypt(_NiagaraDataSyncConfig.ObixQuery); } public string GetobixHisBqlQuery() { return ed.AESDecrypt(_NiagaraDataSyncConfig.ObixHisBqlQuery); } public string GetobixHisUrlQuery() { return ed.AESDecrypt(_NiagaraDataSyncConfig.ObixHisUrlQuery); } public string Getobixtag_quantity() { return ed.AESDecrypt(_NiagaraDataSyncConfig.tag_quantity); } public string Getobixtag_acc() { return ed.AESDecrypt(_NiagaraDataSyncConfig.Account); } public string Getobixtag_pass() { return ed.AESDecrypt(_NiagaraDataSyncConfig.Password); } } }