Ejemplo n.º 1
0
        public static UrsuserInfo GetItem(int?UrsNumber)
        {
            if (UrsNumber == null)
            {
                return(null);
            }
            if (itemCacheTimeout <= 0)
            {
                return(dal.GetItem(UrsNumber));
            }
            string key   = string.Concat("DC2016_BLL_Ursuser_", UrsNumber);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(new UrsuserInfo(value)); } catch { }
            }
            UrsuserInfo item = dal.GetItem(UrsNumber);

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Ejemplo n.º 2
0
 private static void RemoveCache(UrsuserInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("DC2016_BLL_Ursuser_", item.UrsNumber));
 }
Ejemplo n.º 3
0
 public static DC2016.DAL.Ursuser.SqlUpdateBuild UpdateDiy(UrsuserInfo item, int?UrsNumber)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(UrsNumber));
     }
     return(new DC2016.DAL.Ursuser.SqlUpdateBuild(item, UrsNumber));
 }
Ejemplo n.º 4
0
 public static int Update(UrsuserInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Ejemplo n.º 5
0
 public static UrsuserInfo Insert(UrsuserInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Ejemplo n.º 6
0
 public int Update(UrsuserInfo item)
 {
     return(new SqlUpdateBuild(null, item.UrsNumber)
            .SetUrsBirthDay(item.UrsBirthDay)
            .SetUrsIDCard(item.UrsIDCard)
            .SetUrsMobile(item.UrsMobile)
            .SetUrsQQ(item.UrsQQ)
            .SetUrsTime(item.UrsTime).ExecuteNonQuery());
 }
Ejemplo n.º 7
0
 protected static MySqlParameter[] GetParameters(UrsuserInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?UrsNumber", MySqlDbType.Int32, 11, item.UrsNumber),
         GetParameter("?UrsBirthDay", MySqlDbType.Int32, 11, item.UrsBirthDay),
         GetParameter("?UrsIDCard", MySqlDbType.VarChar, 32, item.UrsIDCard),
         GetParameter("?UrsMobile", MySqlDbType.VarChar, 32, item.UrsMobile),
         GetParameter("?UrsQQ", MySqlDbType.Int32, 11, item.UrsQQ),
         GetParameter("?UrsTime", MySqlDbType.DateTime, -1, item.UrsTime)
     });
 }
Ejemplo n.º 8
0
        public static bool CreateUser(int number, string acct, int qq, string mobile, string idcard, string extinfo)
        {
            if (number < 10000)
            {
                return(false);
            }
            bool        isexisted = Ursacct.IsExistNumber(number);
            UrsacctInfo acctInfo  = new UrsacctInfo()
            {
                AcctNumber = number,
                AcctEMail  = acct
            };

            Ursacct.Insert(acctInfo);

            if (!isexisted)
            {
                //rc &= URSUserInfo.Create(Operator, ACCT_Number, USRI_QQ, USRI_Mobile, USRI_IDCard);
                UrsuserInfo userInfo = new UrsuserInfo()
                {
                    UrsNumber   = number,
                    UrsQQ       = qq,
                    UrsMobile   = mobile,
                    UrsIDCard   = idcard,
                    UrsBirthDay = null,
                    UrsTime     = null
                };
                Ursuser.Insert(userInfo);

                //rc &= URSUserExtInfo.Create(Operator, ACCT_Number, UEXT_CHTInfo);
                UrsuserextInfo userExtInfo = new UrsuserextInfo()
                {
                    ExtNumber  = number,
                    ExtCHTInfo = extinfo
                };
                Ursuserext.Insert(userExtInfo);
            }
            return(true);
        }
