Files
learning-system-mobile/api/phase2/stat.js
2022-11-02 12:38:14 +08:00

179 lines
4.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**文章模块的相关处理*/
// import ajax from '@/utils/xajax.js'
import config from '@/config/index.js'
import ajax from '../ajax';
const baseURL = config.statApiBaseUrl;
/**
* 发送事件,具体事件参考后台管理的事件查看
*参数如下:
{
"key": "ReadCase",//后台的事件key
"title": "浏览案例【案例名称】",//事件的标题
"parameters":"",//用户自定义参数 name:value,name:value
"content": "案例名称",//事件的内容
"source":"页面事件",
"objId": "案例id",//关联的id
"objType": "3",//关联的类型
"objInfo": "记录一般折内容部分",
"aid": "用户的id", //当前登录人的id
"aname": "用户的名称,用于显示",//当前人的姓名
"status": 1 //状态直接写1
}
*
*/
const sendEvent = function(data) {
return ajax.postJson(baseURL,'/xboe/m/stat/event/send',data);
}
/**
* 用户的统计信息
* @param {Object} aid 主页人的id
* @param {Object} data 参数 []数组10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数空数组 返回用户的全部类型统计。
*/
const userTotal = function(aid,data) {
return ajax.postJson(baseURL,'/xboe/m/stat/user/total/'+aid,data);
}
/**
* 用户动态,分页查询
*
* @param {
pageIndex,
pageSize,
contentType:'',内容类型
aid:'', //指定用户的动态,
hidden:true/false,//是否隐藏,不指定,查询全部
} data
*/
const userDynamicList = function(data) {
return ajax.post(baseURL,'/xboe/m/stat/userdynamic/list',data);
}
/**
* 用户动态,分页查询
*
* @param {
pageIndex,
pageSize,
contentType:'',内容类型
aid 数组
} data
*/
const userDynamicfollows = function(data) {
return ajax.postJson(baseURL,'/xboe/m/stat/userdynamic/follow',data);
}
/**
* 获取用户全部勋章
* @param {String} aid 用户的id
*
*/
const userMedal = function(aid) {
return ajax.get(baseURL,'/xboe/m/stat/medal/user-medal?aid='+aid);
}
/**
* 勋章信息
* 页面上不能修改,删除
*/
// const userMedalConfig = function() {
// return ajax.get(baseURL,'/xboe/m/stat/medalinfo/config');
// }
// get 获取勋章配置,返回的是列表
const userMedalConfig = function() {
return ajax.get(baseURL,'/xboe/m/stat/medal/config');
}
/**
* 查询勋章下等级所对应的用户数量
* @author wn
* @param {String} medalId 勋章id必填
*/
const userMedalLevelInfo = function(medalId) {
return ajax.get(baseURL,'/xboe/m/stat/medal/getUserMedalLevelInfo?medalId='+medalId);
}
/**
* 隐藏动态
* @author wn
* @param {String} id 动态id必填
*/
const dynamicHide = function(id) {
return ajax.post(baseURL,'/xboe/m/stat/userdynamic/hide?id='+id);
}
/**
* 导出用户近7天的U币记录
* @author wn
* @param {String} aid 用户aid
*/
const exportUserCoinRecord = function(aid) {
return ajax.get(baseURL,'/xboe/m/stat/usercoinrecord/export?aid='+aid);
}
/**
* 获取用户最近 x 天的U币记录
* @param {String} aid 用户的id
* @param {Integer} days x天的记录默认为7天
*/
const userCoinList = function(aid,days) {
return ajax.get(baseURL,'/xboe/m/stat/usercoinrecord/list?aid='+aid+'&days='+days);
}
/**
* 查询排名数据
* @author wn
* @params {
"aid":"952948626497724414", #用户id
"statType":20, #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数
"field":"total", #统计周期 todays-当天,weeks-周,months-月,years-年 total-总计
"num":8 #显示的条数
}
*/
const getRanking = function(queryData) {
return ajax.postJson(baseURL,'/xboe/m/stat/user/ranking',queryData);
}
/**
* 查询统计用户经验值等级、累计学习时长、累计U币数量、累计经验值
* @author wn
* @param {String} aid 用户的id
*/
const getUserStatTotalInfo = function(aid) {
return ajax.get(baseURL,'/xboe/m/stat/user/statinfo?aid='+aid);
}
/**
* 用户的登录勋章新版上线15天内登录过一次
* @author wn
*/
const getUserLoginMedal = function() {
return ajax.get(baseURL,'/xboe/m/stat/medal/login-medal');
}
/**
* 提取需要提示的勋章
*/
const getUserMedalTips = function() {
return ajax.get(baseURL,'/xboe/m/stat/medal/tips');
}
export default {
sendEvent,
userTotal,
userDynamicList,
userCoinList,
userMedal,
userMedalConfig,
userMedalLevelInfo,
dynamicHide,
exportUserCoinRecord,
getRanking,
getUserStatTotalInfo,
userDynamicfollows,
getUserLoginMedal,
getUserMedalTips
}