Exemplo n.º 1
0
 /// <summary>
 /// 修改最后登录时间
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool UpdateLastLoginTime(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.UpdateLastLoginTime(userId));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 编辑用户信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool EditUserInfo(UserRegisterModel model, ref ApiStatusCode apiCode)
        {
            apiCode = ApiStatusCode.OK;
            using (var dal = FactoryDispatcher.UserFactory())
            {
                if (model.UserId > 0)
                {
                    bool b = dal.UpdateUserInfo(model);
                    if (!b)
                    {
                        apiCode = ApiStatusCode.更新失败;
                    }
                    return(b);
                }
                else
                {
                    int flag = dal.AddUserInfo(model);
                    if (flag == -1)
                    {
                        apiCode = ApiStatusCode.账户已存在;
                    }
                    else if (flag == 0)
                    {
                        apiCode = ApiStatusCode.添加失败;
                    }

                    return(flag > 0);
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 冻结或解冻账户
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="active"></param>
 /// <returns></returns>
 public static bool UpdateUserActive(int userId, int active)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.UpdateUserActive(userId, active));
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the user identifier by authentication token.
 /// </summary>
 /// <param name="Token">The token.</param>
 /// <returns>System.Int32.</returns>
 public static int GetUserIdByAuthToken(string Token)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetUserIdByAuthToken(Token));
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="oldPassword">The old password.</param>
 /// <param name="password">The password.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool ChanagePassword(int userId, string oldPassword, string password)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.ChanagePassword(userId, oldPassword, password));
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 获取他的盟友列表
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static ResultPageModel GetAllyList(SearchModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetAllyList(model));
     }
 }
Exemplo n.º 7
0
 public static bool DeleteLevel(int levelId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.DeleteLevel(levelId, ConstConfig.storeId));
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 盟豆兑换
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="code">The code.</param>
        /// <returns>true if XXXX, false otherwise.</returns>
        public static bool ConvertToBean(int userId, int amount, ref ApiStatusCode code)
        {
            if (amount < 100)
            {
                code = ApiStatusCode.兑换的盟豆数量不能少于100;
                return(false);
            }

            UserModel userModel = null;

            using (var dal = FactoryDispatcher.UserFactory())
            {
                userModel = dal.GetUserModel(userId);
            }

            decimal userAmount = userModel.MengBeans - userModel.MengBeansLocked;

            if (userAmount < amount)
            {
                code = ApiStatusCode.你的盟豆不够;
                return(false);
            }

            using (var dal = FactoryDispatcher.UserFactory())
            {
                dal.addMengBeansLocked(userId, amount);
                dal.insertBeansConvert(userId, userModel.BelongOne, amount);
                code = ApiStatusCode.OK;
            }
            return(true);
        }
Exemplo n.º 9
0
 /// <summary>
 /// Gets the master convert flow.
 /// </summary>
 /// <param name="masterUserId">The master user identifier.</param>
 /// <param name="lastId">The last identifier.</param>
 /// <param name="type">The type.</param>
 /// <returns>List&lt;ConvertFlowModel&gt;.</returns>
 public static List <ConvertFlowModel> getMasterConvertFlow(int masterUserId, int lastId, int type)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(toConvertFlowModel(dal.getBeansConvertListByMasterModel(masterUserId, lastId, type)));
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 给用户加盟豆
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="money"></param>
 /// <returns></returns>
 public static int addUserMoney(int userId, decimal money)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.addUserMoney(userId, money));
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// 更新盟主等级
 /// </summary>
 /// <param name="userId"></param>
 public static void masterUpdate(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         int amount = dal.countByBelongOne(userId);
         List <MallUserLevelModel> levels = dal.GeUserLevelList(ConstConfig.storeId, 1);
         bool isFind = false;
         foreach (MallUserLevelModel level in levels)
         {
             if (amount >= level.UL_MemberNum)
             {
                 //更新用户等级
                 dal.updateUserLevel(userId, level.UL_ID);
                 isFind = true;
                 break;
             }
         }
         if (!isFind)
         {
             int leveid = dal.GetMinLevelID(ConstConfig.storeId, 1);
             //更新用户等级
             dal.updateUserLevel(userId, leveid);
         }
     }
 }
