|
@@ -17,53 +17,64 @@ namespace MySystem
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- string accesskeyld = "IOT_ACCOUNT_TEST_CSYH";
|
|
|
- string accesskeySecret = "AtR4g5sa24fdy6GII3hts75_CSYH";
|
|
|
- string reqUrl = "https://voicetest.tysmartpos.com/api/bank/pushmsg";
|
|
|
+ // string accesskeyld = "IOT_ACCOUNT_TEST_CSYH";
|
|
|
+ // string accesskeySecret = "AtR4g5sa24fdy6GII3hts75_CSYH";
|
|
|
+ // string reqUrl = "https://voicetest.tysmartpos.com/api/bank/pushmsg";
|
|
|
|
|
|
- public void Start()//启动
|
|
|
- {
|
|
|
- Thread thread = new Thread(listen);
|
|
|
- thread.IsBackground = true;
|
|
|
- thread.Start();
|
|
|
- }
|
|
|
+ string accesskeyld = "IOT_ACCOUNT_PROD_W966HG08MCOXHNT2";
|
|
|
+ string accesskeySecret = "F2jzl8vGkm0fMeDLyYo40wEbzdaiTX2ywj3YNgszJHAbVbcAYIJL9bzzS9lVPPL6";
|
|
|
+ string reqUrl = "https://voice.tysmartpos.com/api/bank/pushmsg";
|
|
|
+
|
|
|
+ // public void Start()//启动
|
|
|
+ // {
|
|
|
+ // Thread thread = new Thread(listen);
|
|
|
+ // thread.IsBackground = true;
|
|
|
+ // thread.Start();
|
|
|
+ // }
|
|
|
|
|
|
- public void listen()
|
|
|
+ // public void listen()
|
|
|
+ // {
|
|
|
+ // while (true)
|
|
|
+ // {
|
|
|
+ // string content = RedisDbconn.Instance.RPop<string>("TianYuVoiceQueue");
|
|
|
+ // if (!string.IsNullOrEmpty(content))
|
|
|
+ // {
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // doSomething(content);
|
|
|
+ // Thread.Sleep(10);
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "天喻云喇叭异常");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // Thread.Sleep(1000);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ public string doSomething(string OrderNo, string DeviceId, string Amount)
|
|
|
{
|
|
|
- while (true)
|
|
|
+ string result = "";
|
|
|
+ try
|
|
|
{
|
|
|
- string content = RedisDbconn.Instance.RPop<string>("TianYuVoiceQueue");
|
|
|
- if (!string.IsNullOrEmpty(content))
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- doSomething(content);
|
|
|
- Thread.Sleep(10);
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "天喻云喇叭异常");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Thread.Sleep(1000);
|
|
|
- }
|
|
|
+ SortedList<string, string> data = new SortedList<string, string>();
|
|
|
+ data.Add("accessKeyId", accesskeyld); //由本公司统一提供给客户的唯一识别码(同accessKeyId)
|
|
|
+ data.Add("requestId", OrderNo); //请求标识,用于唯一标识当前请求
|
|
|
+ data.Add("timestamp", function.GetCurTimestamp().ToString()); //请求时间戳,格式如:1593532800000
|
|
|
+ data.Add("deviceId", DeviceId); //设备编号
|
|
|
+ data.Add("content", "来客吧收款" + Amount + "元"); //(终端直接播报内容,支持 tts 设备可以直接播报汉字语音,不支持 tts 的设备要分开传 requestData、payType)
|
|
|
+ // data.Add("requestData", "0.01"); //播报金额((只送金额,单位:元)
|
|
|
+ // data.Add("payType", "01"); //播报类型: 01-XX银行收款成功 02-支付宝收款成功 03-微信收款成功 10-取消支付
|
|
|
+ result = post(data);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "天喻云喇叭异常");
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- public string doSomething(string content)
|
|
|
- {
|
|
|
- JsonData jsonObj = JsonMapper.ToObject(content);
|
|
|
- SortedList<string, string> data = new SortedList<string, string>();
|
|
|
- data.Add("accessKeyId", accesskeyld); //由本公司统一提供给客户的唯一识别码(同accessKeyId)
|
|
|
- data.Add("requestId", jsonObj["OrderNo"].ToString()); //请求标识,用于唯一标识当前请求
|
|
|
- data.Add("timestamp", function.GetCurTimestamp().ToString()); //请求时间戳,格式如:1593532800000
|
|
|
- data.Add("deviceId", jsonObj["DeviceId"].ToString()); //设备编号
|
|
|
- data.Add("content", "来客吧收款" + jsonObj["Amount"].ToString() + "元"); //(终端直接播报内容,支持 tts 设备可以直接播报汉字语音,不支持 tts 的设备要分开传 requestData、payType)
|
|
|
- // data.Add("requestData", "0.01"); //播报金额((只送金额,单位:元)
|
|
|
- // data.Add("payType", "01"); //播报类型: 01-XX银行收款成功 02-支付宝收款成功 03-微信收款成功 10-取消支付
|
|
|
- string result = post(data);
|
|
|
return result;
|
|
|
}
|
|
|
|