public HttpResponseMessage LogOut() { var resp_binary = new Resp_Binary { flag = 1 }; var response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(resp_binary.ToJson(), Encoding.UTF8, "application/json"); var cookie = new CookieHeaderValue("userInfo", ""); cookie.Expires = DateTimeOffset.Now.AddMinutes(1); cookie.Domain = Request.RequestUri.Host; cookie.Path = "/"; response.Headers.AddCookies(new CookieHeaderValue[] { cookie }); return(response); }
public static Resp_Binary To_Resp_Binary(this Comment_State state) { var resp = new Resp_Binary(); if (state.File_State == File_Upload_State.Count_Err) { resp.remark = "图片数量不能大于9"; } else { if (state.T_R_State == TopicReply_State.Content_Empty) { resp.remark = "帖子内容不能为空"; } else if (state.T_R_State == TopicReply_State.Db_Insert_Err) { resp.remark = "发表失败"; } else { resp.status = true; //if (state.File_State == File_Upload_State.None) //{ // resp.remark = "发表成功"; //} if (state.File_State == File_Upload_State.Success) { resp.remark = $"发表成功\n成功上传{state.Count}张图片"; } else { resp.remark = "发表成功"; } } } return(resp); }