31654525aac7daba5beb80bfa7d7d4c5ff497df8.svn-base 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. * 帐户类API
  9. *
  10. * @author wengsb----yihu.com 2017年8月17日下午3:00:15
  11. */
  12. public class AccountApi {
  13. /**
  14. * 用户登录
  15. *
  16. * @param msg
  17. * @return
  18. */
  19. public String userLogin(InterfaceMessage msg) {
  20. try {
  21. JSONObject json = JSONObject.fromObject(msg.getParam());
  22. String loginID = StringUtil.isEmpty(json.get("loginID")) ? "" : json.getString("loginID");
  23. String loginPwd = StringUtil.isEmpty(json.get("loginPwd")) ? "" : json.getString("loginPwd");
  24. if (StringUtil.isEmpty(loginID) || StringUtil.isEmpty(loginPwd)) {
  25. return ApiUtil.getRespJSON(-10000, "id不能为空").toString();
  26. }
  27. JSONObject result = new JSONObject();
  28. result.put("UserName", "");
  29. result.put("PhotoUri", "");
  30. result.put("CName", "");
  31. result.put("Sex", "");
  32. result.put("BirthDate", "");
  33. result.put("IdNumber", "");
  34. result.put("IsBear", "");
  35. result.put("IsMarried", "");
  36. result.put("MainPhone", "");
  37. result.put("Phone", "");
  38. result.put("Email", "");
  39. result.put("ProvinceID", "");
  40. result.put("ProvinceName", "");
  41. result.put("CityID", "");
  42. result.put("CityName", "");
  43. result.put("AreaID", "");
  44. result.put("AreaName", "");
  45. result.put("UserID", "");
  46. result.put("LoginType", "");
  47. result.put("RoleType", "");
  48. JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
  49. obj.put("Result", result);
  50. return obj.toString();
  51. } catch (JSONException e) {
  52. return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
  53. } catch (Exception e) {
  54. e.printStackTrace();
  55. return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
  56. }
  57. }
  58. /**
  59. * 通过手机号获取用户信息
  60. *
  61. * @param msg
  62. * @return
  63. */
  64. public String getAccLoginInfo(InterfaceMessage msg) {
  65. try {
  66. JSONObject json = JSONObject.fromObject(msg.getParam());
  67. Integer id = StringUtil.isEmpty(json.get("id")) ? null : json.getInt("id");
  68. String param = StringUtil.isEmpty(json.get("param")) ? "" : json.getString("param");
  69. if (StringUtil.isEmpty(id)) {
  70. return ApiUtil.getRespJSON(-10000, "id不能为空").toString();
  71. }
  72. JSONObject result = new JSONObject();
  73. result.put("UserName", "");
  74. result.put("PhotoUri", "");
  75. result.put("CName", "");
  76. result.put("Sex", "");
  77. result.put("BirthDate", "");
  78. result.put("IdNumber", "");
  79. result.put("IsBear", "");
  80. result.put("IsMarried", "");
  81. result.put("MainPhone", "");
  82. result.put("Phone", "");
  83. result.put("Email", "");
  84. result.put("ProvinceID", "");
  85. result.put("ProvinceName", "");
  86. result.put("CityID", "");
  87. result.put("CityName", "");
  88. result.put("AreaID", "");
  89. result.put("AreaName", "");
  90. result.put("UserID", "");
  91. result.put("LoginType", "");
  92. result.put("RoleType", "");
  93. JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
  94. obj.put("Result", result);
  95. return obj.toString();
  96. } catch (JSONException e) {
  97. return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
  98. } catch (Exception e) {
  99. e.printStackTrace();
  100. return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
  101. }
  102. }
  103. }