| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System.Collections;
- using System.Text.RegularExpressions;
- using Common;
- using LitJson;
- using Microsoft.CodeAnalysis.CSharp.Scripting;
- namespace Task
- {
- public class MakeHelper
- {
- public readonly static MakeHelper Instance = new MakeHelper();
- private MakeHelper()
- { }
- public void Start(string QueueName)
- {
- RabbitMQClient.Instance.StartReceive(QueueName, content => DoWorks(content));
- }
- public void DoWorks(string content)
- {
- try
- {
- if (!string.IsNullOrEmpty(content))
- {
- DoQueue(content);
- }
- }
- catch (Exception ex)
- {
- Utils.WriteLog(DateTime.Now.ToString() + "\n" + ex, "生成异常");
- }
- }
- public void DoQueue(string content)
- {
- JsonData jsonObj = JsonMapper.ToObject(content);
- string requestId = jsonObj["requestId"].ToString();
- string modePath = jsonObj["modePath"].ToString();
- string templateString = Function.ReadInstance("Template/" + modePath); //读取数据库sql模板
- string resultString = Util.Maker.StartMake(jsonObj["data"], templateString);
- RabbitMQClient.Instance.Push("MakeSqlCallBackQueue", requestId + "#cut#" + resultString);
- }
- }
- }
|