コード例 #1
0
        public ResultLogin Login(Model.DB.User model)
        {
            ApiResultEnum result = UserDA.Login(ref model, platform);

            if (result == ApiResultEnum.Success)
            {
                string user_token = UserRA.Get(model.id.ToString(), "platform_" + platform);
                if (string.IsNullOrWhiteSpace(user_token))
                {
                    user_token = FuncHelper.GetUniqueString();
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("platform_" + platform, user_token);
                    dic.Add("name", model.name);
                    dic.Add("status_order", model.status_order.ToString());
                    dic.Add("role", model.role.ToString());
                    dic.Add("login_time_" + platform, DateTime.Now.Format());
                    UserRA.Set(model.id.ToString(), dic);
                    UserRA.SetExpire(model.id.ToString());
                }
                return(new ResultLogin(result, model, model.id + "-" + user_token));
            }
            else
            {
                return(new ResultLogin(result, null, null));
            }
        }