Example #1
0
        public string RecommendUser([FromBody] QueryRecommendUser query)
        {
            query.Ssid = query.Ssid.Substring(1, query.Ssid.Length - 2);
            var json = new UserRecommend().AddRecommend(query);

            return(JsonConvert.SerializeObject(json));
        }
Example #2
0
        public ResultRecommend AddRecommend(QueryRecommendUser query)
        {
            var result = new ResultRecommend {
                Exception = new MyException()
            };

            try
            {
                var realSsid = new EncryDecry().Md5Decrypt(query.Ssid);
                var arr      = HelpTool.GetSession(realSsid);
                var errNo    = string.Empty;
                if (arr.Length < 3 || !CheckRecommenUser(query.User, new EncryDecryPhone().Md5Decrypt(query.Phone), ref errNo))
                {
                    result.Exception.Exmsg   = errNo;
                    result.Exception.Success = false;
                    return(result);
                }
                var user = arr.GetValue(2).ToString();
                if (user.Equals(query.User))
                {
                    result.Exception.Exmsg   = "4";
                    result.Exception.Success = false;
                    return(result);
                }
                var userRecommend = new Tb_Recommend
                {
                    RecommendUser = user,
                    User          = query.User,
                    CDT           = DateTime.Now
                };
                _userRecommend.AddRecommend(userRecommend);
                result.Exception.Success = true;
            }
            catch (Exception ex)
            {
                result.Exception.Success = false;
                AppLogger.Error($"{ex.Message} {ex.StackTrace}");
            }
            return(result);
        }