admin
2019-08-27 f2843ee069def999b1837282f5393bf013fa1c33
金币获取修改
1个文件已修改
67 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -36,10 +36,10 @@
import com.yeshi.fanli.entity.integral.CodePublishRecord;
import com.yeshi.fanli.entity.integral.IntegralExchange;
import com.yeshi.fanli.entity.integral.IntegralTask;
import com.yeshi.fanli.entity.integral.IntegralTask.TaskUniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
import com.yeshi.fanli.exception.integral.IntegralExchangeException;
import com.yeshi.fanli.exception.integral.IntegralGetException;
import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
@@ -535,7 +535,7 @@
     * @param out
     */
    @RequestMapping(value = "pushEvent", method = RequestMethod.POST)
    public void pushEvent(AcceptData acceptData, String event, Long uid, PrintWriter out) {
    public void pushEvent(AcceptData acceptData, String event, Long uid, String data, PrintWriter out) {
        if (uid == null || uid == 0) {
            out.print(JsonUtil.loadFalseResult("用户尚未登录"));
            return;
@@ -546,34 +546,49 @@
            return;
        }
        IntegralTaskRecord record = null;
        try {
            record = integralGetService.addEventStatistic(uid, event);
        } catch (IntegralGetException e) {
        }
        if (record == null) {
            out.print(JsonUtil.loadFalseResult("添加失败"));
            return;
        if (TaskUniqueKeyEnum.recommendSearch.name().equalsIgnoreCase(event)) {
            record = integralGetService.addRecommendSearch(uid);
        } else if (TaskUniqueKeyEnum.shareInvite.name().equalsIgnoreCase(event)) {
            record = integralGetService.addShareInvite(uid);
        } else if (TaskUniqueKeyEnum.inShop.name().equalsIgnoreCase(event)) {
            JSONObject json = JSONObject.fromObject(data);
            record = integralGetService.addIntoShop(uid, StringUtil.Md5(json.optString("url")));
        } else if (TaskUniqueKeyEnum.scanPush.name().equalsIgnoreCase(event)) {
            record = integralGetService.addScanPushHistory(uid);
        } else if (TaskUniqueKeyEnum.scanGoods.name().equalsIgnoreCase(event)) {
            JSONObject json = JSONObject.fromObject(data);
            record = integralGetService.addScanGoodsDetail(uid, json.optInt("goodsType"), json.optLong("goodsId"));
        } else if (TaskUniqueKeyEnum.scanHomeBanner.name().equalsIgnoreCase(event)) {
            JSONObject json = JSONObject.fromObject(data);
            record = integralGetService.addScanRecommendBanner(uid, json.optString("id"));
        } else if (TaskUniqueKeyEnum.scanSpecial.name().equalsIgnoreCase(event)) {
            JSONObject json = JSONObject.fromObject(data);
            record = integralGetService.addScanRecommendSpecial(uid, json.optString("id"));
        } else if (TaskUniqueKeyEnum.scanTBCart.name().equalsIgnoreCase(event)) {
            record = integralGetService.addScanTaoBaoCart(uid);
        }
        JSONObject data = new JSONObject();
        if ("recommendSearch".equalsIgnoreCase(event) || "scanGoods".equalsIgnoreCase(event)
                || "scanTBCart".equalsIgnoreCase(event)) {
            JSONObject notify = new JSONObject();
            switch (event) {
            case "recommendSearch":
                notify.put("name", "完成一次智能搜索");
                break;
            case "scanGoods":
                notify.put("name", "完成一次商品浏览");
                break;
            case "scanTBCart":
                notify.put("name", "完成一次购物车浏览");
                break;
        if (record != null) {
            JSONObject notifyData = new JSONObject();
            if (TaskUniqueKeyEnum.recommendSearch.name().equalsIgnoreCase(event)
                    || TaskUniqueKeyEnum.scanGoods.name().equalsIgnoreCase(event)
                    || TaskUniqueKeyEnum.scanTBCart.name().equalsIgnoreCase(event)) {
                JSONObject notify = new JSONObject();
                if (TaskUniqueKeyEnum.recommendSearch.name().equalsIgnoreCase(event))
                    notify.put("name", "完成一次智能搜索");
                else if (TaskUniqueKeyEnum.scanGoods.name().equalsIgnoreCase(event))
                    notify.put("name", "完成一次商品浏览");
                else if (TaskUniqueKeyEnum.scanTBCart.name().equalsIgnoreCase(event))
                    notify.put("name", "完成一次购物车浏览");
                notify.put("score", String.format("+%s金币", record.getGoldCoin()));
                notifyData.put("notify", notify);
            }
            notify.put("score", String.format("+%s金币", record.getGoldCoin()));
            data.put("notify", notify);
            out.print(JsonUtil.loadTrueResult(notifyData));
        } else {
            out.print(JsonUtil.loadFalseResult(""));
        }
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**