| | |
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param ids
|
| | | * @param ids // 领取id
|
| | | * @param gids // 未领取id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "receiveGoldCoin", method = RequestMethod.POST)
|
| | | public void receiveGoldCoin(AcceptData acceptData, Long uid, String ids, PrintWriter out) {
|
| | | public void receiveGoldCoin(AcceptData acceptData, Long uid, String ids, String gids, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | |
| | | out.print(JsonUtil.loadFalseResult("领取id不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | Set<Long> gidList = gson.fromJson(gids, new TypeToken<HashSet<Long>>() {}.getType());
|
| | |
|
| | | try {
|
| | | Integer goldCoin = integralTaskRecordService.receiveGoldCoin(uid, idList);
|
| | | |
| | | List<IntegralTaskRecord> list = null;
|
| | | if (gidList != null && gidList.size() > 0) {
|
| | | list = integralTaskRecordService.listNotReceived(5 - gidList.size(), uid);
|
| | | } else {
|
| | | list = integralTaskRecordService.listNotReceived(5, uid);
|
| | | }
|
| | | |
| | | if (list == null) {
|
| | | list = new ArrayList<IntegralTaskRecord>();
|
| | | }
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson2 = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("goldCoin", goldCoin);
|
| | | data.put("list", gson2.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (IntegralTaskRecordException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | out.print(JsonUtil.loadFalseResult("用户尚未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(event)) {
|
| | | out.print(JsonUtil.loadFalseResult("事件为空"));
|
| | | return;
|
| | |
| | | || "scanTBCart".equalsIgnoreCase(event)) {
|
| | | JSONObject notify = new JSONObject();
|
| | | switch (event) {
|
| | | |
| | | case "recommendSearch":
|
| | | notify.put("name", "完成一次智能搜索");
|
| | | notify.put("score", "+20");
|
| | | notify.put("score", "+20金币");
|
| | | break;
|
| | | case "scanGoods":
|
| | | notify.put("name", "完成一次商品浏览");
|
| | | notify.put("score", "+10");
|
| | | notify.put("score", "+100金币");
|
| | | break;
|
| | | case "scanTBCart":
|
| | | notify.put("name", "完成一次购物车浏览");
|
| | | notify.put("score", "+30");
|
| | | notify.put("score", "+300金币");
|
| | | break;
|
| | | }
|
| | |
|