Example #1
0
        public RESTfulModel GetAPIConfig(string authorizerAppID, string cardID)
        {
            try
            {
                AuthorizationInfoModel authorizationInfoModel = accessTokenDAL.Get(authorizerAppID);

                string apiTicket = authorizationInfoModel.APITicket;
                string timestamp = UtilsHelper.GetTimestamp();
                string nonceStr  = UtilsHelper.GetNonceStr();
                string signature = UtilsHelper.GenarateSignature(apiTicket, timestamp, cardID, nonceStr);

                string cardExt = JsonConvert.SerializeObject(new { signature = signature, timestamp = timestamp, nonce_str = nonceStr });

                return(new RESTfulModel()
                {
                    Code = (int)CodeEnum.成功, Msg = string.Format(codeMsgDAL.GetByCode((int)CodeEnum.成功), "成功"), Data = new APIConfigModel()
                    {
                        CardExt = cardExt
                    }
                });
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                return(new RESTfulModel()
                {
                    Code = (int)CodeEnum.系统异常, Msg = codeMsgDAL.GetByCode((int)CodeEnum.系统异常)
                });
            }
        }