| 
															
																@@ -64,19 +64,15 @@ module.exports = app => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																          * @return {String} 详细地址
 
															 | 
															
															 | 
															
																          * @return {String} 详细地址
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																          */
 
															 | 
															
															 | 
															
																          */
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         async getIpInfoFromApi(a_ip = '') {
 
															 | 
															
															 | 
															
																         async getIpInfoFromApi(a_ip = '') {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            try {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                if (!a_ip) return '';
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                if (a_ip === '127.0.0.1' || a_ip === '::1' || a_ip.indexOf('192.168') !== -1) return '服务器本机访问';
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                const { ip = '', region = '', city = '', isp = '' } = await this.sendRequest(a_ip);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                let address = '';
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                region && (address += region + '省');
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                city && (address += city + '市 ');
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                isp && (address += isp + ' ');
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                ip && (address += `(${ip})`);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                return address;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            } catch (error) {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                return '';
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            }
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (!a_ip) return '';
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (a_ip === '127.0.0.1' || a_ip === '::1' || a_ip.indexOf('192.168') !== -1) return '服务器本机访问';
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            const { ip = '', region = '', city = '', isp = '' } = await this.sendRequest(a_ip);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            let address = '';
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            region && (address += region + '省');
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            city && (address += city + '市 ');
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            isp && (address += isp + ' ');
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            ip && (address += `(${ip})`);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return address;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }
 
															 | 
															
															 | 
															
																         }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -87,7 +83,7 @@ module.exports = app => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																          * @private
 
															 | 
															
															 | 
															
																          * @private
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																          */
 
															 | 
															
															 | 
															
																          */
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         async sendRequest(ip) {
 
															 | 
															
															 | 
															
																         async sendRequest(ip) {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            return new Promise((resolve, reject) => {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return new Promise(resolve => {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 this.ctx.curl(`https://api01.aliyun.venuscn.com/ip?ip=${ip}`, {
 
															 | 
															
															 | 
															
																                 this.ctx.curl(`https://api01.aliyun.venuscn.com/ip?ip=${ip}`, {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     dateType: 'json',
 
															 | 
															
															 | 
															
																                     dateType: 'json',
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     encoding: 'utf8',
 
															 | 
															
															 | 
															
																                     encoding: 'utf8',
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -99,15 +95,15 @@ module.exports = app => { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     if (status === 200) {
 
															 | 
															
															 | 
															
																                     if (status === 200) {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         const result = JSON.parse(data.toString()).data;
 
															 | 
															
															 | 
															
																                         const result = JSON.parse(data.toString()).data;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         if (!result.ip) {
 
															 | 
															
															 | 
															
																                         if (!result.ip) {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                            resolve();
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            resolve({});
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         } else {
 
															 | 
															
															 | 
															
																                         } else {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             resolve(result);
 
															 | 
															
															 | 
															
																                             resolve(result);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         }
 
															 | 
															
															 | 
															
																                         }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     } else {
 
															 | 
															
															 | 
															
																                     } else {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        resolve();
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        resolve({});
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     }
 
															 | 
															
															 | 
															
																                     }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                }).catch(error => {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    reject(error);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                }).catch(() => {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    resolve({});
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 });
 
															 | 
															
															 | 
															
																                 });
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             });
 
															 | 
															
															 | 
															
																             });
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }
 
															 | 
															
															 | 
															
																         }
 
															 |