package com.cnd3b.utility.qywechat.base;

import com.cnd3b.common.data.Rows;
import com.cnd3b.common.data.db.DBConnect;

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

public class Parameter {
    /**
     * 应用回调模式设置
     */
    public static String token = "";
    //jxby
    /**
     * 应用回调模式设置
     **/
    public static String EncodingAESKey = "";
    //6XXcTSX5Z1RvNT2ory3P3lAEB19Xw5D8e8tVFIyiXMS
    /**
     * 微信企业号
     **/
    public static String CorpID = "";
    //ww0f0d56b4adc76f8f
    /**
     * 权限管理
     **/
    public static String corpsecret = "";
    //SI-63SlcXiw8clLBQ3JvmdrLs1rToejdiofKULFY0A0

    public static String appid_DRP = "";
    //1000002


    public static Map<String, Long> entryDrpMap = new HashMap<String, Long>(16);

    public static void initParameter() {
        /**
         * 如果企业微信参数未设置，则从数据库中查询获取
         */
        if (Parameter.corpsecret.equals("")) {
            DBConnect dbConnect = new DBConnect();
            Rows rows = dbConnect.runSqlQuery("select fwechat_token,fwechat_encodingaeskey,fwechat_corpid,fwechat_corpsecret,fwechat_drpappid from sysvars where siteid='GEN'");
            if (!rows.isEmpty()) {
                Parameter.token = rows.get(0).getString("fwechat_token");
                Parameter.EncodingAESKey = rows.get(0).getString("fwechat_encodingaeskey");
                Parameter.CorpID = rows.get(0).getString("fwechat_corpid");
                Parameter.corpsecret = rows.get(0).getString("fwechat_corpsecret");
                Parameter.appid_DRP = rows.get(0).getString("fwechat_drpappid");
            }
        }
    }


    public static class SaveFile {
        public static String Image = "freedbconnlist:/";
        public static String Voice = "freedbconnlist:/";
        public static String video = "freedbconnlist:/";
        public static String shortvideo = "freedbconnlist:/";
    }

    public static class MediaType {
        public static String Image = "image";
        public static String Voice = "voice";
        public static String Video = "video";
        public static String File = "file";
    }

    /**
     * 消息类型
     *
     * @author Administrator
     */
    public static class MsgType {
        public static String text = "text";
        public static String event = "event";
        public static String image = "image";
        public static String voice = "voice";
        public static String video = "video";
        public static String shortvideo = "shortvideo";
        public static String location = "location";
    }

    public static class EventType {
        public static String subscribe = "subscribe";// 成员关注/取消关注
        public static String LOCATION = "LOCATION";// 上报地理位置事件
        public static String CLICK = "click";// 点击菜单拉取消息的事件推送
        public static String VIEW = "VIEW";// 点击菜单跳转链接的事件推送
        public static String scancode_push = "scancode_push";// 扫码推事件的事件推送
        public static String scancode_waitmsg = "scancode_waitmsg";// 扫码推事件且弹出“消息接收中”提示框的事件推送
        public static String pic_sysphoto = "pic_sysphoto";// 弹出系统拍照发图的事件推送
        public static String pic_photo_or_album = "pic_photo_or_album";// 弹出拍照或者相册发图的事件推送
        public static String pic_weixin = "pic_weixin";// 弹出微信相册发图器的事件推送
        public static String location_select = "location_select";// 弹出地理位置选择器的事件推送
        public static String enter_agent = "enter_agent";// 成员进入应用的事件推送
        public static String batch_job_result = "batch_job_result";// 异步任务完成事件推送

    }

}
