public static BoolAny <String> SetTrail(string openid)
        {
            WeixinDBContext db = new WeixinDBContext();
            weixinAccount   wa = db.weixinAccount.FirstOrDefault(d => d.openid == openid);

            if (!wa.isTrail)
            {
                wa.trailDate = DateTime.Now;
                wa.isTrail   = false;
                db.SaveChanges();
                return(BoolAny <String> .succeed());
            }
            else
            {
                return(BoolAny <string> .fail("已经绑定过"));
            }
        }
        /// <summary>
        /// 根据不用类型的用户 更新DB weixinAccount的Session,如果存在openid但没有在数据库用则加入
        /// </summary>
        /// <param name="wai"></param>
        /// <returns></returns>
        public static AccountTypeEnum UpdateSessionAccount(string openid)
        {
            if (string.IsNullOrWhiteSpace(openid))
            {
                return(AccountTypeEnum.Null);
            }
            else
            {
                WeixinAccountIdentity wai = new WeixinAccountIdentity()
                {
                    openid = openid
                };

                WeixinDBContext db = new WeixinDBContext();

                weixinAccount wa = db.weixinAccount.Find(openid);
                if (wa == null)//如果存在openid但没有在数据库用则加入
                {
                    JULONG.CAFTS.Model.Weixin.WeixinDBHelper.AddAccount(openid);
                    wa = db.weixinAccount.Find(openid);
                }

                if (wa.isTrail) //试用
                {
                    if ((wa.trailDate.Value - DateTime.Now).TotalMinutes > WeixinConfig.TrailAccountTimeSpan)
                    {
                        SetSessionAccountType(AccountTypeEnum.ExpireTrial);
                        wai.type = AccountTypeEnum.ExpireTrial;
                    }
                    else
                    {
                        wai.type = AccountTypeEnum.Trial;
                    }
                }
                else if (wa.studentId != 0)
                { //学员
                    using (BaseContext webDB = new BaseContext())
                    {
                        Student student = webDB.Student.Find(wa.studentId);

                        double day = student.getExpireDay(webDB);

                        if (day > 0)
                        {
                            wai.type = AccountTypeEnum.Student;
                        }
                        else
                        {
                            wai.type = AccountTypeEnum.ExpireStudent;
                        }
                        wai.studentId    = student.Id;
                        wai.studentName  = student.Name;
                        wai.studentPhone = student.Phone;
                    }
                }
                else
                {//attend,
                    if (wa.attend)
                    {
                        wai.type = AccountTypeEnum.Attend;
                    }
                    else
                    {
                        wai.type = AccountTypeEnum.NoAttend;
                    }
                }

                wa.lastDate = DateTime.Now;
                db.SaveChanges();
                wai.lasVerDate = wa.lastDate;
                WeixinAccountHelper.accountIdentity = wai;
                return(wai.type);
            }
        }