private DtWechatJsapiTicket RenewJsapiTicket(string appId) { DtWechatJsapiTicket dtWechatJsapiTicket = null; var var_AccessToken = this.GetAccessToken(appId); if (var_AccessToken == null) { throw new Exception("获取AccessToken失败"); } string requstUri = string.Format(urlJsapiTicket, var_AccessToken.AccessToken); HttpClient client = new HttpClient(); JsapiTicketModel model_JsapiTicket = client.GetAsync(requstUri).Result.Content.ReadAsAsync<JsapiTicketModel>().Result; if (model_JsapiTicket != null && (model_JsapiTicket.ErrCode == null || model_JsapiTicket.ErrCode == 0)) { dtWechatJsapiTicket = new DtWechatJsapiTicket(); dtWechatJsapiTicket.JsapiTicket = model_JsapiTicket.JsapiTicket; dtWechatJsapiTicket.ExpiresIn = model_JsapiTicket.ExpiresIn; dtWechatJsapiTicket.AccessTokenId = var_AccessToken.Id; } return dtWechatJsapiTicket; }
public int UpdateJsapiTicket(DtWechatJsapiTicket dtWechatJsapiTicket) { string commandText = @"UPDATE [dbo].[WECHAT_JSAPI_TICKET] SET [SYSTEM_UPDATE_DATETIME] = GETDATE(), [JSAPI_TICKET] = @JSAPI_TICKET, [EXPIRES_IN] = @EXPIRES_IN WHERE [PK_ID] = @PK_ID"; return this.dbHelper.ExecuteNonQuery ( commandText, new { JSAPI_TICKET = dtWechatJsapiTicket.JsapiTicket, EXPIRES_IN = dtWechatJsapiTicket.ExpiresIn, PK_ID = dtWechatJsapiTicket.Id, } ); }
public int PutJsapiTicket(DtWechatJsapiTicket dtWechatJsapiTicket) { var var_Result = this.dalWechat.UpdateJsapiTicket(dtWechatJsapiTicket); return var_Result; }
public int InsertJsapiTicket(DtWechatJsapiTicket dtWechatJsapiTicket) { string commandText = @"INSERT INTO [dbo].[WECHAT_JSAPI_TICKET] ( [SYSTEM_INSERT_DATETIME], [SYSTEM_STATUS], [JSAPI_TICKET], [EXPIRES_IN], [FK_WECHAT_ACCESS_TOKEN_PK_ID] ) VALUES ( GETDATE(), 0, @JSAPI_TICKET, @EXPIRES_IN, @FK_WECHAT_ACCESS_TOKEN_PK_ID )"; return this.dbHelper.ExecuteNonQuery ( commandText, new { JSAPI_TICKET = dtWechatJsapiTicket.JsapiTicket, EXPIRES_IN = dtWechatJsapiTicket.ExpiresIn, FK_WECHAT_ACCESS_TOKEN_PK_ID = dtWechatJsapiTicket.AccessTokenId, } ); }
public int PostJsapiTicket(DtWechatJsapiTicket dtWechatJsapiTicket) { var var_Result = this.dalWechat.InsertJsapiTicket(dtWechatJsapiTicket); return var_Result; }