Ejemplo n.º 1
0
        public static CommonReturn Success(object instance)
        {
            CommonReturn model = new CommonReturn();

            model.model = instance;
            return(model);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 检测手机验证码,10分钟内有效|存数据库|可换浏览器验证|未验证成功不会取消|必须手机与验证码同时匹配
        /// </summary>
        public static CommonReturn CheckVaildCode(string mobile, string code, string source)
        {
            B_Safe_Mobile mobBll = new B_Safe_Mobile();
            M_Safe_Mobile model  = mobBll.SelLastModel(mobile);

            if (string.IsNullOrEmpty(mobile))
            {
                return(CommonReturn.Failed("手机号码不能为空"));
            }
            if (string.IsNullOrEmpty(code))
            {
                return(CommonReturn.Failed("验证码不能为空"));
            }
            if (model == null)
            {
                return(CommonReturn.Failed("验证码信息不存在"));
            }
            if (model.ZStatus != 0)
            {
                return(CommonReturn.Failed("验证码无效"));
            }
            if ((DateTime.Now - model.CDate > TimeSpan.FromMinutes(10)))
            {
                return(CommonReturn.Failed("验证码过期"));
            }
            if (!model.VCode.Equals(code))
            {
                return(CommonReturn.Failed("手机验证码不匹配"));
            }
            DBCenter.UpdateSQL(model.TbName, "ZStatus=99", "ID=" + model.ID);
            return(CommonReturn.Success());
        }
Ejemplo n.º 3
0
        public static CommonReturn Failed(string msg)
        {
            CommonReturn model = new CommonReturn();

            model.isok = false;
            model.err  = msg;
            return(model);
        }
Ejemplo n.º 4
0
 public CommonReturn IsCanPay(M_Payment payMod)
 {
     if (payMod == null)
     {
         return(CommonReturn.Failed("支付单不存在"));
     }
     else if (payMod.Status != (int)M_Payment.PayStatus.NoPay)
     {
         return(CommonReturn.Failed("0x14,支付单已付过款,不能重复支付"));
     }
     else if (payMod.MoneyReal <= 0)
     {
         return(CommonReturn.Failed("0x56,支付单金额异常"));
     }
     else
     {
         return(CommonReturn.Success());
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 制作优惠卷
 /// </summary>
 /// <param name="noType">优惠卷编码类型</param>
 /// <param name="uids">默认分配给哪些用户</param>
 public CommonReturn CreateArrive(M_Arrive avMod, int num, string noType = "1", string uids = "")
 {
     if (num < 1)
     {
         return(CommonReturn.Failed("未指定生成数量"));
     }
     if (avMod.EndTime <= DateTime.Now)
     {
         return(CommonReturn.Failed("到期时间不能早于当前时间"));
     }
     if (avMod.AgainTime >= avMod.EndTime)
     {
         return(CommonReturn.Failed("到期时间不能晚于发布时间"));
     }
     if (avMod.MaxAmount < 0 || avMod.MinAmount < 0)
     {
         return(CommonReturn.Failed("使用范围数值不正确"));
     }
     if (avMod.MaxAmount != 0 && avMod.MinAmount > avMod.MaxAmount)
     {
         return(CommonReturn.Failed("使用范围不正确,最小值不能大于最大值"));
     }
     if (avMod.Amount < 1)
     {
         return(CommonReturn.Failed("优惠金额不正确,最小值为1"));
     }
     //----------------------------------------
     if (string.IsNullOrEmpty(avMod.Flow))
     {
         avMod.Flow = Guid.NewGuid().ToString();
     }
     int[] uidArr = H_GetUserArr(uids);
     for (int i = 0; i < num; i++)
     {
         avMod.ArriveNO  = H_GetArriveNo(noType);
         avMod.ArrivePwd = "ZL" + function.GetRandomString(9);
         avMod.UserID    = uidArr.Length > i ? uidArr[i] : 0;
         GetInsert(avMod);
     }
     return(CommonReturn.Success());
 }
Ejemplo n.º 6
0
        public static CommonReturn Success()
        {
            CommonReturn model = new CommonReturn();

            return(model);
        }