mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-26 21:26:38 +08:00
1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
'use strict';const _0x508d18=_0x4f32;(function(_0x20a02b,_0xb7ee26){const _0x3f21c0=_0x4f32,_0x4d7471=_0x20a02b();while(!![]){try{const _0xedde4c=-parseInt(_0x3f21c0(0x1a9))/0x1+-parseInt(_0x3f21c0(0x196))/0x2+-parseInt(_0x3f21c0(0x19b))/0x3+-parseInt(_0x3f21c0(0x187))/0x4*(parseInt(_0x3f21c0(0x192))/0x5)+-parseInt(_0x3f21c0(0x193))/0x6*(-parseInt(_0x3f21c0(0x16a))/0x7)+parseInt(_0x3f21c0(0x1a1))/0x8+-parseInt(_0x3f21c0(0x169))/0x9*(-parseInt(_0x3f21c0(0x1c5))/0xa);if(_0xedde4c===_0xb7ee26)break;else _0x4d7471['push'](_0x4d7471['shift']());}catch(_0x5df537){_0x4d7471['push'](_0x4d7471['shift']());}}}(_0x6981,0xc35dc));var __decorate=this&&this['__decorate']||function(_0xf838c8,_0xb3f59b,_0x2803d3,_0x257cd7){const _0x1561dc=_0x4f32;var _0x248993=arguments[_0x1561dc(0x1a5)],_0x1c96f3=_0x248993<0x3?_0xb3f59b:_0x257cd7===null?_0x257cd7=Object['getOwnPropertyDescriptor'](_0xb3f59b,_0x2803d3):_0x257cd7,_0x447597;if(typeof Reflect===_0x1561dc(0x16e)&&typeof Reflect['decorate']==='function')_0x1c96f3=Reflect[_0x1561dc(0x18b)](_0xf838c8,_0xb3f59b,_0x2803d3,_0x257cd7);else{for(var _0x19a739=_0xf838c8[_0x1561dc(0x1a5)]-0x1;_0x19a739>=0x0;_0x19a739--)if(_0x447597=_0xf838c8[_0x19a739])_0x1c96f3=(_0x248993<0x3?_0x447597(_0x1c96f3):_0x248993>0x3?_0x447597(_0xb3f59b,_0x2803d3,_0x1c96f3):_0x447597(_0xb3f59b,_0x2803d3))||_0x1c96f3;}return _0x248993>0x3&&_0x1c96f3&&Object[_0x1561dc(0x197)](_0xb3f59b,_0x2803d3,_0x1c96f3),_0x1c96f3;},__metadata=this&&this[_0x508d18(0x1c3)]||function(_0x122bf7,_0x1a4bc8){const _0x1996e7=_0x508d18;if(typeof Reflect===_0x1996e7(0x16e)&&typeof Reflect['metadata']===_0x1996e7(0x1c2))return Reflect[_0x1996e7(0x182)](_0x122bf7,_0x1a4bc8);};function _0x4f32(_0x35f318,_0x427a55){const _0x69814f=_0x6981();return _0x4f32=function(_0x4f320b,_0x150dc6){_0x4f320b=_0x4f320b-0x165;let _0x353818=_0x69814f[_0x4f320b];return _0x353818;},_0x4f32(_0x35f318,_0x427a55);}Object['defineProperty'](exports,_0x508d18(0x1a3),{'value':!![]}),exports['OfficialService']=void 0x0;function _0x6981(){const _0x42b69b=['490976AuGJen','defineProperty','toFixed','AuthService','../chatgpt/chatgpt.service','696903SKdyWm','officialAutoReplyText','axios','bindWxBySceneStr','getRedirectUrl','design:paramtypes','6188392ctijbo','user','__esModule','get','length','https://api.weixin.qq.com/sns/oauth2/access_token?appid=','split','chatgptService','1091011YInPpU','wechatOfficialAppId','wechatAccessToken','verify','getWechatAccessToken','scanedSceneStrMap','autoreplyService','loginByOpenId','getUserById','jiangly','wechatOfficialAppSecret','回跳跳转地址:\x20','appId:\x20','../globalConfig/globalConfig.service','sceneStrMap','&secret=','HttpException','createRandomNonceStr','getUserOpenId','&response_type=code&scope=snsapi_base&state=weChatLogin#wechat_redirect','jsapiTicket:\x20','&redirect_uri=','log','tousername','&url=','function','__metadata','loginByCode','290yyKhuG','../../common/utils','sha1','authService','getQRSceneStrByBind','&noncestr=','700839HGahfj','523131TkMqvL','fetchQRCodeTicket','wechatOfficialToken','\x0a\x20\x20\x20\x20<xml>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<ToUserName><![CDATA[','object','getUserFromOpenId','str:\x20','userService','scan','scanBindWx','onModuleInit','genXmlMsg','jsapi_ticket=','HttpStatus','×tamp=','UserService','join','来自公众号的回复问题\x20=======>\x20超时导致问题无法回答完整','../user/user.service','genXmlMsgByConfig','BAD_REQUEST','checkAutoReply','../auth/auth.service','../autoreply/autoreply.service','metadata','@nestjs/common','ChatgptService',']]></FromUserName>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<CreateTime>','digest','95164gUTNhB',']]></Content>\x0a\x20\x20\x20\x20</xml>','crypto','非法参数','decorate','https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=','globalConfigService','race','https://open.weixin.qq.com/connect/oauth2/authorize?appid=','sort','getQRSceneStr','155JPuttJ','6NLzhkw','getConfigs','来自公众号的询问问题\x20=======>\x20'];_0x6981=function(){return _0x42b69b;};return _0x6981();}const chatgpt_service_1=require(_0x508d18(0x19a)),globalConfig_service_1=require(_0x508d18(0x1b6)),auth_service_1=require(_0x508d18(0x180)),user_service_1=require(_0x508d18(0x17c)),autoreply_service_1=require(_0x508d18(0x181)),common_1=require(_0x508d18(0x183)),crypto=require(_0x508d18(0x189)),axios_1=require(_0x508d18(0x19d)),utils_1=require(_0x508d18(0x1c6));let OfficialService=class OfficialService{constructor(_0x23b346,_0x2e05be,_0x31c0be,_0x859d85,_0x1db878){const _0x32a080=_0x508d18;this[_0x32a080(0x1af)]=_0x23b346,this[_0x32a080(0x171)]=_0x2e05be,this[_0x32a080(0x166)]=_0x31c0be,this[_0x32a080(0x18d)]=_0x859d85,this[_0x32a080(0x1a8)]=_0x1db878,this['sceneStrMap']={},this[_0x32a080(0x1ae)]={};}async[_0x508d18(0x174)](){const _0x3452f8=_0x508d18;await this['globalConfigService'][_0x3452f8(0x1ad)](!![]);}async[_0x508d18(0x191)](_0xafd04d){const _0x94a368=_0x508d18,{invitedBy:_0x1568c9}=_0xafd04d;let _0x33a942=(0x0,utils_1[_0x94a368(0x1ba)])(0x20);return _0x1568c9&&(_0x33a942+=':'+_0x1568c9),this[_0x94a368(0x1b7)][_0x33a942]=!![],_0x33a942;}async[_0x508d18(0x167)](_0x180d6b){const _0x4d73dc=_0x508d18,{id:_0x5c8267}=_0x180d6b[_0x4d73dc(0x1a2)],_0x43449a=(0x0,utils_1[_0x4d73dc(0x1ba)])(0x20)+'/'+_0x5c8267;return this[_0x4d73dc(0x1b7)][_0x43449a]=!![],_0x43449a;}async['getQRCodeTicket'](_0x2abb63){const _0x3c4a79=_0x508d18;return this[_0x3c4a79(0x16b)](_0x2abb63);}async[_0x508d18(0x19f)](_0x22e3f9){const _0x47d84a=_0x508d18,_0x2de5d8=await this['globalConfigService']['getConfigs'](['wechatOfficialAppId']),_0xd266cd=_0x47d84a(0x18f)+_0x2de5d8+_0x47d84a(0x1be)+encodeURIComponent(_0x22e3f9)+_0x47d84a(0x1bc);return console['log'](_0x47d84a(0x1b4),_0xd266cd),_0xd266cd;}async['getJsapiTicket'](_0x4bcff1){const _0x42cb60=_0x508d18,_0x3276bd=(0x0,utils_1[_0x42cb60(0x1ba)])(0x20),_0x209002=(Date['now']()/0x3e8)[_0x42cb60(0x198)](0x0),_0x2d5120=await this[_0x42cb60(0x18d)][_0x42cb60(0x194)](['wechatJsapiTicket']);console[_0x42cb60(0x1bf)](_0x42cb60(0x1bd),_0x2d5120);const _0x4af8d4=await this[_0x42cb60(0x18d)][_0x42cb60(0x194)]([_0x42cb60(0x1aa)]);console[_0x42cb60(0x1bf)](_0x42cb60(0x1b5),_0x4af8d4);const _0xf5e34=_0x42cb60(0x176)+_0x2d5120+_0x42cb60(0x168)+_0x3276bd+_0x42cb60(0x178)+_0x209002+_0x42cb60(0x1c1)+_0x4bcff1;console[_0x42cb60(0x1bf)](_0x42cb60(0x170),_0xf5e34);const _0x1907d8=this[_0x42cb60(0x165)](_0xf5e34);return{'appId':_0x4af8d4,'nonceStr':_0x3276bd,'timestamp':_0x209002,'signature':_0x1907d8};}async[_0x508d18(0x16b)](_0x4da7d5){const _0x3d1819=_0x508d18,_0x5a7095=await this[_0x3d1819(0x18d)]['getConfigs']([_0x3d1819(0x1ab)]),_0x3ca24d={'action_name':'QR_STR_SCENE','action_info':{'scene':{'scene_str':_0x4da7d5}}},_0x3d75f1=await axios_1['default']['post'](_0x3d1819(0x18c)+_0x5a7095,_0x3ca24d),{data:{errmsg:_0x1f6ec7,ticket:_0x5db516}}=_0x3d75f1;if(_0x1f6ec7)throw new common_1[(_0x3d1819(0x1b9))](_0x1f6ec7,common_1['HttpStatus'][_0x3d1819(0x17e)]);return _0x5db516;}async[_0x508d18(0x1c4)](_0x380091,_0x3f529e){const _0x38282a=_0x508d18,_0x8c4c1c=await this['globalConfigService'][_0x38282a(0x194)](['wechatOfficialAppId']),_0x37b5fd=await this[_0x38282a(0x18d)][_0x38282a(0x194)]([_0x38282a(0x1b3)]),_0x515434=await axios_1['default'][_0x38282a(0x1a4)](_0x38282a(0x1a6)+_0x8c4c1c+_0x38282a(0x1b8)+_0x37b5fd+'&code='+_0x3f529e+'&grant_type=authorization_code'),{data:{errmsg:_0x40bdec,openid:_0x4f6d61}}=_0x515434;if(_0x40bdec)throw new common_1[(_0x38282a(0x1b9))](_0x40bdec,common_1['HttpStatus'][_0x38282a(0x17e)]);let _0x34df8e;return _0x34df8e=await this['userService'][_0x38282a(0x1bb)](_0x4f6d61),!_0x34df8e&&(_0x34df8e=await this[_0x38282a(0x171)][_0x38282a(0x16f)](_0x4f6d61)),this[_0x38282a(0x166)][_0x38282a(0x1b0)](_0x34df8e,_0x380091);}async[_0x508d18(0x172)](_0x356f44,_0x1b82e0){const _0x916c90=_0x508d18;if(!this['sceneStrMap'][_0x1b82e0])throw new common_1[(_0x916c90(0x1b9))](_0x916c90(0x18a),common_1[_0x916c90(0x177)][_0x916c90(0x17e)]);const _0x2da633=await this['userService'][_0x916c90(0x16f)](_0x356f44,_0x1b82e0);this[_0x916c90(0x1ae)][_0x1b82e0]=_0x2da633['id'];}async['loginBySceneStr'](_0x519a27,_0x3a31dc){const _0x149af9=_0x508d18;if(!this[_0x149af9(0x1b7)][_0x3a31dc])return;const _0x4598bb=this[_0x149af9(0x1ae)][_0x3a31dc];if(!_0x4598bb)return'';const _0x1f506e=await this['userService'][_0x149af9(0x1b1)](_0x4598bb);return delete this[_0x149af9(0x1ae)][_0x3a31dc],this[_0x149af9(0x166)][_0x149af9(0x1b0)](_0x1f506e,_0x519a27);}async[_0x508d18(0x173)](_0x238dd1,_0x4c6c33){const _0x44a132=_0x508d18;if(!this[_0x44a132(0x1b7)][_0x4c6c33])throw new common_1[(_0x44a132(0x1b9))]('非法参数',common_1[_0x44a132(0x177)]['BAD_REQUEST']);const _0x588fba=_0x4c6c33[_0x44a132(0x1a7)]('/')[0x1],_0x12e32e=await this[_0x44a132(0x171)]['bindWx'](_0x238dd1,_0x588fba);this['scanedSceneStrMap'][_0x4c6c33]=_0x12e32e;}async[_0x508d18(0x19e)](_0x3c43f9,_0x3f7a1d){const _0x112f68=_0x508d18;if(!this['sceneStrMap'][_0x3f7a1d])throw new common_1[(_0x112f68(0x1b9))]('非法参数',common_1[_0x112f68(0x177)][_0x112f68(0x17e)]);const {id:_0x2424b8}=_0x3c43f9[_0x112f68(0x1a2)],_0x22ac1b=this[_0x112f68(0x1ae)][_0x3f7a1d];if(!_0x22ac1b)return'';return delete this[_0x112f68(0x1ae)][_0x3f7a1d],_0x22ac1b;}async[_0x508d18(0x1ac)](_0x889e08,_0x13e7cb,_0x302bd5){const _0xa7d58d=_0x508d18,_0x48422d=await this[_0xa7d58d(0x18d)][_0xa7d58d(0x194)]([_0xa7d58d(0x16c)])||_0xa7d58d(0x1b2);return await this[_0xa7d58d(0x165)]([_0x48422d,_0x13e7cb,_0x302bd5][_0xa7d58d(0x190)]()[_0xa7d58d(0x17a)](''))==_0x889e08;}['sha1'](_0x4fe714){const _0x3f5043=_0x508d18;return crypto['createHash'](_0x3f5043(0x165))['update'](_0x4fe714)[_0x3f5043(0x186)]('hex');}async[_0x508d18(0x17d)](_0x39bf1a,_0x1290bd){const _0x18ef66=_0x508d18,_0x265384=await this[_0x18ef66(0x18d)][_0x18ef66(0x194)]([_0x1290bd]);return this[_0x18ef66(0x175)](_0x39bf1a,_0x265384);}async[_0x508d18(0x175)](_0xde6a67,_0x13bb00){const _0x5f2632=_0x508d18;return _0x5f2632(0x16d)+_0xde6a67['fromusername'][0x0]+']]></ToUserName>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<FromUserName><![CDATA['+_0xde6a67[_0x5f2632(0x1c0)][0x0]+_0x5f2632(0x185)+new Date()['getTime']()+'</CreateTime>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<MsgType><![CDATA[text]]></MsgType>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<Content><{const _0x2b26f3=_0x508d18,_0x575e2d=new Promise((_0x255b2a,_0x5b30f7)=>{setTimeout(()=>{_0x5b30f7(new Error('请求超时'));},0x12c0);});let _0x245c95='';try{console[_0x2b26f3(0x1bf)](_0x2b26f3(0x195),_0x109e21);const _0x3065ab=await Promise[_0x2b26f3(0x18e)]([this[_0x2b26f3(0x1a8)]['chatSyncFree'](_0x109e21),_0x575e2d]);_0x245c95=_0x3065ab||await this['autoreplyService'][_0x2b26f3(0x17f)](_0x109e21);}catch(_0x256e8b){console[_0x2b26f3(0x1bf)](_0x2b26f3(0x17b)),_0x245c95=await this[_0x2b26f3(0x18d)][_0x2b26f3(0x194)]([_0x2b26f3(0x19c)])||'由于公众号的回复限制、过长的问题我们可能无法回复、您可以前往我们的官方站点享受更加完善的服务、如果您有更多问题、欢迎像我提问!';}return _0x245c95;}};OfficialService=__decorate([(0x0,common_1['Injectable'])(),__metadata(_0x508d18(0x1a0),[autoreply_service_1['AutoreplyService'],user_service_1[_0x508d18(0x179)],auth_service_1[_0x508d18(0x199)],globalConfig_service_1['GlobalConfigService'],chatgpt_service_1[_0x508d18(0x184)]])],OfficialService),exports['OfficialService']=OfficialService; |