package com.yihu.platform.test; import com.coreframework.db.DB; import com.coreframework.util.AppConfig; import com.yihu.platform.api.MessageApi; import com.yihu.platform.api.UserApi; import com.yihu.platform.utils.DesUtil; import com.yihu.wsgw.api.InterfaceMessage; import net.sf.json.JSONObject; import java.io.IOException; /** * Created by Administrator on 2017/8/28. */ public class MessageApiTest { public static void main(String[] args) { try { DB.me().addDataSourceMySQL( AppConfig.getValue("DB.Alias"), AppConfig.getValue("DB.DatabaseName"), AppConfig.getValue("DB.Ip"), Integer.parseInt(AppConfig.getValue("DB.Port")), AppConfig.getValue("DB.UserName"), DesUtil.decrypt(AppConfig.getValue("DB.Password"))); } catch (NumberFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } // send(); push(); } static void send(){ MessageApi apiImpl = new MessageApi(); InterfaceMessage msg = new InterfaceMessage(); JSONObject obj = new JSONObject(); obj.put("mobile", "18060474175"); obj.put("content", "1"); obj.put("doctorUserId", "1"); msg.setParam(obj.toString()); String result = apiImpl.send(msg); System.out.println(result); } static void push(){ MessageApi apiImpl = new MessageApi(); InterfaceMessage msg = new InterfaceMessage(); JSONObject obj = new JSONObject(); obj.put("userId", "123"); obj.put("handlerId", "1"); obj.put("content", "1"); obj.put("detailUrl", "1"); obj.put("doctorUserId", "1"); msg.setParam(obj.toString()); String result = apiImpl.push(msg); System.out.println(result); } }