jsonhelper java_JsonSendMeizuHelper.java

package com.unique.flyme.match.netServiceTools.meizuApi;

import android.content.Context;

import android.util.Log;

import com.android.volley.Request;

import com.android.volley.Response;

import com.android.volley.VolleyError;

import com.android.volley.toolbox.JsonObjectRequest;

import org.json.JSONObject;

/**

* Description:

* User: Dream_Coder(chenchen_839@126.com)

* Date: 2015-10-25

* Time: 00:58

*/

public class JsonSendMeizuHelper extends BaseMeizuSendHelper {

public JsonSendMeizuHelper(Context context) {

super(context);

}

public void getPostJsonObjectResponse(String url, JSONObject jsonObject, final ApiUtils.OnSuccessLoginListener success,final ApiUtils.OnFailedLoginListener fail) {

getJsonObjectResponse(Request.Method.POST, url, jsonObject, success, fail);

}

public void getGetJsonObjectResponse(String url, JSONObject jsonObject, final ApiUtils.OnSuccessLoginListener success,final ApiUtils.OnFailedLoginListener fail) {

getJsonObjectResponse(Request.Method.GET, url, jsonObject, success, fail);

}

private void getJsonObjectResponse(int method, String url, JSONObject jsonObject, final ApiUtils.OnSuccessLoginListener success,final ApiUtils.OnFailedLoginListener fail) {

JsonObjectRequest request = new JsonObjectRequest(method, url, jsonObject, new Response.Listener() {

@Override

public void onResponse(JSONObject response) {

success.onSuccessHandler(response);

}

}, new Response.ErrorListener() {

@Override

public void onErrorResponse(VolleyError volleyError) {

Log.i("ApiUtils",volleyError.getMessage());

fail.onFailedHandler(volleyError.getMessage());

}

});

getRequestQueue().add(request);

}

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

解释一下这行代码 async Task<LoginResultModel> PasswordSignInAsync(IAuthenticationManager authenticationManager, LoginViewModel model) { var obj = new { l = model.Account, p = Security.Encrypt(model.Password) }; LogHelper.Debug(JsonHelper.SerializeObject(obj)); var content = SSOHelper.GetLoginInfo(model.Account, model.Password); var content1 = SSOHelper.GetLoginInfo1(model.Account, model.Password); LogHelper.Debug(content); LoginResultModel result = JsonHelper.DeserializeObject<LoginResultModel>(content); LoginResultModel result1 = JsonHelper.DeserializeObject<LoginResultModel>(content1); ExceptionHelper.TrueThrow(result == null, "登录结果为空,请联系管理员!"); ExceptionHelper.TrueThrow(result.code == 500, result.message); string username = result.result.user_info.user_name; string usercode = model.Account; string dutyname = result.result.user_info.duty_name; string groupname = result.result.user_info.group_name; string usernametest = result.result.user_info.user_name; var Information = result.result.user_info; string password = result1.result.access_token; OnlineHistory aa = new OnlineHistory() { GWMCode = usercode, GWMName = username, GWMDuty = dutyname, GWMGroupName = groupname, OnlineTime = DateTime.Now, }; int useInsertOnlineHistory = OnlineHistoryDAL.Instance.InsertOnlineHistory(aa); ClaimsIdentity _identity = new ClaimsIdentity(DefaultAuthenticationTypes.ApplicationCookie); _identity.AddClaim(new Claim(ClaimTypes.Name, username)); _identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, usercode)); _identity.AddClaim(new Claim(ClaimTypes.Role, dutyname)); _identity.AddClaim(new Claim(ClaimTypes.GroupSid, usercode)); _identity.AddClaim(new Claim(ClaimTypes.Actor, usernametest)); _identity.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "ASP.NET Identity")); _identity.AddClaim(new Claim("DepartmentName", groupname)); _identity.AddClaim(new Claim("DutyName", dutyname)); _identity.AddClaim(new Claim("Password", password)); var Staffpermission = PermissionManageDAL.Instance.GetUersPermissionList(usercode.ToUpper()); var UseStaffpermission = Staffpermission.Select(m => new StaffPermissionItem { PermissionCode = m.PermissionCode }).ToList(); _identity.AddClaim(new Claim("Permissions", JsonHelper.SerializeObject(UseStaffpermission)));//用户的权限列表 authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = model.RememberMe }, _identity); return await Task.FromResult(result); }
最新发布
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值