UNPKG

egg-minifapp

Version:

对接各种小程序之类app的sdk

1 lines 6.82 kB
'use strict';const a19_0x4c3d43=a19_0x39f6;(function(_0x6a018,_0x4967d5){const _0x3baeb7=a19_0x39f6,_0x5bfa7b=_0x6a018();while(!![]){try{const _0x518881=parseInt(_0x3baeb7(0x16c))/0x1+-parseInt(_0x3baeb7(0x15b))/0x2*(-parseInt(_0x3baeb7(0x17c))/0x3)+-parseInt(_0x3baeb7(0x146))/0x4+-parseInt(_0x3baeb7(0x15f))/0x5+-parseInt(_0x3baeb7(0x166))/0x6*(-parseInt(_0x3baeb7(0x170))/0x7)+-parseInt(_0x3baeb7(0x16d))/0x8+parseInt(_0x3baeb7(0x15e))/0x9;if(_0x518881===_0x4967d5)break;else _0x5bfa7b['push'](_0x5bfa7b['shift']());}catch(_0x3b80b9){_0x5bfa7b['push'](_0x5bfa7b['shift']());}}}(a19_0x3303,0xf2120));var __awaiter=this&&this[a19_0x4c3d43(0x163)]||function(_0x54aa82,_0x558e49,_0x4cf9bd,_0x430aa3){function _0x70b4c4(_0x3dcee8){return _0x3dcee8 instanceof _0x4cf9bd?_0x3dcee8:new _0x4cf9bd(function(_0x16d58b){_0x16d58b(_0x3dcee8);});}return new(_0x4cf9bd||(_0x4cf9bd=Promise))(function(_0x2cfdd5,_0xf603b6){const _0x385708=a19_0x39f6;function _0x58110c(_0xf1991){const _0x113b3d=a19_0x39f6;try{_0x29b6d0(_0x430aa3[_0x113b3d(0x173)](_0xf1991));}catch(_0x2ccddc){_0xf603b6(_0x2ccddc);}}function _0x7e7384(_0x18e637){const _0x35e126=a19_0x39f6;try{_0x29b6d0(_0x430aa3[_0x35e126(0x148)](_0x18e637));}catch(_0xc1fcfd){_0xf603b6(_0xc1fcfd);}}function _0x29b6d0(_0x1d9d01){const _0x5690c5=a19_0x39f6;_0x1d9d01[_0x5690c5(0x16f)]?_0x2cfdd5(_0x1d9d01[_0x5690c5(0x159)]):_0x70b4c4(_0x1d9d01[_0x5690c5(0x159)])[_0x5690c5(0x16b)](_0x58110c,_0x7e7384);}_0x29b6d0((_0x430aa3=_0x430aa3[_0x385708(0x14b)](_0x54aa82,_0x558e49||[]))[_0x385708(0x173)]());});};Object[a19_0x4c3d43(0x179)](exports,a19_0x4c3d43(0x150),{'value':!![]}),exports['wxmini']=void 0x0;const base_1=require(a19_0x4c3d43(0x154)),AccountApiPool_1=require(a19_0x4c3d43(0x161)),util_1=require(a19_0x4c3d43(0x162)),wxminiurl='https://api.weixin.qq.com';function a19_0x39f6(_0x473deb,_0x222b9b){const _0x3303d6=a19_0x3303();return a19_0x39f6=function(_0x39f67a,_0x275474){_0x39f67a=_0x39f67a-0x145;let _0x5cb2a7=_0x3303d6[_0x39f67a];return _0x5cb2a7;},a19_0x39f6(_0x473deb,_0x222b9b);}class wxmini extends base_1['Base']{constructor(_0xe806a2){const _0x1214c3=a19_0x4c3d43;super(),this[_0x1214c3(0x145)]=_0xe806a2['appid'],this[_0x1214c3(0x14c)]=_0xe806a2[_0x1214c3(0x14c)],this['redisconfig']=_0xe806a2['redis_options'];}[a19_0x4c3d43(0x15d)](){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x114f8c=a19_0x39f6,_0x496a92=this[_0x114f8c(0x145)]+_0x114f8c(0x158),_0xd26668=wxminiurl+'/cgi-bin/token';let _0x56b7a6;if(this[_0x114f8c(0x176)]){if(!this[_0x114f8c(0x176)][_0x114f8c(0x147)]&&!this[_0x114f8c(0x176)][_0x114f8c(0x15a)])throw new Error(_0x114f8c(0x164));const _0x3be51b=yield(0x0,AccountApiPool_1[_0x114f8c(0x151)])(this[_0x114f8c(0x176)]||{'host':'127.0.0.1','port':0xcea,'password':'','db':0x0}),_0x3330d0=yield _0x3be51b[_0x114f8c(0x17a)](_0x496a92);if(_0x3330d0){const _0x8e80c3=JSON[_0x114f8c(0x14d)](_0x3330d0);_0x56b7a6=_0x8e80c3;}else{const _0x5cfad3={'appid':this['appid'],'secret':this[_0x114f8c(0x14c)],'grant_type':_0x114f8c(0x155)},_0x10280d=(0x0,util_1[_0x114f8c(0x167)])(_0x5cfad3),_0x10c114=_0xd26668+('?'+_0x10280d),_0x332040=yield this[_0x114f8c(0x174)](_0x10c114);if(!_0x332040['access_token'])throw new Error(''+JSON[_0x114f8c(0x177)](_0x332040));const _0x23a415=yield _0x3be51b['set'](_0x496a92,JSON[_0x114f8c(0x177)](_0x332040[_0x114f8c(0x157)])),_0x28aff5=yield _0x3be51b[_0x114f8c(0x169)](_0x496a92,_0x332040[_0x114f8c(0x17b)]-0x258);if(!_0x23a415)throw new Error(_0x114f8c(0x171));_0x56b7a6=_0x332040['access_token'];}}else{const _0x308247=(0x0,AccountApiPool_1[_0x114f8c(0x16e)])(this['appid']),_0x1e3853=_0x308247['get'](_0x496a92);if(_0x1e3853)_0x56b7a6=_0x1e3853;else{const _0x144e47={'appid':this[_0x114f8c(0x145)],'secret':this[_0x114f8c(0x14c)],'grant_type':_0x114f8c(0x155)},_0x6f2063=(0x0,util_1['querystringfun'])(_0x144e47),_0x510cd7=_0xd26668+('?'+_0x6f2063),_0x1ef76a=yield this[_0x114f8c(0x174)](_0x510cd7);if(!_0x1ef76a[_0x114f8c(0x157)])throw new Error(''+JSON[_0x114f8c(0x177)](_0x1ef76a));const _0x3d3241=_0x308247['set'](_0x496a92,_0x1ef76a['access_token'],_0x1ef76a['expires_in']-0x258);_0x56b7a6=_0x1ef76a[_0x114f8c(0x157)];}}return _0x56b7a6;});}[a19_0x4c3d43(0x160)](_0x2115a1){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4d3e16=a19_0x39f6;if(!_0x2115a1)throw new Error(_0x4d3e16(0x152));const _0x1d9adf=yield this[_0x4d3e16(0x15d)](),_0x52302=wxminiurl+_0x4d3e16(0x156),_0x688a78={'js_code':_0x2115a1,'secret':this['appSecret'],'appid':this[_0x4d3e16(0x145)],'grant_type':_0x4d3e16(0x14f)},_0x2d8e69=(0x0,util_1[_0x4d3e16(0x167)])(_0x688a78),_0x101966=_0x52302+('?'+_0x2d8e69);console[_0x4d3e16(0x175)](_0x101966);const _0x191de3=yield this[_0x4d3e16(0x174)](_0x101966,{'access_token':_0x1d9adf});return _0x191de3;});}[a19_0x4c3d43(0x165)](_0x9a651e){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x196ee0=a19_0x39f6;if(!_0x9a651e)throw new Error(_0x196ee0(0x178));const _0x38b181=yield this['getAccessToken'](),_0x2c186a=wxminiurl+'/wxa/business/getuserphonenumber',_0x4b83e8={'code':_0x9a651e,'access_token':_0x38b181},_0x39f5f9=(0x0,util_1[_0x196ee0(0x167)])(_0x4b83e8),_0x583da=_0x2c186a+('?'+_0x39f5f9);console[_0x196ee0(0x175)](_0x196ee0(0x149),_0x583da);const _0x3a6c64=yield this['getRequest'](_0x583da,{'access_token':_0x38b181});return _0x3a6c64;});}[a19_0x4c3d43(0x153)](_0x12edec){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5d9896=a19_0x39f6;if(!_0x12edec[_0x5d9896(0x172)])throw new Error(_0x5d9896(0x16a));const _0x1a7b6a=yield this[_0x5d9896(0x15d)](),_0x514639=wxminiurl+_0x5d9896(0x14e)+_0x1a7b6a,_0x3f82f5=yield this[_0x5d9896(0x15c)](_0x514639,Object[_0x5d9896(0x168)]({},_0x12edec),{'access_token':_0x1a7b6a});return _0x3f82f5;});}}function a19_0x3303(){const _0x3b066d=['getPhoneNumber','264090KxXuTK','querystringfun','assign','expire','当前有字段是必填的~','then','1957501ugeHJn','11567968hmzHBi','createNodeCache','done','77MNeoww','设置redis值错误~','scene','next','getRequest','log','redisconfig','stringify','当前需要传入小程序端传过来验证手机号的code','defineProperty','get','expires_in','1347KrGQSW','appid','7417388HlXHHz','host','throw','o_url===>','wxmini','apply','appSecret','parse','/wxa/getwxacodeunlimit?access_token=','authorization_code','__esModule','createredis','当前需要传入小程序端传过来的登陆的code','getUnlimitedQRCode','./base','client_credential','/sns/jscode2session','access_token','-wxmini_AccessToken','value','port','6050kqdVCk','postRequest','getAccessToken','4536495HgaTyk','60415zkLLFv','wxcodelogin','./common/AccountApiPool','./common/util','__awaiter','你是需要配置redis缓存?但是看你配置的参数少了主要的host和port参数'];a19_0x3303=function(){return _0x3b066d;};return a19_0x3303();}exports[a19_0x4c3d43(0x14a)]=wxmini;