@RequestMapping("income")
@ResponseBody
public List<Map<String, String>> Income(HttpServletResponse response,HttpServletRequest request){
List<Map<String, String>> lm = new ArrayList<Map<String,String>>();
List<XphIncome> xphIncome = walletService.getIncomeByUserID(memId);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (XphIncome xi : xphIncome) {
if (xi.getMissionType()==1) {
if (xi.getShareState()!=0) {
Map<String, String> map = new HashMap<String, String>();
map.put("way", "分享"+xi.getMissionTitle());
map.put("money", xi.getShareGetMoney().toString());
map.put("time", format.format(xi.getShareTime()));
lm.add(map);
}
}else {
if (xi.getShareState()!=0) {
Map<String, String> map = new HashMap<String, String>();
map.put("way", "分享"+xi.getMissionTitle());
map.put("money", xi.getShareGetMoney().toString());
map.put("time", format.format(xi.getShareTime()));
lm.add(map);
}
Map<String, String> map = new HashMap<String, String>();
map.put("way", xi.getMissionTitle());
map.put("money", xi.getPrice().toString());
map.put("time", format.format(xi.getGrabTime()));
lm.add(map);
}
}
return lm;
}
本文详细解析了一个用于查询用户收入的后端接口实现,通过分析HTTP请求与响应,展示了如何从数据库获取用户收入详情,并将其格式化为JSON数据返回。特别关注了收入来源的区分,如任务完成和分享奖励等。

被折叠的 条评论
为什么被折叠?



