From e0aaa679f4682f3bc1a4a1c0b67b4a9fa58ed9e7 Mon Sep 17 00:00:00 2001 From: zhl Date: Tue, 2 Apr 2019 17:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=BA=9B=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sites/hoh8.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/sites/hoh8.js b/src/sites/hoh8.js index 65c25c3..7b93ec1 100644 --- a/src/sites/hoh8.js +++ b/src/sites/hoh8.js @@ -4,31 +4,45 @@ import netUtil from '../utils/net.util'; let client = socketClient; +/** + * 获取电影列表 + * @param {Number} id 分页 从0开始 + * */ const getMovieList = (id) => { let msg = `{"path":"/video/searchVideoList","body":"{\\"pageNum\\":${id},\\"kw\\":null,\\"type\\":\\"所有类型\\",\\"region\\":\\"所有地区\\",\\"date\\":\\"所有年代\\"}","reqId":"movielist000${id}"}`; client.send(msg); } + +// 获取电影详情 const getMovieInfo = () => { let record = list[current]; let msg = `{"path":"/video/getVideoDtl.page","body":"{\\"id\\":\\"${record.data.id}\\"}","reqId":"movieinfo${record.id}"}`; client.send(msg); } + +/** + * 获取游戏列表 + * @param {Number} id 分页 从0开始 + * */ const getGameList = (id) => { let msg = `{"path":"/hg/getGameList","body":"{\\"pageNum\\":${id},\\"kw\\":\\"\\"}","reqId":"gamelist000${id}"}`; client.send(msg); } +// 获取游戏详情 const getGameInfo = () => { let record = list[current]; let msg = `{"path":"/hg/getGameDtl.page","body":"{\\"gameId\\":\\"${record.id}\\"}","reqId":"gameinfo${record.id}"}`; client.send(msg); } +// 获取观看广告的token, 用于更新用户余额 const getVideoToken = (id) => { let msg = `{"path":"/deal/getVideoADToken","body":"{}","reqId":"videotoken${id}"}`; client.send(msg); } +// 更新用户余额 const updateMoney = async (appId, token, appName) => { let url = 'https://game.hoh8.cn/hh/deal/getVideoADReward.anon'; let jsonData = {"appId": appId,"appName":appName,"token":token,"userId":uid}; @@ -40,6 +54,10 @@ const updateMoney = async (appId, token, appName) => { return netUtil.postForm(url, data); } +/** + * 更新现有列表的详情 + * @param {string} type 要更新的内容类型, game:游戏 movie:电影 + * */ const parseAllRecord = async (type) => { try { list = await SpiderData.find({type: type, status: 0}); @@ -116,7 +134,7 @@ export default { const result = await updateMoney(appId, videoToken, appName); console.log(result); setTimeout(function () { - if (current ++ < 10) { + if (current ++ < 20) { getVideoToken(current); } }, 15000)