bbf8319fb140714f19a976853df03776e4d2e0f7.svn-base 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package com.yihu.platform.api;
  2. import com.yihu.platform.utils.ApiUtil;
  3. import com.yihu.platform.utils.StringUtil;
  4. import com.yihu.wsgw.api.InterfaceMessage;
  5. import net.sf.json.JSONException;
  6. import net.sf.json.JSONObject;
  7. /**
  8. * 用户接口
  9. * @author wengsb----yihu.com
  10. * 2017年8月17日下午3:00:15
  11. */
  12. public class UserApi {
  13. /**
  14. * 通过用户id获取用户信息
  15. * @param msg
  16. * @return
  17. */
  18. public String queryUserInfoByID(InterfaceMessage msg) {
  19. try {
  20. JSONObject json = JSONObject.fromObject(msg.getParam());
  21. Integer id = StringUtil.isEmpty(json.get("id")) ? null : json.getInt("id");
  22. String param = StringUtil.isEmpty(json.get("param")) ? "" : json.getString("param");
  23. if (StringUtil.isEmpty(id)) {
  24. return ApiUtil.getRespJSON(-10000, "id不能为空").toString();
  25. }
  26. JSONObject result = new JSONObject();
  27. result.put("UserName", "");
  28. result.put("PhotoUri", "");
  29. result.put("CName", "");
  30. result.put("Sex", "");
  31. result.put("BirthDate", "");
  32. result.put("IdNumber", "");
  33. result.put("IsBear", "");
  34. result.put("IsMarried", "");
  35. result.put("MainPhone", "");
  36. result.put("Phone", "");
  37. result.put("Email", "");
  38. result.put("ProvinceID", "");
  39. result.put("ProvinceName", "");
  40. result.put("CityID", "");
  41. result.put("CityName", "");
  42. result.put("AreaID", "");
  43. result.put("AreaName", "");
  44. result.put("UserID", "");
  45. result.put("LoginType", "");
  46. result.put("RoleType", "");
  47. JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
  48. obj.put("Result", result);
  49. return obj.toString();
  50. } catch (JSONException e) {
  51. return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
  52. } catch (Exception e) {
  53. e.printStackTrace();
  54. return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
  55. }
  56. }
  57. /**
  58. * 通过用户id获取用户信息
  59. *
  60. * @param msg
  61. * @return
  62. */
  63. public String getAccLoginInfo(InterfaceMessage msg) {
  64. try {
  65. JSONObject result = new JSONObject();
  66. result.put("UserName", "");
  67. result.put("PhotoUri", "");
  68. result.put("CName", "");
  69. result.put("Sex", "");
  70. result.put("BirthDate", "");
  71. result.put("IdNumber", "");
  72. result.put("IsBear", "");
  73. result.put("IsMarried", "");
  74. result.put("MainPhone", "");
  75. result.put("Phone", "");
  76. result.put("Email", "");
  77. result.put("ProvinceID", "");
  78. result.put("ProvinceName", "");
  79. result.put("CityID", "");
  80. result.put("CityName", "");
  81. result.put("AreaID", "");
  82. result.put("AreaName", "");
  83. result.put("UserID", "");
  84. result.put("LoginType", "");
  85. result.put("RoleType", "");
  86. JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
  87. obj.put("Result", result);
  88. return obj.toString();
  89. } catch (JSONException e) {
  90. return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
  91. } catch (Exception e) {
  92. e.printStackTrace();
  93. return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
  94. }
  95. }
  96. /**
  97. * 通过用户id获取用户信息
  98. *
  99. * @param msg
  100. * @return
  101. */
  102. public String queryLoginInfoByUserID(InterfaceMessage msg) {
  103. try {
  104. JSONObject result = new JSONObject();
  105. result.put("UserName", "");
  106. result.put("PhotoUri", "");
  107. result.put("CName", "");
  108. result.put("Sex", "");
  109. result.put("BirthDate", "");
  110. result.put("IdNumber", "");
  111. result.put("IsBear", "");
  112. result.put("IsMarried", "");
  113. result.put("MainPhone", "");
  114. result.put("Phone", "");
  115. result.put("Email", "");
  116. result.put("ProvinceID", "");
  117. result.put("ProvinceName", "");
  118. result.put("CityID", "");
  119. result.put("CityName", "");
  120. result.put("AreaID", "");
  121. result.put("AreaName", "");
  122. result.put("UserID", "");
  123. result.put("LoginType", "");
  124. result.put("RoleType", "");
  125. JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
  126. obj.put("Result", result);
  127. return obj.toString();
  128. } catch (JSONException e) {
  129. return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
  130. } catch (Exception e) {
  131. e.printStackTrace();
  132. return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
  133. }
  134. }
  135. }