Exemplo n.º 12
0
 public static bool AllyApply(int userId, string mobile, string password
                              , string nickname, string userName
                              , int sex, ref ApiStatusCode apiCode)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         if (!RegexHelper.IsValidMobileNo(mobile))
         {
             apiCode = ApiStatusCode.无效手机号;
         }
         else if (dal.ExistApplyFriend(mobile))
         {
             apiCode = ApiStatusCode.你已申请请耐心等到审核;
         }
         else if (dal.UserExist(mobile, ConstConfig.storeId))
         {
             apiCode = ApiStatusCode.手机用户已存在;
         }
         else
         {
             dal.SaveApplyFriend(userId, mobile, EncryptHelper.MD5(password), nickname, userName, sex);
             apiCode = ApiStatusCode.OK;
         }
         return(true);
     }
 }
Exemplo n.º 13
0
 /// <summary>
 ///根据盟主,获取盟友奖励设置信息
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>RewardsSettingModel.</returns>
 public static RewardsSettingModel GetRewardModel(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetRewardModel(userId));
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// 判断用户账户和所属门店是否激活
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>true if [is user active] [the specified user identifier]; otherwise, false.</returns>
 public static bool IsUserActive(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.IsUserActive(userId));
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// 签到流水.
 /// </summary>
 /// <param name="shopId">The shop identifier.</param>
 /// <param name="userIdentity">The user identity.</param>
 /// <param name="model">The model.</param>
 /// <returns>ResultPageModel.</returns>
 public static ResultPageModel GetSignLoginList(int shopId, int userIdentity, SearchModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetSignLoginList(shopId, userIdentity, model));
     }
 }
Exemplo n.º 16
0
 public static List <ConvertFlowModel> getConvertFlow(int userId, int lastId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(toConvertFlowModel(dal.getBeansConvertListModel(userId, lastId)));
     }
 }
Exemplo n.º 17
0
 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public static UserModel GetModel(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetUserModel(userId));
     }
 }
Exemplo n.º 18
0
 /// <summary>
 /// 获取已兑换盟豆
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>System.Int32.</returns>
 public static int AlreadyConvertTotal(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetAllConvertTotal(userId));
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// 获取等级列表
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static ResultPageModel GetLevelList(int type)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetLevelList(ConstConfig.storeId, type));
     }
 }
Exemplo n.º 20
0
 /// <summary>
 /// APP端修改用户信息
 /// </summary>
 /// <param name="opt">The opt.</param>
 /// <param name="model">The model.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool UpdateUserInfo(UserPropertyOptions opt, UserModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.UpdateUserInfo(opt, model));
     }
 }
Exemplo n.º 21
0
 /// <summary>
 /// 后台登录
 /// </summary>
 /// <param name="loginName"></param>
 /// <param name="loginPassword"></param>
 /// <param name="IsShop">是否是门店登录</param>
 /// <returns></returns>
 public static AdminLoginModel Login(string loginName, string loginPassword, bool IsShop)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.Login(loginName, loginPassword, IsShop));
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// 获取兑换数量(只对盟主)
 /// </summary>
 /// <param name="userid">The userid.</param>
 /// <param name="status">状态 0,未审核 1已审核 2,拒绝</param>
 /// <returns>System.Int32.</returns>
 public static int GetConvertCount(int userid, int status)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetConvertCount(userid, status));
     }
 }
Exemplo n.º 23
0
 /// <summary>
 /// 忘记密码
 /// </summary>
 /// <param name="mobile">The mobile.</param>
 /// <param name="password">The password.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool ForgetPwd(string mobile, string password)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.ForgetPwd(mobile, password));
     }
 }
Exemplo n.º 24
0
 /// <summary>
 /// 获取盟友申请得审核的数量
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>System.Int32.</returns>
 public static int AllyApplyCount(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.AllyApplyCount(userId));
     }
 }
Exemplo n.º 25
0
 /// <summary>
 /// 获取用户列表
 /// </summary>
 /// <param name="ShopId"></param>
 /// <param name="UserIdentity"></param>
 /// <param name="model"></param>
 /// <returns></returns>
 public static ResultPageModel GetUserList(int ShopId, int UserIdentity, SearchModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetUserList(ShopId, UserIdentity, model));
     }
 }
