您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
每月自动操作一次,替代用户点击生成亚马逊账单报告
当前为
// ==UserScript== // @name 自动生成亚马逊账单报告 // @namespace http://www.liu12.com/ // @version 0.1 // @description 每月自动操作一次,替代用户点击生成亚马逊账单报告 // @author 刘一二 // @match https://www.tampermonkey.net/index.php?version=4.9&ext=dhdg&updated=true // @grant none // ==/UserScript== (function() { 'use strict'; var AmazonReport = { year: 0, month: 0, /** * 获取账号 */ getAccount: function() { return $("#sc-mkt-switcher-form .sc-mkt-picker-switcher-txt")[0].html() }, /** * 申请生成报告 */ requestReport: function() { var postData = { reportType: "Transaction", timeRangeType: "Monthly", year: this.year, month: this.month }; alert(1); $.ajax({ type: "POST", url: "/payments/reports/custom/submit/generateReports", data: JSON.stringify(postData), dataType: "json", contentType: "application/json;charset=utf-8", success: function(response) { console.log(response); alert(2); } }); }, /** * 通知账单系统拉取报告, */ notify: function() { var _this = this; $.ajax({ type: "POST", url: "账单系统网址", data: { account:_this.getAccount(), yearMonth: (_this.year + "=" + _this.month) }, success: function(response) { console.log(response); } }); }, init: function() { var date = new Date(); var year = parseInt(date.getFullYear()); var month = parseInt(date.getMonth()); if (month == 0) { year--; month = 12; } this.year = year; this.month = month; var sKey = 'amazon-report-' + year + '-' + month console.log(localStorage.getItem(sKey)); if (localStorage.getItem(sKey) == null) { this.requestReport(); //this.notify(); localStorage.setItem(sKey, 1); } } }; $(function() { AmazonReport.init(); }); })();