admin
2023-04-12 651f2856e9ae10aacbfb8327d967aacbb6d58333
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java
@@ -1,7 +1,10 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -10,14 +13,18 @@
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.SystemPIDInfo;
import com.yeshi.fanli.entity.common.Config;
import com.yeshi.fanli.exception.goods.ConvertLinkException;
import com.yeshi.fanli.service.manger.PIDManager;
import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
import com.yeshi.fanli.util.email.MailSenderUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.TimeUtil;
import org.yeshi.utils.encrypt.DESUtil;
import org.yeshi.utils.entity.FileUploadResult;
import org.yeshi.utils.tencentcloud.COSManager;
@@ -714,20 +721,30 @@
    @RequestMapping(value = "getShowAd")
    public void showAd(AcceptData acceptData, Long uid, PrintWriter out) {
        String value = configService.getValue(ConfigKeyEnum.showSplashAd.getKey(), acceptData.getSystem());
        JSONObject configData = JSONObject.fromObject(value);
        String channel = acceptData.getChannel().toLowerCase();
        if (configData.optString(channel) == null) {
            channel = "qq";
        }
        int version = configData.optInt(channel);
        JSONObject data = new JSONObject();
        boolean show;
        if (Integer.parseInt(acceptData.getVersion()) >= version) {
            show = false;
        } else {
            show = true;
        boolean show = false;
        try {
            JSONObject configData = JSONObject.fromObject(value);
            if (configData != null) {
                String channel = acceptData.getChannel().toLowerCase();
                if (configData.optString(channel) == null) {
                    channel = "qq";
                }
                int version = configData.optInt(channel);
                if (Integer.parseInt(acceptData.getVersion()) >= version) {
                    show = false;
                } else {
                    show = true;
                }
            }
        } catch (Exception e) {
        }
        JSONObject data = new JSONObject();
        if (show) {
            data.put("show", true);
            //加载广告数据
@@ -749,4 +766,54 @@
        data.put("link", configService.getValue(ConfigKeyEnum.accountLogoutProtocolLink.getKey(), acceptData.getSystem()));
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
    /**
     * @return void
     * @author hxh
     * @description 隐私投诉
     * @date 17:51 2021/10/18
     * @param: acceptData
     * @param: content
     * @param: images
     * @param: out
     **/
    @RequestMapping(value = "reportPrivacy")
    public void reportPrivacy(AcceptData acceptData, String content, MultipartFile[] images, PrintWriter out) {
        String urlList = "";
        if (images != null && images.length > 0)
            for (MultipartFile f : images) {
                try {
                    String name = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMddHHmmssSSS") + "_" + ((int) (Math.random() * 100000)) + ".jpg";
                    FileUploadResult result = COSManager.getInstance().uploadFile(f.getInputStream(), "privacy/report/" + name);
                    if (result != null)
                        urlList += result.getUrl() + " , ";
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        String title = null;
        try {
            title = "隐私投诉:" + URLDecoder.decode(content, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        StringBuffer buffer = new StringBuffer();
        buffer.append("包名:" + acceptData.getPackages());
        buffer.append("\n\r");
        buffer.append("UTDID:" + acceptData.getUtdid());
        buffer.append("\n\r");
        buffer.append("DEVICE:" + acceptData.getDevice());
        buffer.append("\n\r");
        buffer.append("投诉内容:");
        buffer.append(content);
        buffer.append("\n\r");
        buffer.append("提供的截图为:" + urlList);
        Config config = configService.getConfig(ConfigKeyEnum.extractCodeEmailFrom.getKey(), acceptData.getSystem());
        String[] sts = config.getValue().split(",");
        String account = sts[0];
        String pwd = sts[1];
        MailSenderUtil.sendEmail("help@banliapp.com", account, pwd, title, buffer.toString());
        out.print(JsonUtil.loadTrueResult(""));
    }
}