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.
152 lines
4.7 KiB
152 lines
4.7 KiB
/*
|
|
Sog 游戏基础库
|
|
2016 by zouwei
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
|
|
using Sog;
|
|
|
|
using Sog.IO;
|
|
using SimpleHttpServer;
|
|
using LitJson;
|
|
|
|
using ProtoCSStruct;
|
|
using System.Collections;
|
|
|
|
namespace Operation
|
|
{
|
|
public class GmCmdSvc : BaseReloadableService
|
|
{
|
|
public override int GetServiceType()
|
|
{
|
|
return OperationServiceType.GmCmdSvc;
|
|
}
|
|
|
|
//销毁的时候清空指令注册
|
|
public override void Dispose()
|
|
{
|
|
GmCommandMgr.Instance.ClearAll();
|
|
}
|
|
|
|
//构造的时候注册所有指令
|
|
public GmCmdSvc()
|
|
{
|
|
RegisterAllGmCmd();
|
|
}
|
|
|
|
private void RegisterAllGmCmd()
|
|
{
|
|
GmCommandMgr.Instance.Register("SendAllNotice", "SendAllNotice", this.SendAllNotice);
|
|
GmCommandMgr.Instance.Register("TestMsg", "TestMsg", this.TestMsg);
|
|
GmCommandMgr.Instance.Register("TestLamp", "TestLamp", this.TestLamp);
|
|
GmCommandMgr.Instance.Register("TestPush", "", this.TestPush);
|
|
GmCommandMgr.Instance.Register("TestSqlError", "TestSqlError", this.TestSqlError);
|
|
GmCommandMgr.Instance.Register("SendMail", "SendMail", this.SendMail);
|
|
}
|
|
|
|
private int SendAllNotice(long userid, string[] cmdParams)
|
|
{
|
|
OperationServerUtils.GetSendNoticeSvc().OnTick(0);
|
|
return 0;
|
|
|
|
}
|
|
private int TestMsg(long userid, string[] cmdParams)
|
|
{
|
|
if (cmdParams.Length > 1)
|
|
{
|
|
TraceLog.Error("GmCmdSvc.TestMsg invalid param");
|
|
return -1;
|
|
}
|
|
|
|
var ping = new CSPing();
|
|
|
|
OperationServerUtils.GetPacketSender().SendToWorldServer((int)CSGameMsgID.Ping, ref ping, 0);
|
|
TraceLog.Trace("GmCmdSvc.TestMsg succ");
|
|
return 0;
|
|
}
|
|
|
|
private int TestLamp(long userId, string[] cmdParams)
|
|
{
|
|
if (cmdParams.Length > 2)
|
|
{
|
|
TraceLog.Error("GmCmdSvc.TestLamp invalid param");
|
|
return -1;
|
|
}
|
|
|
|
SSSysNoticeLampReq req = new SSSysNoticeLampReq();
|
|
req.TriggerTime.SetString(cmdParams[0]);
|
|
req.ShowCount = 2;
|
|
req.ShowInterval = 30;
|
|
req.Content.SetString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
req.CycleTimeType = 1;
|
|
|
|
OperationServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.SysNoticeLampReq, ref req, 0, 0);
|
|
return 0;
|
|
}
|
|
|
|
private int TestPush(long userId, string[] cmdParams)
|
|
{
|
|
SSGoogleFirebasePush push = new SSGoogleFirebasePush();
|
|
push.Content.SetString("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
|
|
|
OperationServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.GooglePushInfo, ref push, 0);
|
|
return 0;
|
|
}
|
|
|
|
private int TestSqlError(long userId, string[] cmdParams)
|
|
{
|
|
LitJson.JsonData builder = new LitJson.JsonData();
|
|
|
|
HttpQueryParams queryParams = new HttpQueryParams();
|
|
queryParams.AddNameValue("name", "");
|
|
queryParams.AddNameValue("title", "");
|
|
queryParams.AddNameValue("content", "");
|
|
queryParams.AddNameValue("chip", "0");
|
|
queryParams.AddNameValue("diamond", "0");
|
|
queryParams.AddNameValue("item1", "0");
|
|
queryParams.AddNameValue("itemCount1", "0");
|
|
queryParams.AddNameValue("timeLimit", "0");
|
|
|
|
HttpResponse rsp = new HttpResponse
|
|
{
|
|
ContentAsUTF8 = "no process",
|
|
ReasonPhrase = "OK",
|
|
StatusCode = "200"
|
|
};
|
|
HttpRequest request = new HttpRequest();
|
|
|
|
SendEmail.OnSendEmailHttpReq("send_email", builder, rsp, request, queryParams, 0);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
private int SendMail(long userId, string[] cmdParams)
|
|
{
|
|
LitJson.JsonData builder = new LitJson.JsonData();
|
|
|
|
HttpQueryParams queryParams = new HttpQueryParams();
|
|
queryParams.AddNameValue("server_id", "1");
|
|
queryParams.AddNameValue("role_id", "1");
|
|
queryParams.AddNameValue("title", "test");
|
|
queryParams.AddNameValue("content", "test contenct");
|
|
|
|
HttpResponse rsp = new HttpResponse
|
|
{
|
|
ContentAsUTF8 = "no process",
|
|
ReasonPhrase = "OK",
|
|
StatusCode = "200"
|
|
};
|
|
HttpRequest request = new HttpRequest();
|
|
|
|
SendEmail.OnSendMailHttpReq("sendMail", builder, rsp, request, queryParams, 0);
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
|