private static WeChatManager CreateInstance() { if (WeChatManager.mInstance == null) { WeChatManager.mInstanceGameObject = new GameObject(typeof(WeChatManager).Name); WeChatManager.mInstance = WeChatManager.mInstanceGameObject.AddComponent <WeChatManager>(); } return(WeChatManager.mInstance); }
public AttachmentInfo DownloadTempMediaFile(HttpContext context) { YZRequest request = new YZRequest(context); string cropId = request.GetString("cropId"); string appSecret = request.GetString("appSecret"); string mediaId = request.GetString("mediaId"); string accessToken = WeChatManager.Instance.GetAccessToken(cropId, appSecret); return(WeChatManager.DownloadTempMediaFile(accessToken, mediaId)); }
private void Awake() { if (WeChatManager.mInstance != null) { UnityEngine.Object.Destroy(base.gameObject); return; } UnityEngine.Object.DontDestroyOnLoad(this); WeChatManager.mInstance = this; RegisterWeChat(); }
public static void Register() { IWeChatAppService appService = AutofacManager.Resolve <IWeChatAppService>(); IApplicationConfigService configService = AutofacManager.Resolve <IApplicationConfigService>(); var config = configService.ListApplicationConfig() .FirstOrDefault(m => m.ConfigType.ToLower() == Constants.WECHAT.ToLower() && m.ConfigKey.ToLower() == Constants.CORP_ID.ToLower()); LocalCacheManager.Add(Constants.CORP_ID, config.ConfigValue); List <WeChatAppConfig> apps = appService.ListApps(); apps.ForEach(app => { WeChatManager.RegisterWorkApp(config.ConfigValue, app.SecretValue, app.AppName); }); }