style: 简化createOption

This commit is contained in:
MoeFurina
2026-07-15 21:06:50 +08:00
parent f527c1ef73
commit 321c25bd7d
4 changed files with 19 additions and 15 deletions
+2 -8
View File
@@ -1,11 +1,5 @@
// 获取广告
// 基于逆向网易云音乐 v9.5.45 RN Hermes 源码:
// - adService.getAd() → Network.nativeRequest → /api/ad/get
// - 需要 X-antiCheatToken 易盾反作弊头
// - 使用 xeapi 加密
//
// 返回 extra.reqId 可用于 ad_listening_rights_gain 的 reqUid
//
const createOption = require('../util/option.js')
module.exports = async (query, request) => {
@@ -19,7 +13,7 @@ module.exports = async (query, request) => {
const res = await request(`/api/ad/get`, data, option)
const raw = res.body
// 提取广告中的 req_id (用于领取权益)
// 提取广告中的 req_id
let reqId = ''
try {
if (raw?.ads) {
+5 -5
View File
@@ -72,11 +72,11 @@ module.exports = async (query, request) => {
reqParam: JSON.stringify(rightsParam),
}
const option = createOption(query, 'xeapi')
// 关键: 开启 X-antiCheatToken 头
option.checkToken = true
const res = await request(`/api/ad/listening/rights/gain`, data, option)
const res = await request(
`/api/ad/listening/rights/gain`,
data,
createOption(query, 'xeapi', true),
)
return {
status: 200,