Beispiel #1
0
        private void InitializeOpen1688Service()
        {
            string   refreshToken            = null;
            DateTime?refreshTokenExpiredTime = null;
            string   filePath = this.Server.MapPath("~/token.txt");

            string[] lines = File.Exists(filePath) ? File.ReadAllLines(filePath, Encoding.UTF8) : null;
            if (lines != null)
            {
                refreshToken            = lines[0];
                refreshTokenExpiredTime = DateTime.Parse(lines[1]);
            }

            g_chinaAlibabaService = new ChinaAlibabaService(
                APP_KEY,
                APP_SECRET,
                refreshToken,
                refreshTokenExpiredTime,
                new DefaultChinaAlibabaApiFactory());
            g_chinaAlibabaService.AuthorizationChanged += (sender, args) => {
                File.WriteAllText(filePath, string.Format("{0}\r\n{1}", args.RefreshToken, args.RefreshTokenExpiredTime), Encoding.UTF8);
            };
        }
Beispiel #2
0
        protected override void Initialize(RequestContext requestContext)
        {
            base.Initialize(requestContext);

            this.m_service = MvcApplication.ChinaAlibabaService;
        }