You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

95 lines
3.3 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Operation;
using Sog;
using LitJson;
using SimpleHttpServer;
using MySql.Data.MySqlClient;
using System.IO;
using System.Drawing;
using ProtoCSStruct;
using System.Collections;
namespace Operation
{
public class DeleteNotice
{
[RequestMapping("删除公告",PermissionCode.DEL_NOTICE, toLog: true)]
public static int OnDeleteNoticeHttpReq(string httpApiCmd, JsonData jsonData, HttpResponse rsp, HttpRequest request, HttpQueryParams query, uint httpContextId)
{
TraceLog.Trace("DeleteNotice.OnDeleteNoticeHttpReq url {0} ,param count {1} ,httpContextId {2}", request.Url, query.Count, httpContextId);
string id = query.GetValue("id") == null ? "" : query.GetValue("id");
string noticeId = query.GetValue("noticeId") == null ? "" : query.GetValue("noticeId");
TraceLog.Trace("DeleteNotice.OnDeleteNoticeHttpReq id {0} noticeId {1}", id, noticeId);
RepeatedFixedStructString128_10 data = new RepeatedFixedStructString128_10();
data.Add(id);
data.Add(noticeId);
HttpApiRootHandler.FillHttpApiDbReq2MessageTaskDistributor(httpApiCmd, httpContextId, ref data);
rsp.IsWaitFor = true;
return 0;
}
public static int DoDeleteNotice(string httpApiCmd, SSHttpApiDbReq req, DBOperator dbOperator)
{
TraceLog.Trace("DeleteNotice.DoDeleteNotice HttpContextId {0}", req.HttpContextId);
HttpRequestInfo m_request = null;
LitJson.JsonData builder = new LitJson.JsonData();
try
{
var httpContextId = req.HttpContextId;
m_request = OperationServer.m_httpService.m_requestList.Find(f => f.Http.id == httpContextId);
if (req.Data.Count < 2)
{
TraceLog.Error("DeleteNotice.DoDeleteNotice param error");
builder["ret"] = 2;
builder["msg"] = "参数错误";
}
else
{
string id = req.Data[0].ToString() == null ? "" : req.Data[0].ToString();
if (id.Contains(','))
{
var idList = id.Split(',');
foreach (var item in idList)
{
dbOperator.DBDeleteNotice(builder, item, req.Data[1].ToString());
}
}
else
{
dbOperator.DBDeleteNotice(builder, id, req.Data[1].ToString());
}
}
}
catch (Exception ex)
{
TraceLog.Error("DeleteNotice.DoDeleteNotice Error Msg {0}", ex.Message);
}
finally
{
if (m_request != null)
{
m_request.Http.httpResponse.ContentAsUTF8 = builder.ToJson();
m_request.ProcessEnd = true;
}
}
TraceLog.Trace("DeleteNotice.DoDeleteNotice success httpContextId {0}", req.HttpContextId);
return 0;
}
}
}