Exemple #1
0
 public async Task <ApiResult> GetWebApiClientAsync(
     [FromServices] IWeChatApi weChatApi,
     [FromServices] IConfiguration configuration, string code)
 {
     return(new ApiResult(await weChatApi.GetOpenIdAsync(
                              configuration["MiniProgram:Appid"],
                              configuration["MiniProgram:Secret"],
                              code)));
 }
Exemple #2
0
        public MerchantService(
            IOrchardServices os,
            IEnjoyAuthService auth,
            IWeChatApi wechat) :
            base(os)
        {
            this.Auth = auth;

            this.WeChat = wechat;
        }
Exemple #3
0
 public UserGetCardWeChatMsgBehavior(
     IOrchardServices os,
     IWxUserService userService,
     IWeChatApi weChat,
     ICardCouponService ccService)
     : base(os)
 {
     this.WxUserService = userService;
     this.WeChat        = weChat;
     this.CardCoupon    = ccService;
     Logger             = NullLogger.Instance;
 }
Exemple #4
0
 // GET: Default
 public MerchantController(
     IWeChatApi api,
     IOrchardServices os,
     IEnjoyAuthService auth,
     IShopService shop,
     IMerchantService merchant)
 {
     this.WeChat   = api;
     this.OS       = os;
     this.Auth     = auth;
     this.Merchant = merchant;
     this.Shop     = shop;
 }
Exemple #5
0
        public CardsController(
            IOrchardServices os,
            ICardCouponService cardcoupn,
            IMerchantService merchant,
            IEnjoyAuthService auth,

            IWeChatApi wechat)
        {
            this.OS         = os;
            this.WeChat     = wechat;
            this.CardCoupon = cardcoupn;
            this.Merchant   = merchant;
            this.Auth       = auth;
        }
Exemple #6
0
        public override void Init()
        {
            base.Init();
            var os = _container.Resolve <IOrchardServices>();

            _merchantService     = _container.Resolve <IMerchantService>();
            _verifyCodeGenerator = _container.Resolve <IVerifyCodeGenerator>();
            long.TryParse(_verifyCodeGenerator.GenerateNewVerifyCode(), out _merchantid);
            _enjoyAuthService  = _container.Resolve <IEnjoyAuthService>();
            _weChatMsgHandler  = _container.Resolve <IWeChatMsgHandler>();
            _cardCouponService = _container.Resolve <ICardCouponService>();
            _weChatApi         = _container.Resolve <IWeChatApi>();
            CreatingEnjoyUserAndMerchant();
            //CreatingCardCoupon();
        }
Exemple #7
0
        public async Task <ApiResult> Login(
            [FromServices] IWeChatApi weChatApi,
            [FromServices] IUserInfoServer userInfoServer,
            LoginInput loginInput)
        {
            ValidationResult results = new LoginInputValidator().Validate(loginInput);

            if (results.IsValid)
            {
                return(new ApiResult(await userInfoServer.Login(loginInput)));
            }
            else
            {
                return(new ApiResult(results.Errors));
            }
        }
Exemple #8
0
 public EnjoyController(
     IOrchardServices os,
     IEnjoyAuthService auth,
     IWeChatApi wechat,
     IMerchantService merchant,
     IWxUserService wxUserService,
     IShopService shop,
     ICardCouponService cardCoupon,
     IWeChatMsgHandler handler)
 {
     this._authService       = auth;
     this._os                = os;
     this._merchantService   = merchant;
     this._weChat            = wechat;
     this.Logger             = NullLogger.Instance;
     this._handler           = handler;
     this._wxUserService     = wxUserService;
     this._shopservice       = shop;
     this._cardCouponService = cardCoupon;
 }
Exemple #9
0
        public ApiResult GetToken(
            [FromServices] IWeChatApi weChatApi,
            [FromServices] IConfiguration configuration)
        {
            JwtSetting jwtSetting = configuration.GetSection("JwtSetting").Get <JwtSetting>();
            DateTime   expiresAt  = DateTime.Now.AddDays(jwtSetting.ExpireDays)
                                    .AddHours(jwtSetting.ExpireHours)
                                    .AddMinutes(jwtSetting.ExpireMinutes)
                                    .AddSeconds(jwtSetting.ExpireSeconds);

            var claims = new List <Claim>
            {
                new Claim(ClaimTypes.Name, "1"),
                new Claim(JwtRegisteredClaimNames.Sid, "2"),
                new Claim(ClaimTypes.Expiration, expiresAt.ToString()),
                new Claim(ClaimTypes.Role, "Client"),
                new Claim("AvatarUrl", "3")
            };
            var token = JwtToken.BuildJwtToken(claims.ToArray(), jwtSetting);

            return(new ApiResult(token));
        }
Exemple #10
0
 public ModelClient(
     IWeChatApi api,
     IWeChatUserService wxUserService,
     IRandomGenerator generator,
     IWeChatPayService payService,
     IMCardService mCardService,
     ISharingHostService hostService,
     IWeChatMsgHandler weChatMsgHandler,
     TencentCMQClientFactory factory,
     IDatabaseFactory databaseFactory,
     IConfiguration configuration)
 {
     this.wxapi = api;
     this.sharingHostService = hostService;
     this.wxUserService      = wxUserService;
     this.generator          = generator;
     this.weChatPayService   = payService;
     this.mCardService       = mCardService;
     this.handler            = weChatMsgHandler;
     this.cmqclient          = factory.Create <OnlineOrder>("lemon");
     this.databaseFactory    = databaseFactory;
     this.configuration      = configuration;
 }
Exemple #11
0
 public CardCouponService(IOrchardServices os, IWeChatApi wechat)
     : base(os)
 {
     this.WeChat = wechat;
 }
Exemple #12
0
 public MCardService(IWeChatApi api, IDatabaseFactory databaseFactory)
 {
     this.api             = api;
     this.databaseFactory = databaseFactory;
 }
 public RewardMoneyGrantService(RewardMoneyGrantSetting settings)
 {
     this.Settings  = settings;
     this.api       = AppHost.Host.Services.GetService(typeof(IWeChatApi)) as IWeChatApi;
     this.generator = AppHost.Host.Services.GetService(typeof(IRandomGenerator)) as IRandomGenerator;
 }
Exemple #14
0
 public WAPController(IWeChatApi weChatApi, IOrchardServices os)
 {
     this._weChatApi = weChatApi;
     this._os        = os;
     Logger          = NullLogger.Instance;
 }