增加一些方法的注释

This commit is contained in:
zhl 2019-04-02 17:17:41 +08:00
parent 19468a8ad4
commit e0aaa679f4

View File

@ -4,31 +4,45 @@ import netUtil from '../utils/net.util';
let client = socketClient; let client = socketClient;
/**
* 获取电影列表
* @param {Number} id 分页 从0开始
* */
const getMovieList = (id) => { const getMovieList = (id) => {
let msg = `{"path":"/video/searchVideoList","body":"{\\"pageNum\\":${id},\\"kw\\":null,\\"type\\":\\"所有类型\\",\\"region\\":\\"所有地区\\",\\"date\\":\\"所有年代\\"}","reqId":"movielist000${id}"}`; let msg = `{"path":"/video/searchVideoList","body":"{\\"pageNum\\":${id},\\"kw\\":null,\\"type\\":\\"所有类型\\",\\"region\\":\\"所有地区\\",\\"date\\":\\"所有年代\\"}","reqId":"movielist000${id}"}`;
client.send(msg); client.send(msg);
} }
// 获取电影详情
const getMovieInfo = () => { const getMovieInfo = () => {
let record = list[current]; let record = list[current];
let msg = `{"path":"/video/getVideoDtl.page","body":"{\\"id\\":\\"${record.data.id}\\"}","reqId":"movieinfo${record.id}"}`; let msg = `{"path":"/video/getVideoDtl.page","body":"{\\"id\\":\\"${record.data.id}\\"}","reqId":"movieinfo${record.id}"}`;
client.send(msg); client.send(msg);
} }
/**
* 获取游戏列表
* @param {Number} id 分页 从0开始
* */
const getGameList = (id) => { const getGameList = (id) => {
let msg = `{"path":"/hg/getGameList","body":"{\\"pageNum\\":${id},\\"kw\\":\\"\\"}","reqId":"gamelist000${id}"}`; let msg = `{"path":"/hg/getGameList","body":"{\\"pageNum\\":${id},\\"kw\\":\\"\\"}","reqId":"gamelist000${id}"}`;
client.send(msg); client.send(msg);
} }
// 获取游戏详情
const getGameInfo = () => { const getGameInfo = () => {
let record = list[current]; let record = list[current];
let msg = `{"path":"/hg/getGameDtl.page","body":"{\\"gameId\\":\\"${record.id}\\"}","reqId":"gameinfo${record.id}"}`; let msg = `{"path":"/hg/getGameDtl.page","body":"{\\"gameId\\":\\"${record.id}\\"}","reqId":"gameinfo${record.id}"}`;
client.send(msg); client.send(msg);
} }
// 获取观看广告的token 用于更新用户余额
const getVideoToken = (id) => { const getVideoToken = (id) => {
let msg = `{"path":"/deal/getVideoADToken","body":"{}","reqId":"videotoken${id}"}`; let msg = `{"path":"/deal/getVideoADToken","body":"{}","reqId":"videotoken${id}"}`;
client.send(msg); client.send(msg);
} }
// 更新用户余额
const updateMoney = async (appId, token, appName) => { const updateMoney = async (appId, token, appName) => {
let url = 'https://game.hoh8.cn/hh/deal/getVideoADReward.anon'; let url = 'https://game.hoh8.cn/hh/deal/getVideoADReward.anon';
let jsonData = {"appId": appId,"appName":appName,"token":token,"userId":uid}; 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); return netUtil.postForm(url, data);
} }
/**
* 更新现有列表的详情
* @param {string} type 要更新的内容类型 game游戏 movie电影
* */
const parseAllRecord = async (type) => { const parseAllRecord = async (type) => {
try { try {
list = await SpiderData.find({type: type, status: 0}); list = await SpiderData.find({type: type, status: 0});
@ -116,7 +134,7 @@ export default {
const result = await updateMoney(appId, videoToken, appName); const result = await updateMoney(appId, videoToken, appName);
console.log(result); console.log(result);
setTimeout(function () { setTimeout(function () {
if (current ++ < 10) { if (current ++ < 20) {
getVideoToken(current); getVideoToken(current);
} }
}, 15000) }, 15000)