static int CreateFromJson(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); string arg0 = ToLua.CheckString(L, 1); weChatUserInfo o = weChatUserInfo.CreateFromJson(arg0); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_province(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); weChatUserInfo obj = (weChatUserInfo)o; string ret = obj.province; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index province on a nil value" : e.Message)); } }
static int set_privilege(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); weChatUserInfo obj = (weChatUserInfo)o; object[] arg0 = ToLua.CheckObjectArray(L, 2); obj.privilege = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index privilege on a nil value" : e.Message)); } }
static int set_sex(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); weChatUserInfo obj = (weChatUserInfo)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.sex = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index sex on a nil value" : e.Message)); } }
static int set_language(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); weChatUserInfo obj = (weChatUserInfo)o; string arg0 = ToLua.CheckString(L, 2); obj.language = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index language on a nil value" : e.Message)); } }
static int get_privilege(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); weChatUserInfo obj = (weChatUserInfo)o; object[] ret = obj.privilege; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index privilege on a nil value" : e.Message)); } }
static int get_sex(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); weChatUserInfo obj = (weChatUserInfo)o; int ret = obj.sex; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index sex on a nil value" : e.Message)); } }
public ActionResult ProductFeedBacks(string code = "", string state = "") { Core.ProductFeedbacksInfo model = new Core.ProductFeedbacksInfo(); string useragent = Request.UserAgent; if (useragent.ToLower().Contains("micromessenger")) { //1.不包含code和state的情况下,转去微信认证 if (string.IsNullOrEmpty(code) && string.IsNullOrEmpty(state)) { //转向微信认证 string url = "http://www.kingsdown.com.cn/Plugins/ProductFeedBacks"; string requestUrl = string.Format(getCodeUrl, appID, System.Web.HttpUtility.UrlEncode(url), Guid.NewGuid().ToString()); return(Redirect(requestUrl)); } //2.在有code和state的情况下,获取access_token accessTokenInfo tokenInfo = GetAccessTokenInfo(getAccessTokenUrl, appID, appsecret, code); if (tokenInfo != null) { new LogHelper().Write(tokenInfo.access_token); weChatUserInfo wechatInfo = GetWeChatUserInfo(getUserInfoUrl, tokenInfo.access_token, tokenInfo.openid); if (wechatInfo != null) { model.CustomerName = wechatInfo.nickname; model.WeChatOpenId = wechatInfo.openid; model.WeChatName = wechatInfo.nickname; model.CityName = wechatInfo.city; } } } return(View(model)); }
static int _CreateweChatUserInfo(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { weChatUserInfo obj = new weChatUserInfo(); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: weChatUserInfo.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static weChatUserInfo GetWeChatUserInfo(string getUserInfoUrl, string accessToken, string openid) { string accessurl = string.Format(getUserInfoUrl, accessToken, openid); string result = WebHelper.GetRequestData(accessurl, "get", ""); if (result.Contains("errmsg")) { return(null); } try { weChatUserInfo userInfo = JsonHelper.DeserializeJsonToObject <weChatUserInfo>(result); return(userInfo); } catch (Exception e) { return(null); } }
public object[] privilege; //用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) public static weChatUserInfo CreateFromJson(string json) { weChatUserInfo ret = JsonUtility.FromJson <weChatUserInfo>(json); return(ret); }
public ActionResult ServiceEval(string code = "", string state = "") { Core.ServiceEvalInfo model = new Core.ServiceEvalInfo() { EvalProduct = 3, EvalLogistics = 3, EvalService = 3, State = 0 }; string useragent = Request.UserAgent; if (useragent.ToLower().Contains("micromessenger")) { //1.不包含code和state的情况下,转去微信认证 if (string.IsNullOrEmpty(code) && string.IsNullOrEmpty(state)) { //转向微信认证 string url = "http://www.kingsdown.com.cn/Plugins/ServiceEval"; string requestUrl = string.Format(getCodeUrl, appID, System.Web.HttpUtility.UrlEncode(url), Guid.NewGuid().ToString()); return(Redirect(requestUrl)); } //2.在有code和state的情况下,获取access_token accessTokenInfo tokenInfo = GetAccessTokenInfo(getAccessTokenUrl, appID, appsecret, code); if (tokenInfo != null) { new LogHelper().Write(tokenInfo.access_token); weChatUserInfo wechatInfo = GetWeChatUserInfo(getUserInfoUrl, tokenInfo.access_token, tokenInfo.openid); if (wechatInfo != null) { model.Name = wechatInfo.nickname; model.WeChatOpenId = wechatInfo.openid; model.WeChatName = wechatInfo.nickname; model.Province = wechatInfo.province; model.City = wechatInfo.city; } } List <SelectListItem> selList = new List <SelectListItem>(); selList.Add(new SelectListItem() { Text = "01", Value = "01" }); selList.Add(new SelectListItem() { Text = "02", Value = "02" }); selList.Add(new SelectListItem() { Text = "03", Value = "03" }); selList.Add(new SelectListItem() { Text = "04", Value = "04" }); ViewData["selList"] = selList; } return(View(model)); }