a83348897da1f220ed4a336258254bca671d990b.svn-base 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.yihu.platform.test;
  2. import com.coreframework.db.DB;
  3. import com.coreframework.util.AppConfig;
  4. import com.yihu.platform.api.MessageApi;
  5. import com.yihu.platform.api.UserApi;
  6. import com.yihu.platform.utils.DesUtil;
  7. import com.yihu.wsgw.api.InterfaceMessage;
  8. import net.sf.json.JSONObject;
  9. import java.io.IOException;
  10. /**
  11. * Created by Administrator on 2017/8/28.
  12. */
  13. public class MessageApiTest {
  14. public static void main(String[] args) {
  15. try {
  16. DB.me().addDataSourceMySQL(
  17. AppConfig.getValue("DB.Alias"),
  18. AppConfig.getValue("DB.DatabaseName"),
  19. AppConfig.getValue("DB.Ip"),
  20. Integer.parseInt(AppConfig.getValue("DB.Port")),
  21. AppConfig.getValue("DB.UserName"),
  22. DesUtil.decrypt(AppConfig.getValue("DB.Password")));
  23. } catch (NumberFormatException e) {
  24. e.printStackTrace();
  25. } catch (IOException e) {
  26. e.printStackTrace();
  27. } catch (Exception e) {
  28. e.printStackTrace();
  29. }
  30. // send();
  31. push();
  32. }
  33. static void send(){
  34. MessageApi apiImpl = new MessageApi();
  35. InterfaceMessage msg = new InterfaceMessage();
  36. JSONObject obj = new JSONObject();
  37. obj.put("mobile", "18060474175");
  38. obj.put("content", "1");
  39. obj.put("doctorUserId", "1");
  40. msg.setParam(obj.toString());
  41. String result = apiImpl.send(msg);
  42. System.out.println(result);
  43. }
  44. static void push(){
  45. MessageApi apiImpl = new MessageApi();
  46. InterfaceMessage msg = new InterfaceMessage();
  47. JSONObject obj = new JSONObject();
  48. obj.put("userId", "123");
  49. obj.put("handlerId", "1");
  50. obj.put("content", "1");
  51. obj.put("detailUrl", "1");
  52. obj.put("doctorUserId", "1");
  53. msg.setParam(obj.toString());
  54. String result = apiImpl.push(msg);
  55. System.out.println(result);
  56. }
  57. }