NAGEN / meituanScript

// ==UserScript==
// @name            meituanScript
// @version         1.0.1
// @description     美团商家自动回复顾客评论和自动出餐脚本
// @include         https://waimaieapp.meituan.com/frontweb/userComment*
// @include         https://e.waimai.meituan.com*
// @run-at          document-end
// @grant           GM_xmlhttpRequest
// @license MIT
// ==/UserScript==

!function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=o(1);for(const e in r.default)new RegExp("^"+e).test(location.href)&&r.default[e]()},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=o(2),n=o(6),i={"https://waimaieapp.meituan.com/frontweb/userComment":r.default,"https://e.waimai.meituan.com/new_fe/business_gw":n.default};t.default=i},function(e,t,o){"use strict";var r=this&&this.__awaiter||function(e,t,o,r){return new(o||(o=Promise))((function(n,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=o(3),i=o(5),s=o(4);t.default=function(){return r(this,void 0,void 0,(function*(){try{const e={token:sessionStorage.getItem("token"),acctId:sessionStorage.getItem("acctId"),wmPoiId:sessionStorage.getItem("wmPoiId"),bsid:sessionStorage.getItem("bsid"),ignoreSetRouterProxy:!0,appType:3,pageNum:1,pageSize:10,commScore:1,commType:0,hasContent:-1,beginTime:1632528e3,endTime:163512e4,periodType:1,onlyAuditNotPass:0,commentKeyWord:"",optimus_uuid:"",optimus_risk_level:"",optimus_code:10,optimus_partner:19},t=(yield n.default({url:"https://waimaieapp.meituan.com/gw/customer/comment/list",method:"GET",data:e})).data.list;for(const e of t){const t={token:sessionStorage.getItem("token"),acctId:sessionStorage.getItem("acctId"),wmPoiId:sessionStorage.getItem("wmPoiId"),bsid:sessionStorage.getItem("bsid"),ignoreSetRouterProxy:!0,appType:3,toCommentId:e.id,comment:i.replyText[Math.floor(Math.random()*i.replyText.length)],userCommentCtime:s.formatDateTime("yyyy-MM-dd")};console.debug(t);yield n.default({url:"https://waimaieapp.meituan.com/gw/customer/comment/reply?ignoreSetRouterProxy=true",method:"POST",data:t,headers:{"Content-Type":"application/x-www-form-urlencoded"}})}}catch(e){console.error(e)}}))}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=o(4);t.default=function(e){const t={async:!0,timeout:3e3,responseType:"json"};for(const o in e)t[o]=e[o];"GET"===e.method&&e.data&&(t.url+="?"+r.serialize(e.data));const o=new XMLHttpRequest;return new Promise((e,n)=>{o.open(t.method,t.url,t.async),o.timeout=t.timeout;for(const e in t.headers)o.setRequestHeader(e,t.headers[e]);o.responseType=t.responseType,o.onabort=()=>{n(new Error(JSON.stringify({errorType:"abort_error",xhr:o})))},o.ontimeout=()=>{n(new Error(JSON.stringify({errorType:"timeout_error",xhr:o})))},o.onerror=()=>{n(new Error(JSON.stringify({errorType:"onerror",xhr:o})))},o.onloadend=()=>{o.status>=200&&o.status<300||304===o.status?e(o.response):n({errorType:"status_error",xhr:o})};try{o.send(r.serialize(t.data))}catch(e){n(new Error(JSON.stringify({errorType:"send_error",xhr:o})))}})}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatDateTime=t.serialize=void 0,t.serialize=function(e){if(!e)return"";const t=[];for(let o in e){if(!e.hasOwnProperty(o))continue;if("function"==typeof e[o])continue;let r=e[o].toString();o=encodeURIComponent(o),r=encodeURIComponent(r),t.push(o+"="+r)}return t.join("&")},t.formatDateTime=function(e){const t=new Date,o={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,t.getFullYear()+""));for(const t in o)new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?o[t]:("00"+o[t]).substr((""+o[t]).length)));return e}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.replyText=void 0,t.replyText=["谢谢亲,我们的质量和服务一直都不会让亲失望的,非常感谢!","我们的追求不仅仅是让您吃饱,让您吃的健康和舒心才是我们的最大目标。您的每一个肯定都是对我们小店前进的大大的动力!","哎呀妈呀,收到好评以后头也不疼了,眼也不花了,又能继续干活了!^.^谢谢亲的支持。","世间最幸运的事莫过于遇到懂你的顾客,感谢您的认可!小店会越来越好!","感谢小店成长的路上有您的帮助和支持,最真挚的祝福送给您,许下美丽的心愿 ,让您所有的愿望都能实现!","宇宙的中心很小,希望我们的品质外卖能让您满足,要好好吃饭,好好宠爱自己哟!","每个顾客的肯定都让我们的努力和奋斗都有了意义,感谢您,祝您事事如意,欢迎常来光顾喔!"]},function(e,t,o){"use strict";var r=this&&this.__awaiter||function(e,t,o,r){return new(o||(o=Promise))((function(n,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=o(3),i=o(7);t.default=function(){return r(this,void 0,void 0,(function*(){setInterval(()=>r(this,void 0,void 0,(function*(){try{const e=(yield i.default({url:"https://e.waimai.meituan.com/v2/order/common/unprocessed/r/list?region_id=1000440100&region_version=1600916666&tag=prepMeal&pageSize=10&pageNum=1",method:"GET"})).data;for(const t of e.wmOrderList){const e=10,o=Date.now()/1e3;if(o>=t.order_time+t.estimated_make_time-e&&o<=t.order_time+t.estimated_make_time){yield n.default({url:"https://e.waimai.meituan.com/v2/common/w/reported/completeMealTime?region_id=1000440100&region_version=1600916666",method:"POST",data:{wmPoiId:t.wm_poi_id,wmOrderViewId:t.wm_order_id_view,csrfToken:window.top._csrfToken}})}}}catch(e){console.error(e)}})),1e3)}))}},function(e,t,o){"use strict";var r=this&&this.__awaiter||function(e,t,o,r){return new(o||(o=Promise))((function(n,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=o(4);t.default=function(e){return r(this,void 0,void 0,(function*(){return new Promise((t,o)=>{const r={timeout:3e3,responseType:"json",onabort:()=>{o(new Error(JSON.stringify({errorType:"abort_error"})))},ontimeout:()=>{o(new Error(JSON.stringify({errorType:"timeout_error"})))},onerror:()=>{o(new Error(JSON.stringify({errorType:"onerror"})))},onload:e=>{t(e.response)}};for(const t in e)r[t]="data"===t?n.serialize(e[t]):e[t];"GET"===e.method&&e.data&&(r.url+="?"+n.serialize(e.data)),GM_xmlhttpRequest(r)})}))}}]);