Exemplo n.º 1
0
        public JsonResult UpdateActivitiesUserAsync(ActivityUserInfo_xhrRequestModel model)
        {
            string managerId = this.Request.Headers["Authorization"];//Header中的token
            var    result    = ActivityManager.UpdateActivitiesUserAsync(model, managerId);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 活动报名
        /// </summary>
        /// <returns></returns>
        public Reseponse <bool> AddActivitiesUserAsync(ActivityUserInfo_xhrRequestModel model)
        {
            var result = new Reseponse <bool>();

            if (string.IsNullOrWhiteSpace(model.UserName))
            {
                result.status  = 0;
                result.Message = "用户名不能为空!";
                return(result);
            }
            var regex = new Regex("^1[0-9]{10}$");

            if (string.IsNullOrWhiteSpace(model.UserTell) || !regex.IsMatch(model.UserTell))
            {
                result.status  = 0;
                result.Message = "请输入正确的手机号!";
                return(result);
            }
            if (model.AreaID <= 0)
            {
                result.status  = 0;
                result.Message = "请选择地区!";
                return(result);
            }
            try
            {
                using (var client = new ActivityClient())
                {
                    var request = new Tuhu.Service.Activity.Models.ActivityUserInfo_xhrRequest()
                    {
                        UserName = model.UserName,
                        UserTell = model.UserTell,
                        AreaID   = model.AreaID,
                        ActID    = model.ActID
                    };
                    var addresult = client.AddActivitiesUserAsync(request);
                    result.status  = addresult.Result.Success ? 1 : 0;
                    result.Message = addresult.Result.ErrorMessage;
                    result.data    = addresult.Result.Success;
                }
            }
            catch (Exception e)
            {
                Logger.Error($"AddActivitiesUser -> {JsonConvert.SerializeObject(model)}", e);
                throw;
            }
            return(result);
        }
Exemplo n.º 3
0
        public JsonResult AddActivitiesUserAsync(ActivityUserInfo_xhrRequestModel model)
        {
            var result = ActivityManager.AddActivitiesUserAsync(model);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 修改报名信息
        /// </summary>
        /// <returns></returns>
        public Reseponse <bool> UpdateActivitiesUserAsync(ActivityUserInfo_xhrRequestModel model, string managerId)
        {
            var result = new Reseponse <bool>();

            if (string.IsNullOrWhiteSpace(model.UserName))
            {
                result.status  = 0;
                result.Message = "用户名不能为空!";
                return(result);
            }
            var regex = new Regex("^1[0-9]{10}$");

            if (string.IsNullOrWhiteSpace(model.UserTell) || !regex.IsMatch(model.UserTell))
            {
                result.status  = 0;
                result.Message = "请输入正确的手机号!";
                return(result);
            }
            if (model.AreaID <= 0)
            {
                result.status  = 0;
                result.Message = "请选择地区!";
                return(result);
            }
            if (model.PassStatus < 0)
            {
                result.status  = 0;
                result.Message = "请选择正确的审核状态!";
                return(result);
            }
            if (model.UserStatus < 0)
            {
                result.status  = 0;
                result.Message = "请选择正确的用户状态!";
                return(result);
            }
            int userid = int.Parse(TuhuCryption.Decrypt(managerId));

            try
            {
                using (var client = new ActivityClient())
                {
                    var checkresult = client.CheckLoginAsync(userid);
                    if (!checkresult.Result.Success)
                    {
                        result.status  = 0;
                        result.Message = "请先登录!";
                        return(result);
                    }
                    var request = new Tuhu.Service.Activity.Models.ActivityUserInfo_xhrRequest()
                    {
                        UserId     = int.Parse(TuhuCryption.Decrypt(model.UserId)),
                        UserName   = model.UserName,
                        UserTell   = model.UserTell,
                        AreaID     = model.AreaID,
                        PassStatus = model.PassStatus,
                        ActID      = model.ActID,
                        UserStatus = model.UserStatus
                    };
                    var addresult = client.UpdateActivitiesUserAsync(request);
                    result.status  = addresult.Result.Success ? 1 : 0;
                    result.Message = addresult.Result.ErrorMessage;
                    result.data    = addresult.Result.Success;
                }
            }
            catch (Exception e)
            {
                Logger.Error($"UpdateActivitiesUser -> {JsonConvert.SerializeObject(model)}", e);
                throw;
            }
            return(result);
        }