From 474c68f0fea10cc62977c67d186732b3346cdd53 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 17 一月 2023 18:04:45 +0800 Subject: [PATCH] 2023-01-17 --- src/api/index.js | 61 +++++++++++++++++++++++++++--- 1 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index aeead48..6d8e820 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -264,7 +264,7 @@ /** * @description 鎵嬫満鍙烽獙璇佺爜鐧诲綍 */ - getphoneusermsg (phoneNo, checkcode, isCloud = false, ipAddress, city) { + getphoneusermsg (phoneNo, checkcode, isCloud = false) { let param = { // func: 'webapi_login', mob: phoneNo, @@ -273,8 +273,8 @@ check_code: checkcode, way_no: 'sms_vcode', systemType: options.sysType, - login_city: city, - login_id_address: ipAddress, + login_city: sessionStorage.getItem('city') || '', + login_id_address: sessionStorage.getItem('ipAddress') || '', kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)), device_id: localStorage.getItem('SessionUid'), appkey: window.GLOB.appkey || '' @@ -303,14 +303,14 @@ /** * @description 鐧诲綍绯荤粺, 鑾峰彇鐢ㄦ埛淇℃伅 */ - getusermsg (username, password, isCloud = false, ipAddress, city) { + getusermsg (username, password, isCloud = false) { let param = { // func: 'webapi_login', UserName: username, systemType: options.sysType, Type: 'S', - login_city: city, - login_id_address: ipAddress, + login_city: sessionStorage.getItem('city') || '', + login_id_address: sessionStorage.getItem('ipAddress') || '', kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)), device_id: localStorage.getItem('SessionUid'), timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), @@ -366,6 +366,55 @@ }) } + delCacheConfig (type = '') { + let date = moment().subtract(7, 'days').format('YYYY-MM-DD') + CacheUtils.delWebSqlCacheConfig(date, type) + CacheUtils.delIndexDBCacheConfig(date, type) + } + + writeCacheConfig (menuid, data) { + if (!menuid) return + let date = moment().format('YYYY-MM-DD') + let _data = data ? JSON.stringify(data) : '' + + CacheUtils.writeCacheInWebSql([menuid, date, _data]) + CacheUtils.writeCacheInIndexDB({menuid, CreateDate: date, LongParam: _data}) + } + + getLCacheConfig (menuid) { + return new Promise((resolve, reject) => { + if (window.GLOB.WebSql) { + CacheUtils.getWebSqlCacheConfig(menuid).then(res => { + if (res && res.LongParam) { + let _data = JSON.parse(res.LongParam) + if (_data.length === 0) { + resolve() + } else { + resolve(_data) + } + } else { + resolve() + } + }) + } else if (window.GLOB.IndexDB) { + CacheUtils.getIndexDBCacheConfig(menuid).then(res => { + if (res && res.LongParam) { + let _data = JSON.parse(res.LongParam) + if (_data.length === 0) { + resolve() + } else { + resolve(_data) + } + } else { + resolve() + } + }) + } else { + resolve() + } + }) + } + /** * @description 鐧诲綍浜屾楠岃瘉 // positecgroup */ -- Gitblit v1.8.0