Ejemplo n.º 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);

            JULONG.TRAIN.WEB.Models.DBfun.DBInit();
            JULONG.TRAIN.WEB.Models.DBfun.WxDBInit();
            ASConsoLe.Init(Config.AS_Url, Config.AS_AppId, Config.AS_SecretKey);



            /*同步wx关注用户*/
            return;

            string accessToken = AccessTokenContainer.TryGetAccessToken(Config.AS_AppId, Config.AS_SecretKey);

            wx.OpenIdResultJson openIds;
            int count = 0;

            using (BaseDBContext db = new BaseDBContext())
            {
                string nextOpenId = "";
                do
                {
                    openIds = UserApi.Get(accessToken, nextOpenId);
                    if (openIds.count != 0)
                    {
                        foreach (var x in openIds.data.openid)
                        {
                            var o = db.WxAccount.FirstOrDefault(d => d.openid == x);
                            if (o == null)
                            {
                                db.WxAccount.Add(new WxAccount()
                                {
                                    lastDate = DateTime.Now, regDate = DateTime.Now, openid = x, subscribe = true
                                });

                                count++;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    nextOpenId = openIds.next_openid;
                } while (openIds.count != 0);
                if (count > 0)
                {
                    db.SaveChanges();
                }
            }
        }
        public static BoolAny <string> verOrigWorkerAccount(string workerID, string password)
        {
            string postString = "workid=" + workerID + "&password="******"/worker/verifiy", postString);
                return(BoolAny <string> .succeed(myjson));
            }
            catch (Exception e)
            {
                return(BoolAny <string> .fail(e.Message));
            }
        }
        /// <summary>
        /// 获取员工账号信息
        /// </summary>
        /// <param nickname="workerID"></param>
        /// <returns></returns>
        public static String getOrigWorkerAccount(string workerID)
        {
            string postString = "workid=" + workerID;

            try
            {
                string myjson = ASConsoLe.RequestProxy(Config.AS_Url + "/get", postString);
                return(BoolAny <string> .succeed(myjson));
            }
            catch (Exception e)
            {
                return(BoolAny <string> .fail(e.Message));
            }
        }