public string GetToken() { string access_token = string.Empty; if (string.IsNullOrEmpty(UserDateTicket.wx_config.access_token)) { access_token = WXApi.GetToken(UserDateTicket.wx_config.AppID, UserDateTicket.wx_config.AppSecret); } else { if (WXApi.TokenExpired(UserDateTicket.wx_config.access_token)) { access_token = WXApi.GetToken(UserDateTicket.wx_config.AppID, UserDateTicket.wx_config.AppSecret); } else { return(UserDateTicket.wx_config.access_token); } } WX_Config m = WX_ConfigService.instance().SingleByCompanyID(UserDateTicket.Company.ID); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("access_token", access_token); WX_ConfigService.instance().ModifColumn(dic, m.ID.ToString()); UserDateTicket.wx_config = WX_ConfigService.instance().SingleByCompanyID(m.CompanyID); return(access_token); }