Ejemplo n.º 9
0
        public IActionResult func_IsExistAcct(string account, int checkactive)
        {
            if (account.IsNullOrEmpty() || !this.IsMobile(account) && !Utilities.IsValidEmail(account))
            {
                return(this.FuncResult(new APIReturn(10000, "参数错误(account)")));
            }

            #region 2980帐号

            Hashtable htb = new Hashtable();
            if (this.IsMobile(account) || account.EndsWith("@2980.com"))
            {
                string checkType;
                string phoneUserName;
                if (this.IsMobile(account))
                {
                    checkType     = "phone";
                    phoneUserName = account;
                }
                else
                {
                    checkType     = "name";
                    phoneUserName = account.Substring(0, account.LastIndexOf('@'));
                }

                Dictionary <string, object> argus = new Dictionary <string, object>();
                argus.Add("act", "dy_gs_checknamephone");
                argus.Add("portkey", DC2Conf.Passport2980);
                argus.Add("checktype", checkType);
                argus.Add("phoneUserName", phoneUserName);
                ReturnMsg2980 ret = P2980Invoker.InvokeHttp("funswregister", argus);

                #region 返回码处理

                int    code;
                string msg;
                if (ret.Code == 250)
                {
                    code = 0;
                    msg  = "帐号不存在";
                }
                else if (ret.Code == 625)
                {
                    if (checkactive == 1)
                    {
                        htb.Add("isActive", true);
                    }
                    return(this.FuncResult(new APIReturn(10303, "帐号已存在", htb)));
                }
                else if (ret.Code == 609)
                {
                    //参数不能为空、重要参数长度不足
                    code = 10000;
                    msg  = "部分参数缺失";
                }
                else if (ret.Code == 611)
                {
                    //检测超出规定次数
                    code = 19902;
                    msg  = "操作太频繁";
                }
                else if (ret.Code == 500)
                {
                    //服务器错误
                    code = -98;
                    msg  = "未知系统错误";
                }
                else if (ret.Code == 614)
                {
                    //你不具备访问权限
                    code = -97;
                    msg  = "IP没有权限";
                }
                else if (ret.Code == 583)
                {
                    //无任何执行动作
                    code = 10000;
                    msg  = "部分参数缺失";
                }
                else
                {
                    code = 19801;
                    msg  = $"参数或其它错误({ret.Code},{ret.Message})";
                }

                #endregion

                return(this.FuncResult(new APIReturn(code, msg)));
            }

            #endregion

            bool        isActive = false;
            UrsacctInfo acctInfo = Ursacct.GetItem(account);
            if (acctInfo != null)
            {
                UrsuserInfo userInfo = Ursuser.GetItem(acctInfo.AcctNumber);
                if (userInfo.UrsTime.HasValue && userInfo.UrsTime.HasValue && userInfo.UrsTime.Value.Year > 2000 && (DateTime.Now - userInfo.UrsTime.Value).TotalDays > 3)//兼容之前没写日期的
                {
                    isActive = true;
                }
                if (checkactive == 1)
                {
                    D2unactiveInfo activeInfo = D2unactive.GetItemByNumber(acctInfo.AcctNumber.Value);
                    isActive = activeInfo != null && activeInfo.UavState == (int)EUAS.已激活2;
                    htb.Add("isActive", isActive);
                }
                return(this.FuncResult(new APIReturn(10303, "帐号已存在", htb)));
            }

            //请求DC验证
            //DCRequest dcr = new DCRequest(DCProdTypes.URS, DCMethodTypes.R);
            List <object> listobj = new List <object>();
            listobj.AddRange(new object[] { "email", account });
            //ReturnMsgDC rc = dcr.ExecRequest("acct_getinfoforupgrade.php", listobj.ToArray());
            DCResult   dcr = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "acct_getinfoforupgrade", listobj.ToArray());
            DicDCValue rc  = dcr.GetDicDCValue();
            if (rc.Code == 23)
            {
                //帐号不存在
                return(this.FuncResult(new APIReturn(0, "帐号不存在")));
            }
            else if (rc.Code == 99)
            {
                //帐号未激活
                isActive = false;
            }
            else
            {
                //帐号已存在
                isActive = true;
                int number = rc["number"].ToInt();
            }
            if (checkactive == 1)
            {
                htb.Add("isActive", isActive);
            }
            return(this.FuncResult(new APIReturn(10303, "帐号已存在", htb)));
        }
Ejemplo n.º 10
0
 public SqlUpdateBuild(UrsuserInfo item, int?UrsNumber)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`UrsNumber` = {0}", UrsNumber);
 }
Ejemplo n.º 11
0
 public UrsuserInfo Insert(UrsuserInfo item)
 {
     SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item));
     return(item);
 }