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.
 
 
 
 
 
 

137 lines
5.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using Sog;
using LitJson;
using SimpleHttpServer;
using ProtoCSStruct;
using MySql.Data.MySqlClient;
namespace Operation
{
//封号
[MenuMapping(refc = typeof(PlayerInfoOp))]
public class QueryPayRecord
{
//收到回包时调用这个
public static void OnUserPayResMsg(uint id, JsonData jsondata, HttpResponse rsp, HttpRequest request, HttpQueryParams query, ref SSGmQueryUserPayRecordRes res)
{
JsonData columnsArray = new JsonData();
jsondata["columns"] = columnsArray;
columnsArray.Add("TimeSecond");
columnsArray.Add("uid");
columnsArray.Add("ProductId");
columnsArray.Add("Money");
columnsArray.Add("Diamond");
columnsArray.Add("DiamondGift");
columnsArray.Add("IsTestPay");
columnsArray.Add("Amount");
columnsArray.Add("Currency");
columnsArray.Add("OrderId");
columnsArray.Add("OrderId3rd");
columnsArray.Add("PayType");
columnsArray.Add("RefundTime");
columnsArray.Add("Status");
JsonData msgdata = new JsonData();
jsondata["data"] = msgdata; msgdata.Add(""); msgdata.Clear();
for (int recordIndex = 0; recordIndex < res.Records.Count; recordIndex++)
{
ref var onerecord = ref res.Records.Get(recordIndex);
JsonData linedata = new JsonData();
linedata.Add(OperationServerUtils.StampToDateTime((long)onerecord.TimeSecond).ToString("yyyy-MM-dd HH:mm:ss"));
linedata.Add(onerecord.Uid.ToString());
linedata.Add(onerecord.ProductId.ToString());
linedata.Add(onerecord.Money.ToString());
linedata.Add(onerecord.Diamond.ToString());
linedata.Add(onerecord.DiamondGift.ToString());
linedata.Add(onerecord.IsTestPay.ToString());
linedata.Add(onerecord.Amount.ToString());
linedata.Add(onerecord.Currency.GetString());
linedata.Add(onerecord.OrderId.GetString());
linedata.Add(onerecord.OrderId3rd.GetString());
linedata.Add(onerecord.PayType.ToString());
linedata.Add(onerecord.RefundTime.ToString());
linedata.Add(onerecord.Status.ToString());
msgdata.Add(linedata);
}
rsp.IsWaitFor = false;
TraceLog.Trace("QueryPayRecord.OnUserPayResMsg success, uid {0} pay count {1}", id, res.Records.Count);
jsondata["pagetotal"] = res.PageTotal.ToString();
jsondata["code"] = 0;
return;
}
[RequestMapping("订单查询",PermissionCode.PAY_RECORD,true)]
public static int OnQueryPayRecordHttpReq(string httpApiCmd, JsonData jsondata, HttpResponse rsp, HttpRequest request, HttpQueryParams query, uint id)
{
TraceLog.Trace("QueryPayRecord.OnQueryPayRecordHttpReq Url{0},param count {1}", request.Url, query.Count);
int uid = query.GetValue("uid").Toint32(0);
string orderId = query.GetValue("orderId");
string orderId3rd = query.GetValue("orderId3rd");
string startTimestr = query.GetValue("startTime");
string endTimestr = query.GetValue("endTime");
int status = query.GetValue("status").Toint32(-999);
int page = query.GetValue("page").Toint32(0);
int limit = query.GetValue("limit").Toint32(0);
long startTime = 0;
long endTime = 0;
if (!string.IsNullOrEmpty(startTimestr))
{
startTime = OperationServerUtils.GetTimeStamp(DateTime.Parse(startTimestr));
}
if (!string.IsNullOrEmpty(endTimestr))
{
endTime = OperationServerUtils.GetTimeStamp(DateTime.Parse(endTimestr));
}
if (uid == 0 && string.IsNullOrEmpty(orderId))
{
jsondata["ret"] = -2;
jsondata["msg"] = "必须提供UID或者订单ID";
return -2;
}
//如果没传uid 则从订单号取
if (uid == 0)
{
uid = orderId.Split('-')[0].Toint32();
}
SSGmQueryUserPayRecordReq req = new SSGmQueryUserPayRecordReq();
req.UID = uid;
req.Status = status;
req.Guid = id;
req.StartTime = startTime;
req.EndTime = endTime;
req.OrderId.SetString(orderId);
req.OrderId3rd.SetString(orderId3rd);
req.Pageindex = page;
req.Pagesize = limit;
//发送消息
OperationServerUtils.SendToDBServer((int)SSGameMsgID.GmQueryUserPayRecordReq, ref req, 0, 0);
rsp.IsWaitFor = true;
jsondata["ret"] = -1;
jsondata["msg"] = "查询超时";
return -1;
}
}
}