package cn.ksource.web.controller.wechat.util;
|
|
import java.net.URLEncoder;
|
|
import com.sun.org.apache.xml.internal.serialize.BaseMarkupSerializer;
|
|
import cn.ksource.config.SysConfigConstants;
|
|
|
/**
|
* 微信常亮类
|
* @author Administrator
|
*
|
*/
|
public class WechatConstants {
|
|
//正式appId appsecret
|
public final static String appID = SysConfigConstants.WEBCHAT_APPID;
|
public final static String appsecret = SysConfigConstants.WEBCHAT_SECRET;
|
//获取token地址
|
public final static String GET_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+ WechatConstants.appID +"&secret="+ WechatConstants.appsecret +"";
|
//获取jsApiTicket地址
|
public final static String GET_JSAPITICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=";
|
|
//发送模板消息接口
|
public final static String SEND_TEMPLATE_MSG = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
|
//获取用户基本信息接口
|
public final static String GET_USER_BASE_MSG = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
|
|
//工程师工单到达提醒模板id
|
public static final String NEW_ORDER_TEMP_ID = SysConfigConstants.TEMPLATE_ORDER;
|
|
//催办事项模板id
|
public static final String REMINDER_TEMP_ID = SysConfigConstants.TEMPLATE_REMIND;
|
|
//绑定成功提醒模板id
|
public static final String BIND_SUCCESS_TEMP_ID = SysConfigConstants.TEMPLATE_BIND;
|
|
//解除绑定提醒模板id
|
public static final String UNBIND_SUCCESS_TEMP_ID = SysConfigConstants.TEMPLATE_RELIEVE;
|
|
//微信服务器域名域名
|
public static final String BASE_ADDRESS = SysConfigConstants.WEBCHAT_ADDRESS;
|
|
//public static final String BASE_ADDRESS = "http://service.larks.com.cn";
|
//工程师绑定地址
|
public static final String ENGINEER_BIND_ADDRESS = BASE_ADDRESS + "/wechat/engineerBind.html";
|
//工程师解除绑定链接
|
public static final String ENGINEER_UNBIND_ADDRESS = BASE_ADDRESS + "/wechat/engineerUnbind.html";
|
|
|
//用户绑定地址
|
public static final String CUSTOMER_BIND_ADDRESS = BASE_ADDRESS + "/wechat/customerBind.html";
|
|
|
//用户解除绑定地址
|
public static final String CUSTOMER_UNBIND_ADDRESS = BASE_ADDRESS + "/wechat/customerUnbind.html";
|
|
|
//工单响应链接地址
|
public static final String ORDER_INCIDENT_DETAIL_ADDRESS = BASE_ADDRESS + "/ewyw/eworder/ewOrderResp.html";
|
|
|
//微信事件工单详情
|
public static final String ORDER_EW_INCIDENT_DETAIL_ADDRESS = BASE_ADDRESS + "/ewyw/ewIncident/ewIncidentInfo.html";
|
|
|
//用户报修响应链接地址
|
public static final String USER_REPAIR_RESPONSE_ADDRESS = BASE_ADDRESS+"/ewyw/ewRepairSimple/ewRepairSimpleResp.html";
|
|
|
|
//用户绑定地址
|
public static final String USER_BIND_ADDRESS = BASE_ADDRESS + "/wechat/userBind.html";
|
|
//知识工单详细链接地址
|
public static final String ORDER_KNOWLEDGE_DETAIL_ADDRESS = BASE_ADDRESS + "/wechat/questionOrder.html?orderId=";
|
|
|
//网页授权回调域名
|
//public static final String SQ_BACK_URL = BASE_ADDRESS+"/wechat/customerBind.html";
|
public static final String SQ_BACK_URL = BASE_ADDRESS+"/wechat/wywType.html";
|
public static final String SQ_BACK_TEMP_URL = BASE_ADDRESS+"/wechat/clientTemp.html";
|
public final static String SQ_REBACK = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+WechatConstants.appID+"&redirect_uri="+encodeUrl()+"&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
|
public static String encodeUrl(){
|
try {
|
return URLEncoder.encode(SQ_BACK_URL,"UTF-8");
|
} catch (Exception e) {
|
// TODO: handle exception
|
}
|
return "";
|
}
|
|
|
|
//通过code换取网页授权access_token
|
public static String CODE_GET_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token?appid="+WechatConstants.appID+"&secret="+WechatConstants.appsecret+"&code=CODE&grant_type=authorization_code";
|
|
public static void main(String[] args) {
|
System.out.println(SQ_REBACK);
|
}
|
|
|
//====================================微信关键字===========================
|
//工程师绑定
|
public static final String GGSBD = "工程师绑定";
|
//用户
|
public static final String USER = "用户";
|
|
//一键报修
|
public static final String BX = "BX";
|
//标明查询知识库关键字
|
public static final String ZSK = "Z@";
|
|
//联系我们
|
public static final String LINK_US = "LINK_US";
|
//====================================微信关键字===========================
|
}
|