UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

61 lines (56 loc) 2.16 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var location_locationInterface = require('../location-interface.js'); // import { post } from '../../network/post'; // 用特权sdk获取lbs地址 var TipSdkLocation = /** @class */function () { function TipSdkLocation() {} TipSdkLocation.prototype.getLocation = function (options) { return new Promise(function (resolve, reject) { var _a; if (!options.fetchTipSdkLBSRequest) { reject(); return; } (_a = options.fetchTipSdkLBSRequest) === null || _a === void 0 ? void 0 : _a.call(options).then(function (response) { var _a, _b; // })) // post({ // url: 'https://a.igame.qq.com/pmdtrpc.commcgi.user.user/GetUserLbsInfo', // showMsgToast: false, // timeout: options.timeout, // }).then((response) => { if (response.lbsinfo) { if (((_a = response.lbsinfo.gpsinfo) === null || _a === void 0 ? void 0 : _a.lat) && response.lbsinfo.gpsinfo.lng) { var location_1 = { lat: parseFloat("".concat(response.lbsinfo.gpsinfo.lat)), lng: parseFloat("".concat(response.lbsinfo.gpsinfo.lng)) }; resolve({ location: location_1, flag: location_locationInterface.LocationFlag.LocationSuccess }); } else if (((_b = response.lbsinfo.netinfo) === null || _b === void 0 ? void 0 : _b.iplat) && response.lbsinfo.netinfo.iplng) { var location_2 = { lat: parseFloat("".concat(response.lbsinfo.netinfo.iplat)), lng: parseFloat("".concat(response.lbsinfo.netinfo.iplng)) }; resolve({ location: location_2, flag: location_locationInterface.LocationFlag.LocationIpSuccess }); } else { reject(); } } else { reject(); } })["catch"](function (error) { console.log('GetUserLbsInfo', error); reject(); }); }); }; return TipSdkLocation; }(); exports["default"] = TipSdkLocation;