public static dm_userEntity ReadUserInfoByToken(string token)
        {
            string        cacheKey      = SingleLogin + token;
            dm_userEntity dm_UserEntity = redisCache.Read <dm_userEntity>(cacheKey, 8);

            return(dm_UserEntity);
        }
Exemple #2
0
        public ActionResult GetMyCircle(int PageNo = 1, int PageSize = 20)
        {
            try
            {
                dm_userEntity dm_UserEntity = CacheHelper.ReadUserInfo(base.Request.Headers);
                Pagination    pagination    = new Pagination
                {
                    page = PageNo,
                    rows = PageSize,
                    sidx = "createtime",
                    sord = "desc"
                };
                string cacheKey = Md5Helper.Hash("GetMyCircle" + pagination.ToJson() + dm_UserEntity.id);
                List <FriendCircleEntity> friendCircleEntities = redisCache.Read <List <FriendCircleEntity> >(cacheKey, 7);
                if (friendCircleEntities == null)
                {
                    IEnumerable <dm_friend_circleEntity> dm_Friend_CircleEntities = dm_Friend_CircleIBLL.GetMyCircle(pagination, dm_UserEntity.id.ToString());
                    friendCircleEntities = GeneralPraise(dm_Friend_CircleEntities, cacheKey);
                    if (friendCircleEntities.Count > 0)
                    {
                        redisCache.Write <List <FriendCircleEntity> >(cacheKey, friendCircleEntities, DateTime.Now.AddMinutes(2), 7);

                        ManageRedisCache(cacheKey);
                    }
                }

                return(SuccessList("获取成功!", friendCircleEntities));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #3
0
        /// <summary>
        /// 获取拼多多商品列表
        /// </summary>
        /// <param name="keyWord">关键词</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页显示数量</param>
        /// <param name="sort">排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序,28-描述评分击败同类店铺百分比降序,29-物流评分击败同类店铺百分比升序,30-物流评分击败同类店铺百分比降序,31-服务评分击败同类店铺百分比升序,32-服务评分击败同类店铺百分比降序</param>
        /// <returns></returns>
        public ActionResult Get_PDD_GoodList(int user_id, string keyWord = "女装", int pageIndex = 1, int pageSize = 20, int sort = 0, bool with_coupon = false)
        {
            try
            {
                string               appid                = CheckAPPID();
                string               cacheKey             = Md5Helper.Hash("PDDGoodList" + keyWord + pageIndex + pageSize + sort + with_coupon);
                List <GoodItem>      goodItems            = redisCache.Read <List <GoodItem> >(cacheKey, 7L);
                dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid);
                if (goodItems == null)
                {
                    PDDApi pDDApi = new PDDApi(dm_BasesettingEntity.pdd_clientid, dm_BasesettingEntity.pdd_clientsecret, "");
                    goodItems = pDDApi.SearchGood(keyWord, pageIndex, pageSize, sort, with_coupon);

                    if (goodItems.Count > 0)
                    {
                        redisCache.Write(cacheKey, goodItems, DateTime.Now.AddHours(2.0), 7L);
                    }
                    else
                    {
                        return(Fail("没有更多数据了"));
                    }
                }
                dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);

                return(SuccessList("获取成功!", goodItems.Select(t => { t.LevelCommission = GetPDDCommissionRate(t.min_group_price - t.coupon_discount, t.promotion_rate, dm_UserEntity.userlevel, dm_BasesettingEntity); t.SuperCommission = GetPDDCommissionRate(t.min_group_price - t.coupon_discount, t.promotion_rate, 2, dm_BasesettingEntity); return t; })));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #4
0
        public ActionResult ConvertLinkByPDD(int user_id, string skuid)
        {
            try
            {
                string               appid                = CheckAPPID();
                string               cacheKey             = Md5Helper.Hash(user_id.ToString() + skuid + "3");
                GeneralUrl           pDDLinkInfo          = redisCache.Read <GeneralUrl>(cacheKey, 7L);
                dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid);
                if (pDDLinkInfo == null)
                {
                    PDDApi        pDDApi        = new PDDApi(dm_BasesettingEntity.pdd_clientid, dm_BasesettingEntity.pdd_clientsecret, "");
                    dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);

                    if (dm_UserEntity.pdd_pid.IsEmpty())
                    {
                        #region 自动分配拼多多pid
                        dm_UserEntity = dM_PidIBLL.AutoAssignPDDPID(dm_UserEntity);
                        #endregion
                    }

                    pDDLinkInfo = pDDApi.GeneralUrl(skuid, dm_UserEntity.pdd_pid);

                    if (pDDLinkInfo != null)
                    {
                        redisCache.Write(cacheKey, pDDLinkInfo, DateTime.Now.AddHours(2.0), 7L);
                    }
                }

                return(Success("转链成功!", pDDLinkInfo));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #5
0
        /// <summary>
        /// 获取京东商品列表
        /// </summary>
        /// <param name="user_id">用户id</param>
        /// <param name="eliteId">频道id:1-好券商品,2-超级大卖场,10-9.9专区,22-热销爆品,23-为你推荐,24-数码家电,25-超市,26-母婴玩具,27-家具日用,28-美妆穿搭,29-医药保健,30-图书文具,31-今日必推,32-品牌好货,33-秒杀商品,34-拼购商品,109-新品首发,110-自营,125-首购商品</param>
        /// <param name="pageIndex">页码,默认1</param>
        /// <param name="pageSize">每页数量,默认20,上限50</param>
        /// <param name="sortname">排序字段(price:单价, commissionShare:佣金比例, commission:佣金, inOrderCount30DaysSku:sku维度30天引单量,comments:评论数,goodComments:好评数)</param>
        /// <param name="sort">asc,desc升降序,默认降序</param>
        /// <returns></returns>
        public ActionResult Get_JD_GoodList(int user_id, int eliteId, int pageIndex = 1, int pageSize = 20, string sortname = "price", string sort = "desc")
        {
            try
            {
                string appid    = CheckAPPID();
                string cacheKey = Md5Helper.Hash("JDGoodList" + eliteId + pageIndex + pageSize + sortname + sort);
                List <JFGoodsRespRow> jFGoodsRespRows      = redisCache.Read <List <JFGoodsRespRow> >(cacheKey, 7L);
                dm_basesettingEntity  dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid);
                if (jFGoodsRespRows == null)
                {
                    JDApi jDApi = new JDApi(dm_BasesettingEntity.jd_appkey, dm_BasesettingEntity.jd_appsecret, dm_BasesettingEntity.jd_sessionkey);
                    jFGoodsRespRows = jDApi.GetGoodList(eliteId, pageIndex, pageSize, sortname, sort);

                    if (jFGoodsRespRows.Count > 0)
                    {
                        redisCache.Write(cacheKey, jFGoodsRespRows, DateTime.Now.AddHours(2.0), 7L);
                    }
                    else
                    {
                        return(Fail("没有更多数据了"));
                    }
                }
                dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);

                return(SuccessList("获取成功!", jFGoodsRespRows.Select(t => { t.LevelCommission = GetJDCommissionRate(t.couponCommission, dm_UserEntity.userlevel, dm_BasesettingEntity); t.SuperCommission = GetJDCommissionRate(t.couponCommission, 2, dm_BasesettingEntity); return t; })));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #6
0
 public ActionResult DM_Login(dm_userEntity dm_UserEntity)
 {
     try
     {
         if (dm_UserEntity.phone.IsEmpty() || dm_UserEntity.phone.Length != 11)
         {
             return(Fail("手机号不能为空或格式错误!"));
         }
         if (dm_UserEntity.pwd.IsEmpty())
         {
             return(Fail("密码不能为空!"));
         }
         string        appid     = dm_UserEntity.appid = CheckAPPID();
         dm_userEntity loginInfo = dm_userIBLL.Login(dm_UserEntity);
         if (loginInfo == null)
         {
             return(Fail("用户名或密码错误!"));
         }
         return(Success("登录成功", loginInfo));
     }
     catch (Exception ex)
     {
         return(FailException(ex));
     }
 }
Exemple #7
0
        public ActionResult UploadHeadPic(int user_id, dm_userEntity dm_UserEntity)
        {
            try
            {
                #region 头像上传
                HttpPostedFile headpic_file = System.Web.HttpContext.Current.Request.Files["headpic"];
                if (headpic_file.ContentLength == 0 || string.IsNullOrEmpty(headpic_file.FileName))
                {
                    return(HttpNotFound());
                }
                #endregion

                string FileEextension = Path.GetExtension(headpic_file.FileName);
                string virtualPath    = $"/Resource/HeadPic/{Guid.NewGuid().ToString()}{FileEextension}";
                string fullFileName   = base.Server.MapPath("~" + virtualPath);
                string path           = Path.GetDirectoryName(fullFileName);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                headpic_file.SaveAs(fullFileName);
                dm_UserEntity.headpic = virtualPath;

                dm_userIBLL.SaveEntity(user_id, dm_UserEntity);
                return(Success("修改成功"));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #8
0
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="Phone">手机号</param>
        /// <param name="Pwd">密码</param>
        /// <param name="VerifiCode">验证码</param>
        /// <returns></returns>

        public ActionResult ResetPwd(string Phone, string Pwd, string VerifiCode)
        {
            try
            {
                if (Phone.IsEmpty() || Phone.Length != 11)
                {
                    return(Fail("手机号不能为空或格式错误!"));
                }
                if (Pwd.IsEmpty())
                {
                    return(Fail("密码不能为空!"));
                }
                if (VerifiCode.IsEmpty())
                {
                    return(Fail("验证码不能为空!"));
                }
                string        appid         = CheckAPPID();
                dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByPhone(Phone, appid);

                if (dm_UserEntity == null)
                {
                    return(Fail("该手机号未注册!"));
                }
                dm_UserEntity.pwd = Md5Helper.Encrypt(Pwd, 16);
                dm_userIBLL.SaveEntity(dm_UserEntity.id.ToInt(), dm_UserEntity);
                return(Success("密码修改成功,请重新登录!"));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #9
0
        public ActionResult GetTopicGoodList(int user_id, int topicId, string pageId = "1", int pageSize = 20)
        {
            try
            {
                string appid    = CheckAPPID();
                string cacheKey = Md5Helper.Hash("TopicGoodList" + topicId + pageId + pageSize);
                List <TopicGoodItem> topicGoodItems       = redisCache.Read <List <TopicGoodItem> >(cacheKey, 7L);
                dm_basesettingEntity dm_BasesettingEntity = dM_BaseSettingIBLL.GetEntityByCache(appid);

                if (topicGoodItems == null)
                {
                    DTK_ApiManage             dTK_ApiManage             = new DTK_ApiManage(dm_BasesettingEntity.dtk_appkey, dm_BasesettingEntity.dtk_appsecret);
                    DTK_Topic_GoodListRequest dTK_Topic_GoodListRequest = new DTK_Topic_GoodListRequest();
                    dTK_Topic_GoodListRequest.version  = "v1.2.0";
                    dTK_Topic_GoodListRequest.pageId   = pageId;
                    dTK_Topic_GoodListRequest.pageSize = pageSize;
                    dTK_Topic_GoodListRequest.topicId  = topicId;
                    DTK_Topic_GoodListResponse dTK_Topic_GoodListResponse = dTK_ApiManage.GetTopicGoodList(dTK_Topic_GoodListRequest);
                    if (dTK_Topic_GoodListResponse.code != 0)
                    {
                        return(Fail(dTK_Topic_GoodListResponse.msg));
                    }
                    topicGoodItems = dTK_Topic_GoodListResponse.data.list;
                    redisCache.Write(cacheKey, topicGoodItems, DateTime.Now.AddHours(2.0), 7L);
                }

                dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);

                return(SuccessList("获取成功!", topicGoodItems.Select(t => { t.LevelCommission = GetCommissionRate(t.actualPrice, t.commissionRate, dm_UserEntity.userlevel, dm_BasesettingEntity); t.SuperCommission = GetCommissionRate(t.actualPrice, t.commissionRate, 2, dm_BasesettingEntity); return t; })));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #10
0
        public ActionResult AuthorCallBackBaiChuan(string code, string state)
        {
            try
            {
                int           user_id       = int.Parse(state);
                dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);

                dm_basesettingEntity dm_BasesettingEntity = dm_BaseSettingIBLL.GetEntityByCache(dm_UserEntity.appid);

                WebUtils webUtils = new WebUtils();
                IDictionary <string, string> pout = new Dictionary <string, string>();
                pout.Add("grant_type", "authorization_code");
                pout.Add("client_id", "29236073");
                pout.Add("client_secret", "29de7a8560d773736ef5bf568a7961bd");
                pout.Add("code", code);
                pout.Add("redirect_uri", HttpUtility.UrlEncode(CommonConfig.tb_auth_address));
                string output = webUtils.DoPost("http://oauth.taobao.com/token", pout);

                #region 获取出来用户信息
                Learun.Loger.Log log = LogFactory.GetLogger("workflowapi");
                log.Error(output);
                #endregion

                return(Success("授权成功", output));
            }
            catch (Exception ex)
            {
                return(Fail(ex.Message));
            }
        }
Exemple #11
0
 public ActionResult DM_Register(dm_userEntity dm_UserEntity, string ParentInviteCode, string VerifiCode)
 {
     try
     {
         string appid = CheckAPPID();
         if (dm_UserEntity.nickname.IsEmpty())
         {
             return(Fail("用户名不能为空!"));
         }
         if (dm_UserEntity.phone.IsEmpty() || dm_UserEntity.phone.Length != 11)
         {
             return(Fail("手机号不能为空或格式错误!"));
         }
         if (ParentInviteCode.IsEmpty())
         {
             return(Fail("邀请码不能为空!"));
         }
         if (dm_UserEntity.pwd.IsEmpty())
         {
             return(Fail("密码不能为空!"));
         }
         if (VerifiCode.IsEmpty())
         {
             return(Fail("验证码不能为空!"));
         }
         dm_UserEntity.appid = appid;
         return(Success("注册成功!", dm_userIBLL.Register(dm_UserEntity, ParentInviteCode, appid)));
     }
     catch (Exception ex)
     {
         return(FailException(ex));
     }
 }
Exemple #12
0
        /// <summary>
        /// 绑定支付宝
        /// </summary>
        /// <param name="user_id"></param>
        /// <param name="dm_UserEntity"></param>
        /// <returns></returns>
        public ActionResult UpdateZFBInfo(int User_ID, dm_userEntity dm_UserEntity)
        {
            try
            {
                if (User_ID <= 0)
                {
                    return(FailNoLogin());
                }

                if (dm_UserEntity.zfb.IsEmpty())
                {
                    return(Fail("支付宝账号不能为空!"));
                }
                if (dm_UserEntity.realname.IsEmpty())
                {
                    return(Fail("真实姓名不能为空!"));
                }

                dm_userIBLL.SaveEntity(User_ID, dm_UserEntity);

                return(Success("修改成功!"));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #13
0
 public ActionResult GetSonChildDetail(int user_id, int PageNo = 1, int PageSize = 20)
 {
     try
     {
         dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByCache(user_id);
         if (dm_UserEntity.IsEmpty())
         {
             return(Fail("用户信息异常!"));
         }
         else
         {
             string    cacheKey  = Md5Helper.Hash("SonChildDetail" + user_id + PageNo + PageSize);
             DataTable dataTable = redisCache.Read(cacheKey, 7);
             if (dataTable == null)
             {
                 dataTable = dm_UserRelationIBLL.GetMySonChildDetail(user_id, PageNo, PageSize);
                 if (dataTable.Rows.Count >= PageSize)
                 {
                     redisCache.Write(cacheKey, dataTable, DateTime.Now.AddHours(3), 7);
                 }
                 else
                 {
                     redisCache.Write(cacheKey, dataTable, DateTime.Now.AddMinutes(5), 7);
                 }
             }
             return(SuccessList("获取成功!", dataTable));
         }
     }
     catch (Exception ex)
     {
         return(FailException(ex));
     }
 }
Exemple #14
0
        public ActionResult UpdateAddress(int user_id, dm_userEntity dm_UserEntity)
        {
            try
            {
                if (dm_UserEntity.province.IsEmpty())
                {
                    return(Fail("省份不能为空!"));
                }
                if (dm_UserEntity.city.IsEmpty())
                {
                    return(Fail("城市不能为空!"));
                }
                if (dm_UserEntity.down.IsEmpty())
                {
                    return(Fail("区县不能为空!"));
                }
                if (dm_UserEntity.address.IsEmpty())
                {
                    return(Fail("详细地址不能为空!"));
                }

                dm_userIBLL.SaveEntity(user_id, dm_UserEntity);

                return(Success("修改成功!"));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #15
0
        public ActionResult DecodeInviteCode(string InviteCode)
        {
            try
            {
                if (InviteCode.Length != 6)
                {
                    return(null);
                }

                string appid = CheckAPPID();

                dm_userEntity dm_UserEntity = dm_userIBLL.DecodeInviteCode(InviteCode);
                if (dm_UserEntity.IsEmpty())
                {
                    return(Fail("邀请码错误!"));
                }

                return(Success("获取成功!", new
                {
                    UserID = dm_UserEntity.id,
                    NickName = dm_UserEntity.nickname,
                    HeadPic = dm_UserEntity.headpic,
                    RealName = dm_UserEntity.realname,
                    Phone = dm_UserEntity.phone
                }));;
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #16
0
        /// <summary>
        /// 获取个人信息
        /// </summary>
        /// <param name="id">用户id</param>
        /// <returns></returns>

        public ActionResult GetPersonInfo(int User_ID = 0)
        {
            try
            {
                string        token         = base.Request.Headers["token"];
                dm_userEntity dm_UserEntity = dm_userIBLL.GetPersonInfo(token);

                if (!dm_UserEntity.IsEmpty())
                {
                    if (dm_UserEntity.id != User_ID && User_ID > 0)
                    {
                        dm_UserEntity = dm_userIBLL.GetEntityByCache(User_ID);
                    }
                    return(Success("获取成功", dm_UserEntity));
                }
                else
                {
                    return(Fail("用户信息异常!"));
                }
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #17
0
        public ActionResult LoginTokenVerify(string loginToken)
        {
            try
            {
                string        appid         = CheckAPPID();
                string        phone         = "";
                dm_userEntity dm_UserEntity = dm_userIBLL.LoginTokenVerify(loginToken, appid, ref phone);
                if (dm_UserEntity.IsEmpty())
                {
                    if (!phone.IsEmpty())
                    {
                        return(FailNoExistUser(new { phone = phone }));
                    }
                    else
                    {
                        return(Fail("快捷登录失败,请检查token是否正确!"));
                    }
                }

                return(Success("验证成功", dm_UserEntity));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #18
0
        public ActionResult ReviceActivityTask(string token, string taskids)
        {
            dm_userEntity dm_UserEntity = CacheHelper.ReadUserInfoByToken(token);

            if (!dm_UserEntity.IsEmpty())
            {
                dM_Task_ReviceIBLL.ReviceActivityTask(taskids.Split(','), (int)dm_UserEntity.id);
            }
            return(Success("领取成功!"));
        }
Exemple #19
0
        /// <summary>
        /// 获取验证码
        /// </summary>
        /// <param name="Phone">手机号</param>
        /// <param name="Type">验证码类型  1注册  2找回密码  3手机号+验证码登录</param>
        /// <returns></returns>

        public ActionResult GetVerification(string Phone, int Type)
        {
            try
            {
                string        appid         = CheckAPPID();
                dm_userEntity dm_UserEntity = dm_userIBLL.GetEntityByPhone(Phone, appid);
                switch (Type)
                {
                case 1:
                    if (dm_UserEntity != null)
                    {
                        throw new Exception("该手机号已注册!");
                    }
                    break;

                case 2:
                    if (dm_UserEntity == null)
                    {
                        throw new Exception("该手机号未注册!");
                    }
                    break;

                case 3:
                    break;

                default:
                    throw new Exception("获取验证码类型不合法!");
                }
                //Random random = new Random();
                //int ranCode = random.Next(1111, 9999);
                string msgid = CommonSMSHelper.SendSms(Phone, appid);

                if (Type != 3)
                {
                    return(Success("验证码获取成功!", new
                    {
                        //VerifiCode = ranCode,
                        msgid = msgid
                    }));
                }
                else
                {///返回给前端是否为新用户  新用户需要输入邀请码
                    return(Success("验证码获取成功!", new
                    {
                        //VerifiCode = ranCode,
                        IsNewUser = dm_UserEntity == null,
                        msgid = msgid
                    }));
                }
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #20
0
 public ActionResult QuickRegister(dm_userEntity dm_UserEntity, string ParentInviteCode)
 {
     try
     {
         string appid = CheckAPPID();
         return(Success("注册成功!", dm_userIBLL.QuickLogin(dm_UserEntity, ParentInviteCode, appid)));
     }
     catch (Exception ex)
     {
         return(FailException(ex));
     }
 }
Exemple #21
0
        /// <summary>
        /// 手机号登录
        /// </summary>
        /// <param name="dm_UserEntity">保留用户手机号</param>
        /// <param name="ParentInviteCode">邀请码</param>
        /// <param name="VerifiCode">验证码</param>
        /// <param name="IsNewUser">是否是新用户  true:新用户  false:老用户</param>
        /// <returns></returns>

        public ActionResult DM_LoginByPhone(dm_userEntity dm_UserEntity, string ParentInviteCode, string VerifiCode, bool IsNewUser, string SmsMessageID)
        {
            try
            {
                if (SmsMessageID.IsEmpty())
                {
                    throw new Exception("验证码已失效,请重新获取!");
                }

                if (dm_UserEntity.phone.IsEmpty() || dm_UserEntity.phone.Length != 11)
                {
                    return(Fail("手机号不能为空或格式错误!"));
                }
                if (VerifiCode.IsEmpty())
                {
                    return(Fail("验证码不能为空!"));
                }

                string appid = CheckAPPID();

                if (!CommonSMSHelper.IsPassVerification(SmsMessageID, VerifiCode, appid))
                {
                    return(Fail("验证码错误!"));
                }

                //如果是新用户则重新注册
                if (IsNewUser)
                {
                    if (ParentInviteCode.IsEmpty())
                    {
                        return(Fail("邀请码不能为空!"));
                    }

                    dm_UserEntity.nickname = "dlm_" + Time.GetTimeStamp();
                    dm_UserEntity.pwd      = Guid.NewGuid().ToString();

                    return(Success("登录成功!", dm_userIBLL.Register(dm_UserEntity, VerifiCode, ParentInviteCode, appid, SmsMessageID)));
                }
                else
                {//如果是老用户  直接根据手机号查询出用户信息
                    dm_userEntity dm_new_UserEntity = dm_userIBLL.LoginByPhone(dm_UserEntity.phone, appid);
                    return(Success("登录成功!", dm_new_UserEntity));
                }
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #22
0
        public ActionResult GetRandActivityTaskList(string token)
        {
            dm_userEntity dm_UserEntity   = CacheHelper.ReadUserInfoByToken(token);
            DataTable     dm_TaskEntities = new DataTable();

            if (!dm_UserEntity.IsEmpty())
            {
                dm_TaskEntities = dM_TaskIBLL.GetRandActivityTaskList((int)dm_UserEntity.id);
            }
            else
            {
                return(Fail("用户信息异常!"));
            }
            return(Success(dm_TaskEntities));
        }
Exemple #23
0
        public ActionResult ClickShare(dm_friend_thumb_recordEntity dm_Friend_Thumb_RecordEntity)
        {
            try
            {
                dm_userEntity dm_UserEntity = CacheHelper.ReadUserInfo(base.Request.Headers);

                dm_Friend_Thumb_RecordEntity.user_id = dm_UserEntity.id;
                dm_Friend_Thumb_RecordIBLL.ClickShare(dm_Friend_Thumb_RecordEntity);
                return(Success("分享成功!"));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
        /// <summary>
        /// 读取用户信息
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public static dm_userEntity ReadUserInfo(NameValueCollection header)
        {
            if (!header["token"].IsEmpty())
            {
                string token = header["token"].ToString();

                dm_userEntity dm_UserEntity = ReadUserInfoByToken(token);

                return(dm_UserEntity);
            }
            else
            {
                return(null);
            }
        }
Exemple #25
0
        public ActionResult DM_Register(dm_userEntity dm_UserEntity, string VerifiCode, string SmsMessageID, string ParentInviteCode = "100001")
        {
            try
            {
                if (SmsMessageID.IsEmpty())
                {
                    throw new Exception("验证码已失效,请重新获取!");
                }
                if (ParentInviteCode.IsEmpty())
                {
                    ParentInviteCode = ParentInviteCode = "100001";
                }

                /*if (dm_UserEntity.nickname.IsEmpty())
                 * {
                 *  return Fail("用户名不能为空!");
                 * }*/
                if (dm_UserEntity.phone.IsEmpty() || dm_UserEntity.phone.Length != 11)
                {
                    throw new Exception("手机号不能为空或格式错误!");
                }
                if (ParentInviteCode.IsEmpty())
                {
                    throw new Exception("邀请码不能为空!");
                }

                /*if (dm_UserEntity.pwd.IsEmpty())
                 * {
                 *  return Fail("密码不能为空!");
                 * }*/
                if (VerifiCode.IsEmpty())
                {
                    return(Fail("验证码不能为空!"));
                }

                string appid = CheckAPPID();
                dm_UserEntity.appid    = appid;
                dm_UserEntity.nickname = "dlm_" + Time.GetTimeStamp();
                dm_UserEntity.pwd      = Guid.NewGuid().ToString();
                return(Success("注册成功!", dm_userIBLL.Register(dm_UserEntity, VerifiCode, ParentInviteCode, appid, SmsMessageID)));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #26
0
        public ActionResult CanclePraise(dm_friend_thumb_recordEntity dm_Friend_Thumb_RecordEntity)
        {
            try
            {
                dm_userEntity dm_UserEntity = CacheHelper.ReadUserInfo(base.Request.Headers);

                dm_Friend_Thumb_RecordEntity.user_id = dm_UserEntity.id;

                dm_Friend_Thumb_RecordIBLL.CanclePraise(dm_Friend_Thumb_RecordEntity);
                RemoveAllCache();
                return(Success("已取消!"));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
Exemple #27
0
        public ActionResult ActivityPage(string token, string appid, string platform, string version)
        {
            /*
             * 1、随机生成金额分配给对应用户,金额区间26.5~28.2
             * 2、生成用户和任务的关联信息,用于校验任务的状态(一个用户同时接受多个任务  并对任务进行编号)
             */
            dm_userEntity dm_UserEntity = CacheHelper.ReadUserInfoByToken(token);

            if (!dm_UserEntity.IsEmpty())
            {
                dm_activity_manageEntity dm_Activity_ManageEntity = dm_Activity_ManageIBLL.GetActivityInfo();

                if (!dm_Activity_ManageEntity.IsEmpty())
                {
                    ViewBag.ActivityRemark = dm_Activity_ManageEntity.ActivityRemark;

                    dm_activity_recordEntity dm_Activity_RecordEntity = dm_Activity_RecordIBLL.GetEntityByUserID((int)dm_UserEntity.id, dm_Activity_ManageEntity.f_id);

                    if (!dm_Activity_RecordEntity.IsEmpty())
                    {
                        dm_UserEntity = dM_UserIBLL.GetEntity(dm_UserEntity.id);
                    }
                    else
                    {
                        dm_UserEntity            = dM_UserIBLL.JoinActivity((int)dm_UserEntity.id);
                        dm_Activity_RecordEntity = new dm_activity_recordEntity();
                    }

                    ViewBag.ActivityPrice = dm_UserEntity.activityprice;

                    ViewBag.MyActivityInfo = dm_Activity_RecordEntity;
                }
            }
            else
            {
                ViewBag.MyActivityInfo = new dm_activity_recordEntity();
            }


            ViewBag.Token    = token;
            ViewBag.AppID    = appid;
            ViewBag.Platform = platform;
            ViewBag.Version  = version;

            return(View());
        }
Exemple #28
0
 public ActionResult DM_Login(dm_userEntity dm_UserEntity)
 {
     try
     {
         string        appid     = dm_UserEntity.appid = CheckAPPID();
         dm_userEntity loginInfo = dm_userIBLL.Login(dm_UserEntity);
         if (loginInfo == null)
         {
             return(Fail("用户名或密码错误!"));
         }
         return(Success("登录成功", loginInfo));
     }
     catch (Exception ex)
     {
         return(FailException(ex));
     }
 }
Exemple #29
0
        public ActionResult UpdateNickName(int user_id, dm_userEntity dm_UserEntity)
        {
            try
            {
                if (dm_UserEntity.nickname.IsEmpty())
                {
                    return(Fail("用户昵称不能为空!"));
                }

                dm_userIBLL.SaveEntity(user_id, dm_UserEntity);
                return(Success("修改成功!"));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }
        /// <summary>
        /// 写入用户信息
        /// </summary>
        /// <param name="oldToken">原有用户信息的token</param>
        /// <param name="dm_UserEntity">里面的token是最新的</param>
        public static void SaveUserInfo(string oldToken, dm_userEntity dm_UserEntity)
        {
            #region 重新构造用户缓存信息
            if (!dm_UserEntity.IsEmpty())
            {
                string cacheKey = SingleLogin + dm_UserEntity.token;
                redisCache.Write <dm_userEntity>(cacheKey, dm_UserEntity, 8);

                #region 移除用户信息
                if (!oldToken.IsEmpty())
                {
                    string old_cacheKey = SingleLogin + oldToken;
                    redisCache.Remove(old_cacheKey, 8);
                }
                #endregion
            }
            #endregion
        }