Exemplo n.º 26
0
        /// <summary>
        /// 后台手工添加用户盟豆
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="mengBeans">调整后盟豆</param>
        /// <param name="currentMengBeans">调整前盟豆</param>
        static void AdminAddUserMengBeans(int userId, decimal mengBeans, decimal currentMengBeans)
        {
            try
            {
                //只有盟豆发生改变时
                if (currentMengBeans != mengBeans)
                {
                    //给盟友加盟豆
                    addUserMoney(userId, mengBeans);

                    using (var dal1 = FactoryDispatcher.UserFactory())
                    {
                        BeansRecordsModel model2 = new BeansRecordsModel();
                        model2.Amount     = currentMengBeans > mengBeans ? currentMengBeans - mengBeans : mengBeans - currentMengBeans;
                        model2.UserId     = userId;
                        model2.LogType    = 0;
                        model2.Income     = currentMengBeans > mengBeans ? 0 : 1;
                        model2.Remark     = "系统调整";
                        model2.OrderId    = "";
                        model2.CreateTime = DateTime.Now;
                        dal1.AddBeansRecords(model2);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Log("后台手工调整用户盟豆异常:" + ex.ToString(), LogHelperTag.ERROR);
            }
        }
Exemplo n.º 27
0
 /// <summary>
 /// 删除用户
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public static bool DeleteUser(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.DeleltUserInfo(userId));
     }
 }
Exemplo n.º 28
0
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="loginName">Name of the login.</param>
 /// <param name="password">The password.</param>
 /// <param name="apiCode">The API code.</param>
 /// <returns>UserModel.</returns>
 public UserModel Login(string loginName, string password, ref ApiStatusCode apiCode)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         UserModel model = dal.Login(loginName, password);
         if (model != null)
         {
             if (model.IsActive == 1)
             {
                 apiCode = ApiStatusCode.OK;
                 string token = EncryptHelper.MD5(StringHelper.CreateCheckCode(20));
                 if (dal.IsAuthTokenExist(model.UserId) ? dal.UpdateUserAuthToken(model.UserId, token) : dal.AddUserAuthToken(model.UserId, token))
                 {
                     model.token = token;
                 }
                 return(model);
             }
             else
             {
                 apiCode = ApiStatusCode.账户已禁用;
                 return(null);
             }
         }
         else
         {
             apiCode = ApiStatusCode.账户不存在;
             return(null);
         }
     }
 }
Exemplo n.º 29
0
 /// <summary>
 /// 添加客户
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static int InsertCustomerInfo(CustomerModel model)
 {
     using (var dal = FactoryDispatcher.CustomerFactory())
     {
         int flag = dal.InsertCustomerInfo(model);
         BeansRecordsModel model2 = null;
         if (flag > 0)
         {
             //如果相等于,表示当前是盟主添加客户信息
             if (model.BelongOne == model.BelongTwo)
             {
                 //获取积分奖励配置
                 ScoreConfigModel scoreCfg = ConfigLogic.GetScoreConfig();
                 using (var dal1 = FactoryDispatcher.UserFactory())
                 {
                     //盟友提交客户信息,盟主奖励
                     if (scoreCfg.SubmitCustomerToMainScore2 > 0 && dal1.addUserIntegral(model.BelongOne, scoreCfg.SubmitCustomerToMainScore2) > 0)
                     {
                         model2            = new BeansRecordsModel();
                         model2.Amount     = scoreCfg.SubmitCustomerToMainScore1;
                         model2.UserId     = model.BelongTwo;
                         model2.LogType    = 1;
                         model2.Income     = 1;
                         model2.Remark     = "客户信息奖励";
                         model2.OrderId    = "";
                         model2.CreateTime = DateTime.Now;
                     }
                 }
             }
         }
         return(flag);
     }
 }
Exemplo n.º 30
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static UserModel GetModel(int userId)
        {
            using (var dal = FactoryDispatcher.UserFactory())
            {
                var user = dal.GetUserModel(userId);
                if (user != null)
                {
                    if (!string.IsNullOrEmpty(user.UserHeadImg))
                    {
                        user.UserHeadImg = WebConfig.reswebsite() + user.UserHeadImg;
                    }
                    user.myqrcodeUrl      = WebConfig.articleDetailsDomain() + "/app/myqrcode.html?userid=" + user.UserId;
                    user.myShareQrcodeUrl = WebConfig.articleDetailsDomain() + string.Format("/resource/app/qrcode/{0}/index.html", user.UserId);
                    user.MengBeans        = user.MengBeans - user.MengBeansLocked;
                    user.Score            = user.Score - user.ScoreLocked;
                    if (user.IsActive == 1 && user.ShopActive == 1)
                    {
                        if (user.UserIdentity == 1)
                        {
                            masterUpdate(user.UserId);
                        }
                        else
                        {
                            userUpdate(user.UserId);
                        }

                        user.LevelName = GetUserLevelName(user.UserId);
                    }
                }
                return(user);
            }
        }