妈蛋,总算搞定了,明天刘老板自己搞
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
"crypto-js": "^4.0.0",
|
"crypto-js": "^4.0.0",
|
||||||
"dayjs": "^1.11.9",
|
"dayjs": "^1.11.9",
|
||||||
"element-ui": "^2.15.13",
|
"element-ui": "^2.15.13",
|
||||||
|
"query-string": "^9.0.0",
|
||||||
"spark-md5": "^3.0.2",
|
"spark-md5": "^3.0.2",
|
||||||
"v-viewer": "^1.6.4",
|
"v-viewer": "^1.6.4",
|
||||||
"vue": "^2.6.14",
|
"vue": "^2.6.14",
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
* @param token 从cookie中获取,判断从[_m_h5_c,_m_h5_tk]中取值,优先判断第一个
|
* @param token 从cookie中获取,判断从[_m_h5_c,_m_h5_tk]中取值,优先判断第一个
|
||||||
* @param appKey 取值window.mtopConfig
|
* @param appKey 取值window.mtopConfig
|
||||||
* @param formData formData中的data
|
* @param formData formData中的data
|
||||||
|
* @param t 时间戳
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const getSign = (token, appKey, formData) => {
|
export const getSign = (token, appKey, formData, t = (new Date()).getTime()) => {
|
||||||
console.log("获取到的token:%s", token)
|
|
||||||
token = token?.split("_")[0]
|
token = token?.split("_")[0]
|
||||||
const t = (new Date()).getTime();
|
console.log("获取sign的参数:", token, appKey, formData, t)
|
||||||
return {
|
return {
|
||||||
t, sign: function (e) {
|
t, sign: function (e) {
|
||||||
function t(e, t) {
|
function t(e, t) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
import {getSign} from "@/api/aliExpress";
|
import {getSign} from "@/api/aliExpress";
|
||||||
|
import qs from "query-string"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据图片URL获取Blob对象
|
* 根据图片URL获取Blob对象
|
||||||
@@ -127,16 +128,14 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|||||||
new Promise(async (resolve) => {
|
new Promise(async (resolve) => {
|
||||||
let headers = {};
|
let headers = {};
|
||||||
headers['Content-Type'] = 'text/html';
|
headers['Content-Type'] = 'text/html';
|
||||||
headers.cookie = await getAliexpressCookie(request.url);
|
const cookie = await getAliexpressCookie(request.url);
|
||||||
const {_m_h5_c, _m_h5_tk} = cookie2Obj(headers.cookie)
|
const {_m_h5_c, _m_h5_tk} = cookie2Obj(cookie)
|
||||||
const {appKey, formData} = request
|
const {query: {data, appKey}} = qs.parseUrl(request.url)
|
||||||
|
const {formData = data} = request
|
||||||
const {sign, t} = getSign(_m_h5_c || _m_h5_tk, appKey, formData)
|
const {sign, t} = getSign(_m_h5_c || _m_h5_tk, appKey, formData)
|
||||||
const url = new URL(request.url)
|
const url = qs.stringifyUrl({url: request.url, query: {sign, t}})
|
||||||
let params = new URLSearchParams(url.search);
|
headers.cookie = await getAliexpressCookie(url);
|
||||||
params.append('t', t)
|
Promise.resolve().then(() => fetch(url, {
|
||||||
params.append('sign', sign)
|
|
||||||
url.search = params.toString()
|
|
||||||
Promise.resolve().then(() => fetch(url.toString(), {
|
|
||||||
'headers': headers, 'method': 'POST', 'referrerPolicy': 'no-referrer', 'credentials': 'include', 'mode': 'cors'
|
'headers': headers, 'method': 'POST', 'referrerPolicy': 'no-referrer', 'credentials': 'include', 'mode': 'cors'
|
||||||
})).then((res) => {
|
})).then((res) => {
|
||||||
// 创建了一个数据读取器
|
// 创建了一个数据读取器
|
||||||
|
|||||||
@@ -286,13 +286,7 @@ export default {
|
|||||||
getAliexpressGoodsList() {
|
getAliexpressGoodsList() {
|
||||||
sendAliexpressAPIMessage({
|
sendAliexpressAPIMessage({
|
||||||
type: "aliexpress",
|
type: "aliexpress",
|
||||||
url: "https://seller-acs.aliexpress.com/h5/mtop.global.merchant.self.product.manager.render.list/1.0/?jsv=2.7.2&appKey=30267743&v=1.0&timeout=15000&H5Request=true&url=mtop.global.merchant.self.product.manager.render.list&__channel-id__=701301&api=mtop.global.merchant.self.product.manager.render.list&type=originaljson&dataType=json&valueType=original&x-i18n-regionID=AE&data=%7B%22channelId%22%3A%22701301%22%2C%22jsonBody%22%3A%22%7B%5C%22tab%5C%22%3A%5C%22online_product%5C%22%2C%5C%22sort%5C%22%3A%7B%7D%2C%5C%22filter%5C%22%3A%7B%5C%22queryCategory%5C%22%3Anull%2C%5C%22lowerPrice%5C%22%3Anull%2C%5C%22upperPrice%5C%22%3Anull%2C%5C%22status%5C%22%3A%5C%220%5C%22%2C%5C%22productId%5C%22%3Anull%7D%2C%5C%22pagination%5C%22%3A%7B%5C%22pageSize%5C%22%3A10%2C%5C%22current%5C%22%3A2%7D%7D%22%2C%22from%22%3A%22SELF%22%2C%22bizParam%22%3A%22%7B%5C%22version%5C%22%3A%5C%22simple%5C%22%7D%22%7D",
|
url: "https://seller-acs.aliexpress.com/h5/mtop.global.merchant.self.product.manager.render.list/1.0/?jsv=2.7.2&appKey=30267743&t=1713978403051&sign=ba2bda69b4a2695c7279d4bc05f51741&v=1.0&timeout=15000&H5Request=true&url=mtop.global.merchant.self.product.manager.render.list&__channel-id__=701301&api=mtop.global.merchant.self.product.manager.render.list&type=originaljson&dataType=json&valueType=original&x-i18n-regionID=AE&data=%7B%22channelId%22%3A%22701301%22%2C%22jsonBody%22%3A%22%7B%5C%22tab%5C%22%3A%5C%22online_product%5C%22%2C%5C%22sort%5C%22%3A%7B%7D%2C%5C%22filter%5C%22%3A%7B%5C%22queryCategory%5C%22%3Anull%2C%5C%22lowerPrice%5C%22%3Anull%2C%5C%22upperPrice%5C%22%3Anull%2C%5C%22status%5C%22%3A%5C%220%5C%22%2C%5C%22productId%5C%22%3Anull%7D%2C%5C%22pagination%5C%22%3A%7B%5C%22pageSize%5C%22%3A10%2C%5C%22current%5C%22%3A3%7D%7D%22%2C%22from%22%3A%22SELF%22%2C%22bizParam%22%3A%22%7B%5C%22version%5C%22%3A%5C%22simple%5C%22%7D%22%7D",
|
||||||
formData: JSON.stringify({
|
|
||||||
"channelId": "701301",
|
|
||||||
"jsonBody": "{\"tab\":\"online_product\",\"sort\":{},\"filter\":{\"queryCategory\":null,\"lowerPrice\":null,\"upperPrice\":null,\"status\":\"0\",\"productId\":null},\"pagination\":{\"pageSize\":10,\"current\":2}}",
|
|
||||||
"from": "SELF",
|
|
||||||
"bizParam": "{\"version\":\"simple\"}"
|
|
||||||
})
|
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user