Пример #1
0
        public OutputModel Login([FromBody] InputModel input)
        {
            OutputModel response = new OutputModel();

            string inputData = RSAHelper.Decrypt(WebConfig.PrivateKey, input.Params);

            LoginInputModel user = JsonConvert.DeserializeObject <LoginInputModel>(inputData);

            //  参数错误
            if (user == null)
            {
                response.Result = "params invalid";
                response.Code   = 403;
                return(response);
            }

            UserDto userDto = new UserDto()
            {
                UserName = user.UserName,
                Password = MD5Encrypt.Getmd5(user.Password)
            };

            var output = userService.Login(userDto);

            response.Code   = output.Flag? 200 : 204;
            response.Result = output.Msg;
            response.Data   = output.Token;

            return(response);
        }
Пример #2
0
        /// <summary>
        /// 登录接口
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public void LoginApi(string username, string password)
        {
            var requestdata = new
            {
                phone         = username,
                password      = MD5Encrypt.Getmd5(password),
                rememberLogin = true
            };

            string data = RestHelper.SendPostRequest("http://music.163.com/weapi/login/cellphone", requestdata, true);
        }