public Task Get(string msg_signature, string timestamp, string nonce, string echostr)
        {
            _log.LogInformation("开始执行");
            WeChatAuthInfo weChatAuthInfo = WeChatOperation.GetWeChatAuthInfo(EnumWeChatAppType.Food);
            WXBizMsgCrypt  wxcpt          = new WXBizMsgCrypt(weChatAuthInfo.Token, weChatAuthInfo.EncodingAESKey, weChatAuthInfo.CorpId);
            string         sVerifyMsgSig  = HttpUtility.UrlDecode(msg_signature);
            //string sVerifyMsgSig = "5c45ff5e21c57e6ad56bac8758b79b1d9ac89fd3";
            string sVerifyTimeStamp = HttpUtility.UrlDecode(timestamp);
            // string sVerifyTimeStamp = "1409659589";
            string sVerifyNonce = HttpUtility.UrlDecode(nonce);
            //string sVerifyNonce = "263014780";
            string sVerifyEchoStr = HttpUtility.UrlDecode(echostr);
            //string sVerifyEchoStr = "P9nAzCzyDtyTWESHep1vC5X9xho/qYX3Zpb4yKa9SKld1DsH3Iyt3tP3zNdtp+4RPcs8TgAE7OaBO+FZXvnaqQ==";
            int    ret      = 0;
            string sEchoStr = "";

            ret = wxcpt.VerifyURL(sVerifyMsgSig, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr, ref sEchoStr);
            if (ret != 0)
            {
                _log.LogInformation(ret.ToString());
                return(Task.CompletedTask);
            }
            _log.LogInformation(sEchoStr);
            Response.WriteAsync(sEchoStr);
            return(Task.CompletedTask);
        }
Beispiel #2
0
 static int CreateFromJson(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         string         arg0 = ToLua.CheckString(L, 1);
         WeChatAuthInfo o    = WeChatAuthInfo.CreateFromJson(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #3
0
    static int get_openID(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            WeChatAuthInfo obj = (WeChatAuthInfo)o;
            string         ret = obj.openID;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index openID on a nil value" : e.Message));
        }
    }
Beispiel #4
0
    static int set_userIcon(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            WeChatAuthInfo obj  = (WeChatAuthInfo)o;
            string         arg0 = ToLua.CheckString(L, 2);
            obj.userIcon = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index userIcon on a nil value" : e.Message));
        }
    }
Beispiel #5
0
    static int set_expiresIn(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            WeChatAuthInfo obj  = (WeChatAuthInfo)o;
            int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.expiresIn = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index expiresIn on a nil value" : e.Message));
        }
    }
Beispiel #6
0
    static int get_expiresIn(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            WeChatAuthInfo obj = (WeChatAuthInfo)o;
            int            ret = obj.expiresIn;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index expiresIn on a nil value" : e.Message));
        }
    }
Beispiel #7
0
    static int _CreateWeChatAuthInfo(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                WeChatAuthInfo obj = new WeChatAuthInfo();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: WeChatAuthInfo.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #8
0
    public string userIcon;      //用户头像

    public static WeChatAuthInfo CreateFromJson(string json)
    {
        WeChatAuthInfo ret = JsonUtility.FromJson <WeChatAuthInfo>(json);

        return(ret);
    }