Beispiel #1
0
 public HomeController(ILogger <HomeController> logger, IConfiguration configuration, IWeatherService weatherService, IWeiXinService weiXinService)
 {
     _logger         = logger;
     weiXinConfig    = configuration.GetSection(nameof(WeiXinConfig))?.Get <WeiXinConfig>();
     _weatherService = weatherService;
     _weiXinService  = weiXinService;
 }
Beispiel #2
0
 /// <summary>
 /// 注册微信服务
 /// </summary>
 /// <param name="service">服务接口</param>
 /// <param name="appId">appid</param>
 /// <param name="appSecret">appsecret</param>
 public static void Register(IWeiXinService service)
 {
     if (service == null)
     {
         throw new WeiXinServiceException("参数不能为空或 null。");
     }
     _Service = service;
 }
Beispiel #3
0
        static WeiXin()
        {
            _Service = new ProcessMessage();
            // 步骤2
            WeiXinService.Register(_Service);

            Log.Logger = new Logger();
            // 设置日记级别
            Log.Level = LogLevel.Debug;
        }
Beispiel #4
0
        static WeiXin()
        {
            _Service = new ProcessMessage();
            // 步骤2
            WeiXinService.Register(_Service);

            Log.Logger = new Logger();
            // 设置日记级别
            Log.Level = LogLevel.Debug;
        }
Beispiel #5
0
        /// <summary>
        /// 获取关注信息。
        /// </summary>
        /// <param name="weiXinService">微信服务。</param>
        /// <param name="date">日期。</param>
        /// <returns>关注信息数组。</returns>
        public static AttentionInfo GetAttentions(this IWeiXinService weiXinService, DateTime date)
        {
            if (weiXinService == null)
            {
                throw new ArgumentNullException("weiXinService");
            }

            var list = weiXinService.GetAttentions(date.Subtract(TimeSpan.FromDays(1)), date);

            return(list == null ? null : list.FirstOrDefault());
        }
Beispiel #6
0
 public WeiXinController(IWeiXinService _weixinService, IMemberService _memberService)
 {
     weixinService = _weixinService;
     memberService = _memberService;
 }
Beispiel #7
0
 public MemberController(IWeiXinService weiXinService)
 {
     _weiXinService = weiXinService;
 }
Beispiel #8
0
 /// <summary>
 /// 注册微信服务
 /// </summary>
 /// <param name="service">服务接口</param>
 /// <param name="appId">appid</param>
 /// <param name="appSecret">appsecret</param>
 public static void Register(IWeiXinService service)
 {
     if (service == null)
     {
         throw new WeiXinServiceException("参数不能为空或 null。");
     }
     _Service = service;
 }