UNPKG

egg-minifapp

Version:

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

1 lines 6.17 kB
'use strict';const a18_0x58f257=a18_0x445b;(function(_0x46bbf9,_0x1ab24c){const _0x27b5aa=a18_0x445b,_0x8003ed=_0x46bbf9();while(!![]){try{const _0x2aaf0c=parseInt(_0x27b5aa(0x1d5))/0x1*(-parseInt(_0x27b5aa(0x1f7))/0x2)+parseInt(_0x27b5aa(0x1f6))/0x3*(-parseInt(_0x27b5aa(0x1ee))/0x4)+parseInt(_0x27b5aa(0x1e0))/0x5+-parseInt(_0x27b5aa(0x1e7))/0x6*(parseInt(_0x27b5aa(0x1db))/0x7)+-parseInt(_0x27b5aa(0x1e5))/0x8*(parseInt(_0x27b5aa(0x1f3))/0x9)+parseInt(_0x27b5aa(0x1f4))/0xa+-parseInt(_0x27b5aa(0x1e3))/0xb*(-parseInt(_0x27b5aa(0x1d8))/0xc);if(_0x2aaf0c===_0x1ab24c)break;else _0x8003ed['push'](_0x8003ed['shift']());}catch(_0x290d0b){_0x8003ed['push'](_0x8003ed['shift']());}}}(a18_0x13c5,0x4e0e4));function a18_0x13c5(){const _0x3f9061=['tik_tok_mini_generate_schema','956952geNdiT','tik_tok_mini_login','1302702KAOVen','next','你是需要配置redis缓存?但是看你配置的参数少了主要的host和port参数','createredis','get','code:','then','2652XAsxpM','__esModule','parse','redisconfig','value','36orEEvt','4418690VgLxAN','done','417slwPnv','12LmiIRI','access_token','127.0.0.1','description','message',',返回消息:','error_code','appid','设置redis值错误~','expires_in','tik_tok_mini','set','port','log','client_credential','Base','appSecret','redisredget===========>','18154dxpmKR','stringify','host','10992PpRMaK','/api/apps/v2/token','/api/apps/v2/jscode2session','7jGhjNQ','data','getAccessToken','postRequest','throw','1651305utMRcL','apply','error','5335uXtZHI'];a18_0x13c5=function(){return _0x3f9061;};return a18_0x13c5();}var __awaiter=this&&this['__awaiter']||function(_0x2aa2a3,_0x3aedae,_0x66659e,_0xad3dff){function _0x23fe20(_0x515c09){return _0x515c09 instanceof _0x66659e?_0x515c09:new _0x66659e(function(_0x5744a0){_0x5744a0(_0x515c09);});}return new(_0x66659e||(_0x66659e=Promise))(function(_0x257e03,_0x5b07fb){const _0x4cb8e3=a18_0x445b;function _0x40fb5f(_0x210369){const _0x59d336=a18_0x445b;try{_0x3d029a(_0xad3dff[_0x59d336(0x1e8)](_0x210369));}catch(_0x5d8bbe){_0x5b07fb(_0x5d8bbe);}}function _0x1c5a05(_0x1f9b8b){const _0x443d85=a18_0x445b;try{_0x3d029a(_0xad3dff[_0x443d85(0x1df)](_0x1f9b8b));}catch(_0x53f2f8){_0x5b07fb(_0x53f2f8);}}function _0x3d029a(_0xc965e1){const _0x3946e9=a18_0x445b;_0xc965e1[_0x3946e9(0x1f5)]?_0x257e03(_0xc965e1[_0x3946e9(0x1f2)]):_0x23fe20(_0xc965e1[_0x3946e9(0x1f2)])[_0x3946e9(0x1ed)](_0x40fb5f,_0x1c5a05);}_0x3d029a((_0xad3dff=_0xad3dff[_0x4cb8e3(0x1e1)](_0x2aa2a3,_0x3aedae||[]))[_0x4cb8e3(0x1e8)]());});};Object['defineProperty'](exports,a18_0x58f257(0x1ef),{'value':!![]}),exports[a18_0x58f257(0x201)]=void 0x0;function a18_0x445b(_0xb526f7,_0x5a81a8){const _0x13c508=a18_0x13c5();return a18_0x445b=function(_0x445b74,_0x57ad11){_0x445b74=_0x445b74-0x1d2;let _0x3974eb=_0x13c508[_0x445b74];return _0x3974eb;},a18_0x445b(_0xb526f7,_0x5a81a8);}const base_1=require('./base'),AccountApiPool_1=require('./common/AccountApiPool'),tik_tok_mini_url='https://developer.toutiao.com';class tik_tok_mini extends base_1[a18_0x58f257(0x1d2)]{constructor(_0x3c606a){const _0x1635d0=a18_0x58f257;super(),this[_0x1635d0(0x1fe)]=_0x3c606a[_0x1635d0(0x1fe)],this[_0x1635d0(0x1d3)]=_0x3c606a[_0x1635d0(0x1d3)],this[_0x1635d0(0x1f1)]=_0x3c606a['redis_options'];}[a18_0x58f257(0x1dd)](){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x541256=a18_0x445b,_0x774005=this[_0x541256(0x1fe)]+'-tik_tok_mini_AccessToken',_0x5c2579=tik_tok_mini_url+_0x541256(0x1d9);let _0x34e436;if(this[_0x541256(0x1f1)]){if(!this[_0x541256(0x1f1)][_0x541256(0x1d7)]&&!this[_0x541256(0x1f1)][_0x541256(0x203)])throw new Error(_0x541256(0x1e9));const _0x201d4f=yield(0x0,AccountApiPool_1[_0x541256(0x1ea)])(this['redisconfig']||{'host':_0x541256(0x1f9),'port':0xcea,'password':'','db':0x0}),_0x544c03=yield _0x201d4f[_0x541256(0x1eb)](_0x774005);console[_0x541256(0x204)](_0x541256(0x1d4),_0x544c03);if(_0x544c03){const _0x5038ed=JSON[_0x541256(0x1f0)](_0x544c03);_0x34e436=_0x5038ed;}else{const _0x3af966=yield this[_0x541256(0x1de)](_0x5c2579,{'appid':this[_0x541256(0x1fe)],'secret':this[_0x541256(0x1d3)],'grant_type':_0x541256(0x205)});if(_0x3af966[_0x541256(0x1fb)]==_0x541256(0x1e2))throw new Error(_0x541256(0x1ec)+_0x3af966[_0x541256(0x1dc)]['error_code']+_0x541256(0x1fc)+_0x3af966[_0x541256(0x1dc)][_0x541256(0x1fa)]);const _0x22570f=yield _0x201d4f[_0x541256(0x202)](_0x774005,JSON[_0x541256(0x1d6)](_0x3af966[_0x541256(0x1dc)][_0x541256(0x1f8)])),_0x27f633=yield _0x201d4f['expire'](_0x774005,_0x3af966['data'][_0x541256(0x200)]-0x258);if(!_0x22570f)throw new Error(_0x541256(0x1ff));_0x34e436=_0x3af966[_0x541256(0x1dc)]['access_token'];}}else{const _0x34dbab=(0x0,AccountApiPool_1['createNodeCache'])(this[_0x541256(0x1fe)]),_0xc8e98f=_0x34dbab['get'](_0x774005);if(_0xc8e98f)_0x34e436=_0xc8e98f;else{const _0x286674=yield this[_0x541256(0x1de)](_0x5c2579,{'appid':this['appid'],'secret':this[_0x541256(0x1d3)],'grant_type':_0x541256(0x205)});if(_0x286674[_0x541256(0x1fb)]==_0x541256(0x1e2))throw new Error(_0x541256(0x1ec)+_0x286674[_0x541256(0x1dc)][_0x541256(0x1fd)]+_0x541256(0x1fc)+_0x286674['data'][_0x541256(0x1fa)]);const _0x2225f3=_0x34dbab[_0x541256(0x202)](_0x774005,_0x286674['data'][_0x541256(0x1f8)],_0x286674[_0x541256(0x1dc)][_0x541256(0x200)]-0x258);_0x34e436=_0x286674[_0x541256(0x1dc)]['access_token'];}}return _0x34e436;});}[a18_0x58f257(0x1e6)](_0x11e303,_0x2bf20e){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x40c1a9=a18_0x445b,_0xd21999=yield this[_0x40c1a9(0x1dd)](),_0x1a69ef=tik_tok_mini_url+_0x40c1a9(0x1da),_0x14a150=yield this['postRequest'](_0x1a69ef,{'appid':this['appid'],'secret':this[_0x40c1a9(0x1d3)],'code':_0x11e303,'anonymous_code':_0x2bf20e},{'access-token':_0xd21999});return _0x14a150;});}[a18_0x58f257(0x1e4)](_0x1f1ad1,_0x1a7cca){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x27a132=a18_0x445b,_0x16d9b4=yield this[_0x27a132(0x1dd)](),_0x2a20bb=tik_tok_mini_url+_0x27a132(0x1da),_0x1ef0bc=yield this['postRequest'](_0x2a20bb,{'appid':this['appid'],'secret':this[_0x27a132(0x1d3)],'code':_0x1f1ad1,'anonymous_code':_0x1a7cca},{'access-token':_0x16d9b4});return _0x1ef0bc;});}}exports[a18_0x58f257(0x201)]=tik_tok_mini;