egg-minifapp
Version:
对接各种小程序之类app的sdk
1 lines • 12.7 kB
JavaScript
'use strict';const a17_0x737efa=a17_0x54d0;(function(_0x4edc99,_0x1bc3d9){const _0x1918d7=a17_0x54d0,_0x213315=_0x4edc99();while(!![]){try{const _0x1365ac=-parseInt(_0x1918d7(0x117))/0x1+parseInt(_0x1918d7(0x123))/0x2*(parseInt(_0x1918d7(0x110))/0x3)+-parseInt(_0x1918d7(0x116))/0x4+-parseInt(_0x1918d7(0x14c))/0x5*(parseInt(_0x1918d7(0x151))/0x6)+parseInt(_0x1918d7(0x13d))/0x7+-parseInt(_0x1918d7(0x14a))/0x8+-parseInt(_0x1918d7(0x12d))/0x9*(-parseInt(_0x1918d7(0x143))/0xa);if(_0x1365ac===_0x1bc3d9)break;else _0x213315['push'](_0x213315['shift']());}catch(_0x29d35f){_0x213315['push'](_0x213315['shift']());}}}(a17_0x1c8f,0xbc97e));function a17_0x54d0(_0x201b52,_0x32f1e3){const _0x1c8fdf=a17_0x1c8f();return a17_0x54d0=function(_0x54d08a,_0x55fa02){_0x54d08a=_0x54d08a-0x10c;let _0x457962=_0x1c8fdf[_0x54d08a];return _0x457962;},a17_0x54d0(_0x201b52,_0x32f1e3);}var __awaiter=this&&this['__awaiter']||function(_0xa9717b,_0x3d1c21,_0x1ad42d,_0x5a3477){function _0x40e527(_0x3026b7){return _0x3026b7 instanceof _0x1ad42d?_0x3026b7:new _0x1ad42d(function(_0x2bfeef){_0x2bfeef(_0x3026b7);});}return new(_0x1ad42d||(_0x1ad42d=Promise))(function(_0x53b863,_0x2655b6){const _0x2ad799=a17_0x54d0;function _0x57f9f0(_0x4b0dbe){try{_0x4b7ab8(_0x5a3477['next'](_0x4b0dbe));}catch(_0x3d193b){_0x2655b6(_0x3d193b);}}function _0x34f0c8(_0x26a686){const _0x5e7b7b=a17_0x54d0;try{_0x4b7ab8(_0x5a3477[_0x5e7b7b(0x118)](_0x26a686));}catch(_0xbebb76){_0x2655b6(_0xbebb76);}}function _0x4b7ab8(_0x488a8a){const _0x1e06fa=a17_0x54d0;_0x488a8a[_0x1e06fa(0x137)]?_0x53b863(_0x488a8a['value']):_0x40e527(_0x488a8a[_0x1e06fa(0x10d)])[_0x1e06fa(0x11a)](_0x57f9f0,_0x34f0c8);}_0x4b7ab8((_0x5a3477=_0x5a3477[_0x2ad799(0x115)](_0xa9717b,_0x3d1c21||[]))[_0x2ad799(0x139)]());});};Object[a17_0x737efa(0x11c)](exports,'__esModule',{'value':!![]}),exports[a17_0x737efa(0x111)]=void 0x0;const base_1=require('./base'),AccountApiPool_1=require(a17_0x737efa(0x136)),util_1=require(a17_0x737efa(0x10f)),tik_tok_live_url=a17_0x737efa(0x156);class tik_tok extends base_1['Base']{constructor(_0x4a38e6){const _0x388a9c=a17_0x737efa;super(),this[_0x388a9c(0x11e)]=_0x4a38e6[_0x388a9c(0x11e)],this[_0x388a9c(0x133)]=_0x4a38e6[_0x388a9c(0x133)],this['redisconfig']=_0x4a38e6['redis_options'];}['getAccessToken'](){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x346c28=a17_0x54d0,_0x27e4e0=this['appid']+_0x346c28(0x122),_0xc06733=tik_tok_live_url+_0x346c28(0x125);let _0x1472ae;if(this[_0x346c28(0x120)]){if(!this['redisconfig'][_0x346c28(0x130)]&&!this['redisconfig']['port'])throw new Error('你是需要配置redis缓存?但是看你配置的参数少了主要的host和port参数');const _0x5bd55d=yield(0x0,AccountApiPool_1['createredis'])(this[_0x346c28(0x120)]||{'host':_0x346c28(0x124),'port':0xcea,'password':'','db':0x0}),_0x28cb41=yield _0x5bd55d['get'](_0x27e4e0);if(_0x28cb41){const _0x593482=JSON[_0x346c28(0x14e)](_0x28cb41);_0x1472ae=_0x593482;}else{const _0x414615=yield this['postRequest'](_0xc06733,{'client_key':this[_0x346c28(0x11e)],'client_secret':this[_0x346c28(0x133)],'grant_type':_0x346c28(0x155)});if(_0x414615[_0x346c28(0x13a)]==_0x346c28(0x12e))throw new Error(_0x346c28(0x11d)+_0x414615[_0x346c28(0x15a)]['error_code']+',返回消息:'+_0x414615[_0x346c28(0x15a)][_0x346c28(0x121)]);const _0x38427d=yield _0x5bd55d[_0x346c28(0x146)](_0x27e4e0,JSON[_0x346c28(0x114)](_0x414615['data'][_0x346c28(0x159)])),_0x58794d=yield _0x5bd55d[_0x346c28(0x14d)](_0x27e4e0,_0x414615['data'][_0x346c28(0x158)]-0x258);if(!_0x38427d)throw new Error('设置redis值错误~');_0x1472ae=_0x414615[_0x346c28(0x15a)][_0x346c28(0x159)];}}else{const _0x4bf0da=(0x0,AccountApiPool_1[_0x346c28(0x10e)])(this['appid']),_0x23566b=_0x4bf0da[_0x346c28(0x153)](_0x27e4e0);if(_0x23566b)_0x1472ae=_0x23566b;else{const _0x4dde02=yield this['postRequest'](_0xc06733,{'client_key':this[_0x346c28(0x11e)],'client_secret':this[_0x346c28(0x133)],'grant_type':'client_credential'});if(_0x4dde02[_0x346c28(0x13a)]==_0x346c28(0x12e))throw new Error(_0x346c28(0x11d)+_0x4dde02[_0x346c28(0x15a)][_0x346c28(0x145)]+_0x346c28(0x13f)+_0x4dde02[_0x346c28(0x15a)][_0x346c28(0x121)]);const _0x499260=_0x4bf0da['set'](_0x27e4e0,_0x4dde02['data'][_0x346c28(0x159)],_0x4dde02[_0x346c28(0x15a)][_0x346c28(0x158)]-0x258);_0x1472ae=_0x4dde02[_0x346c28(0x15a)][_0x346c28(0x159)];}}return _0x1472ae;});}['check_ticket_start'](_0x583fc1){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5b871a=a17_0x54d0,_0x312022={};if(_0x583fc1[_0x5b871a(0x129)]||_0x583fc1[_0x5b871a(0x126)]){if(_0x583fc1['short_chain']){if(!_0x583fc1[_0x5b871a(0x126)])throw new Error(_0x5b871a(0x10c));const _0x22a870=yield this['getshotreq'](_0x583fc1[_0x5b871a(0x126)]),_0x40781a=(0x0,util_1[_0x5b871a(0x12b)])(_0x22a870[_0x5b871a(0x13e)]);if(!_0x40781a[_0x5b871a(0x147)])throw new Error(_0x5b871a(0x15c));_0x312022['encrypted_data']=_0x40781a[_0x5b871a(0x147)];}else{if(_0x583fc1[_0x5b871a(0x129)])_0x312022[_0x5b871a(0x129)]=_0x583fc1[_0x5b871a(0x129)];else throw new Error('当前在验券准备步骤遇见了错误~');}const _0x392979=yield this[_0x5b871a(0x142)](),_0x128b54=tik_tok_live_url+_0x5b871a(0x138),_0x12c906=Object[_0x5b871a(0x150)]({},_0x312022),_0x1a9497=(0x0,util_1[_0x5b871a(0x12c)])(_0x12c906),_0x4ab4c8=_0x128b54+('?'+_0x1a9497),_0x59a429=yield this[_0x5b871a(0x112)](_0x4ab4c8,{'access-token':_0x392979});return _0x59a429;}else throw new Error(_0x5b871a(0x149));});}['check_ticket_open'](_0x1d77e8){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4a2282=a17_0x54d0,_0x23831c=yield this['getAccessToken'](),_0x119d39=tik_tok_live_url+'/goodlife/v1/fulfilment/certificate/verify',_0x552cdc=yield this[_0x4a2282(0x140)](_0x119d39,Object['assign']({},_0x1d77e8),{'access-token':_0x23831c});return _0x552cdc;});}[a17_0x737efa(0x12f)](_0x598309){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x218204=a17_0x54d0;if(!_0x598309[_0x218204(0x128)]||!_0x598309[_0x218204(0x11b)])throw new Error(_0x218204(0x152));const _0x215656=yield this[_0x218204(0x142)](),_0x891441=tik_tok_live_url+'/goodlife/v1/fulfilment/certificate/cancel',_0x4436fc=yield this['postRequest'](_0x891441,Object[_0x218204(0x150)]({},_0x598309),{'access-token':_0x215656});return _0x4436fc;});}[a17_0x737efa(0x15d)](_0x976e75){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x616b3=a17_0x54d0;if(!_0x976e75)throw new Error(_0x616b3(0x132));const _0x1d9bba=yield this[_0x616b3(0x142)](),_0x306d55=tik_tok_live_url+'/goodlife/v1/fulfilment/certificate/get';_0x976e75=encodeURIComponent(_0x976e75);const _0x15f7cd={'encrypted_code':_0x976e75},_0x448c73=(0x0,util_1['querystringfun'])(_0x15f7cd),_0x4a260d=_0x306d55+('?'+_0x448c73);console[_0x616b3(0x135)]('o_url======>',_0x4a260d);const _0x2aace5=yield this['getRequest'](_0x4a260d,{'access-token':_0x1d9bba});return _0x2aace5;});}['check_ticket_history_list'](_0xa5075e){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x47ed13=a17_0x54d0;if(!_0xa5075e[_0x47ed13(0x134)])throw new Error(_0x47ed13(0x154));const _0x4ddb8b=yield this['getAccessToken'](),_0x33c25d=tik_tok_live_url+_0x47ed13(0x148),_0x582d66=Object['assign']({},_0xa5075e),_0x524517=(0x0,util_1[_0x47ed13(0x12c)])(_0x582d66),_0x173e24=_0x33c25d+('?'+_0x524517);console['log'](_0x47ed13(0x13b),_0x173e24);const _0x4e8384=yield this['getRequest'](_0x173e24,{'access-token':_0x4ddb8b});return _0x4e8384;});}['check_ticket_detailed_query'](_0x1d6ea7){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x853f9=a17_0x54d0;if(!_0x1d6ea7[_0x853f9(0x134)])throw new Error(_0x853f9(0x154));const _0x25889f=yield this[_0x853f9(0x142)](),_0x329d1d=tik_tok_live_url+_0x853f9(0x119),_0x5d49e1=Object['assign']({},_0x1d6ea7),_0x11c608=(0x0,util_1['querystringfun'])(_0x5d49e1),_0x290361=_0x329d1d+('?'+_0x11c608);console[_0x853f9(0x135)](_0x853f9(0x13b),_0x290361);const _0x51db93=yield this[_0x853f9(0x112)](_0x290361,{'access-token':_0x25889f});return _0x51db93;});}[a17_0x737efa(0x144)](_0x450e16){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x55ff6b=a17_0x54d0;if(!_0x450e16[_0x55ff6b(0x134)])throw new Error('当前有需要必填的参数,但是你没有传或者有问题。请检查~');const _0x216c61=yield this[_0x55ff6b(0x142)](),_0xf3cb6c=tik_tok_live_url+'/goodlife/v1/settle/ledger/query',_0x1a289b=Object[_0x55ff6b(0x150)]({},_0x450e16),_0x191281=(0x0,util_1['querystringfun'])(_0x1a289b),_0x5ec8af=_0xf3cb6c+('?'+_0x191281);console[_0x55ff6b(0x135)](_0x55ff6b(0x13b),_0x5ec8af);const _0x431204=yield this[_0x55ff6b(0x112)](_0x5ec8af,{'access-token':_0x216c61});return _0x431204;});}[a17_0x737efa(0x141)](_0x418731){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x3ebb7e=a17_0x54d0,_0x41dec5=yield this[_0x3ebb7e(0x142)](),_0x54dff3=tik_tok_live_url+_0x3ebb7e(0x157),_0x92f7f1=Object[_0x3ebb7e(0x150)]({},_0x418731),_0x4c187f=(0x0,util_1['querystringfun'])(_0x92f7f1),_0x4b3907=_0x54dff3+('?'+_0x4c187f),_0x4a8a87=yield this[_0x3ebb7e(0x112)](_0x4b3907,{'access-token':_0x41dec5});return _0x4a8a87;});}[a17_0x737efa(0x11f)](_0x2a9043){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x372af3=a17_0x54d0;if(_0x2a9043[_0x372af3(0x134)]||_0x2a9043[_0x372af3(0x14f)]||_0x2a9043['third_id']){const _0x27e7f6=yield this[_0x372af3(0x142)](),_0x4dd00c=tik_tok_live_url+_0x372af3(0x131),_0x286f73=Object[_0x372af3(0x150)]({},_0x2a9043),_0x28c901=(0x0,util_1[_0x372af3(0x12c)])(_0x286f73),_0x33e8fc=_0x4dd00c+('?'+_0x28c901),_0x31a486=yield this[_0x372af3(0x112)](_0x33e8fc,{'access-token':_0x27e7f6});return _0x31a486;}else throw new Error(_0x372af3(0x113));});}['get_merchandise_online_data'](_0x3f5eb6){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x884dd5=a17_0x54d0,_0x111533=yield this[_0x884dd5(0x142)](),_0x462b8a=tik_tok_live_url+_0x884dd5(0x127),_0x18a709=Object[_0x884dd5(0x150)]({},_0x3f5eb6),_0x435620=(0x0,util_1[_0x884dd5(0x12c)])(_0x18a709),_0x7aebef=_0x462b8a+('?'+_0x435620),_0x3b556f=yield this['getRequest'](_0x7aebef,{'access-token':_0x111533});return _0x3b556f;});}[a17_0x737efa(0x14b)](_0x40b3cb){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x39299d=a17_0x54d0,_0x134823=yield this[_0x39299d(0x142)](),_0x45e2dc=tik_tok_live_url+_0x39299d(0x12a),_0x5f2489=Object[_0x39299d(0x150)]({},_0x40b3cb),_0x403dd8=(0x0,util_1['querystringfun'])(_0x5f2489),_0x2be953=_0x45e2dc+('?'+_0x403dd8),_0x221012=yield this['getRequest'](_0x2be953,{'access-token':_0x134823});return _0x221012;});}[a17_0x737efa(0x15b)](_0x1cb82b){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x57cba2=a17_0x54d0,_0x4cef05=yield this[_0x57cba2(0x142)](),_0x2af10e=tik_tok_live_url+_0x57cba2(0x13c),_0x2469f6=Object[_0x57cba2(0x150)]({},_0x1cb82b),_0x4bd6ec=(0x0,util_1['querystringfun'])(_0x2469f6),_0x5b3ac4=_0x2af10e+('?'+_0x4bd6ec),_0x1a3e3a=yield this[_0x57cba2(0x112)](_0x5b3ac4,{'access-token':_0x4cef05});return _0x1a3e3a;});}}function a17_0x1c8f(){const _0x26d646=['appSecret','account_id','log','./common/AccountApiPool','done','/goodlife/v1/fulfilment/certificate/prepare','next','message','o_url======>','/goodlife/v1/trade/order/query','5261620DootDT','url',',返回消息:','postRequest','query_record_by_cert','getAccessToken','125900QuwayW','check_ticket_merchantquery','error_code','set','object_id','/goodlife/v1/fulfilment/certificate/verify_record/query','当前需要传入核销code或者扫描短链的链接','3472288btWPyT','get_merchandise_online_data_list','15QkgXQD','expire','parse','poi_id','assign','2298138mjwryt','当前verify_id和certificate_id是必传的~','get','当前有需要必填的参数,但是你没有传或者有问题。请检查~','client_credential','https://open.douyin.com','/goodlife/v1/settle/ledger/query_record_by_cert','expires_in','access_token','data','get_trade_order_query','解析扫码的object_id错误~','check_ticket_certificateget','当前是扫码后解析但是缺少了这个短链~','value','createNodeCache','./common/util','3HhPLtl','tik_tok','getRequest','必须要传:抖音门店POI_ID\x20||三方ID\x20||\x20本地生活账户ID\x20的其中一个','stringify','apply','2405156guqNrC','1529555pfQrme','throw','/goodlife/v1/settle/ledger/detailed_query','then','certificate_id','defineProperty','code:','appid','get_poi_query','redisconfig','description','-tik_tok_AccessToken','2710514qpzGst','127.0.0.1','/oauth/client_token/','short_chain','/goodlife/v1/goods/product/online/get','verify_id','code','/goodlife/v1/goods/product/online/query','queryURLParams','querystringfun','1701tynCde','error','check_ticket_cancel','host','/goodlife/v1/shop/poi/query','当前encrypted_code参数是必传的~'];a17_0x1c8f=function(){return _0x26d646;};return a17_0x1c8f();}exports[a17_0x737efa(0x111)]=tik_tok;