package com.lightinit.hsdataportal.common;

import com.lightinit.hsdataportal.entity.PublishInfoWithBLOBs;
import com.lightinit.hsdataportal.entity.ResourceApiInterfaceWithBLOBs;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class GateWayUtils {

    public static void gatewayAuthAdd(List<ResourceApiInterfaceWithBLOBs> list, String userId, String remark) throws Exception {
        if (list.size()>0){
            for (ResourceApiInterfaceWithBLOBs resourceApiInterfaceWithBLOBs : list) {
                Map<String, String> params = new HashMap<>();
                params.put("appId", resourceApiInterfaceWithBLOBs.getAppId());
                params.put("userId", userId);
                params.put("remark", remark);
                String str = HttpUtil.httpPost(SysContants.GatewayPath.GATEWAYURL_SIGINSAVE, null, params);
            }
        }
    }

    public static void gatewayChargeAdd(List<ResourceApiInterfaceWithBLOBs> list, String userId, String remark) throws Exception {
        if (list.size() > 0) {
            for (ResourceApiInterfaceWithBLOBs resourceApiInterfaceWithBLOBs : list) {
                Map<String, String> params = new HashMap<>();
                params.put("routeId", resourceApiInterfaceWithBLOBs.getRouteId());
                params.put("appId", resourceApiInterfaceWithBLOBs.getAppId());
                params.put("userId", userId);
                params.put("remark", remark);
                HttpUtil.httpPost(SysContants.GatewayPath.GATEWAYURL_AUTHSAVE, null, params);
                HttpUtil.httpPost(SysContants.GatewayPath.GATEWAYURL_CHARGESAVE, null, params);
            }
        }
    }

    public static void gatewayAuthAddMic(String appId, String username, String remark) throws Exception {
        Map<String, String> params = new HashMap<>();
        params.put("appId", appId);
        params.put("userId", username);
        params.put("remark", remark);
        HttpUtil.httpPost(SysContants.GatewayPath.GATEWAYURL_SIGINSAVE, null, params);
    }
}
