Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ff() {
- Logger.log(getVoo('Н695МТ716'))
- }
- function getVoo(plate) {
- var cache = CacheService.getScriptCache();
- var dict = JSON.parse(cache.get(cacheNameVoo));
- if (!dict) { dict = vooToProperty(cache) }
- if (dict.filter(t => t == plate).length) {
- sendMessage(320117024, 'номер найден в базе лицензий.')
- }
- }
- function vooToProperty(cache = CacheService.getScriptCache()) {
- //to_property
- const getVooFromBase = retry(1, get, getIdFromUrl(sourceVuUrl), sourceVuRange).filter(g => g[0]);
- const sheet = SpreadsheetApp.getActive().getSheetByName('аудит');
- const getVooFromActiveSheet = sheet.getRange("F1:L" + sheet.getLastRow()).getValues()
- .filter(g => g[6] == 'лицензия верифицирована').map(g => g[0]);
- //unique
- const vooArray = [...new Set(getVooFromBase.concat(getVooFromActiveSheet))];
- // const vooObj = Object.fromEntries(vooArray);
- var chunky = ChunkyCache(cache, 1024 * 90);
- chunky.remove(cacheNameVoo);
- console.log('кэш очищен')
- chunky.put(cacheNameVoo, JSON.stringify(vooArray), 1024 * 90);
- console.log('кэш добавлен')
- return vooArray;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement