12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package com.yihu.platform.api;
- import com.yihu.platform.utils.ApiUtil;
- import com.yihu.platform.utils.StringUtil;
- import com.yihu.wsgw.api.InterfaceMessage;
- import net.sf.json.JSONException;
- import net.sf.json.JSONObject;
- /**
- * 帐户类API
- * @author wengsb----yihu.com
- * 2017年8月17日下午3:00:15
- */
- public class AccountApi {
- /**
- * 用户登录
- * @param msg
- * @return
- */
- public String userLogin(InterfaceMessage msg) {
- try {
- JSONObject json = JSONObject.fromObject(msg.getParam());
- Integer id = StringUtil.isEmpty(json.get("id")) ? null : json.getInt("id");
- String param = StringUtil.isEmpty(json.get("param")) ? "" : json.getString("param");
- if (StringUtil.isEmpty(id)) {
- return ApiUtil.getRespJSON(-10000, "id不能为空").toString();
- }
- JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
- return obj.toString();
- } catch (JSONException e) {
- return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
- } catch (Exception e) {
- e.printStackTrace();
- return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
- }
- }
- /**
- * 通过手机号获取用户信息
- * @param msg
- * @return
- */
- public String getAccLoginInfo(InterfaceMessage msg) {
- try {
- JSONObject json = JSONObject.fromObject(msg.getParam());
- Integer id = StringUtil.isEmpty(json.get("id")) ? null : json.getInt("id");
- String param = StringUtil.isEmpty(json.get("param")) ? "" : json.getString("param");
- if (StringUtil.isEmpty(id)) {
- return ApiUtil.getRespJSON(-10000, "id不能为空").toString();
- }
- JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
- return obj.toString();
- } catch (JSONException e) {
- return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
- } catch (Exception e) {
- e.printStackTrace();
- return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
- }
- }
-
- }
|