1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using cuidian.Common;
- using cuidian.OpenApi.Exceptions;
- using cuidian.OpenApi.Http;
- using cuidian.OpenApi.Utils;
- using Logs;
- namespace cuidian.OpenApi.Api
- {
- public class UserApi: BasicApi
- {
- public const string RESOURCE_ID = "user";
- public UserApi()
- : base(RESOURCE_ID) { }
- public BusinessObject Login()
- {
- string userId = AppSeting.Instance.GetValue("user");
- string passWord = AppSeting.Instance.GetValue("password");
- return Login(userId,passWord);
- }
- public BusinessObject Login(string userId, string password)
- {
- try
- {
- string data = String.Format("{{\"user\":{{\"user_id\":\"{0}\",\"password\":\"{1}\"}}}}"
- , userId
- , password);
- this.Method = "login";
- BusinessObject bo = BusinessObject.Do(this.Method, this.ResourceId, new Response(Client.Post(this.Url, this.GetSystemParameters(), data)));
- return bo;
- }
- catch (Exception e)
- {
- LogHelper.Error(e.Message);
- throw new ApiException(ERR_MSG_SDK_RUNTIME_ERROR, e);
- }
- }
- }
- }
|