| | |
| | | </summary> |
| | | <param name="output"></param> |
| | | </member> |
| | | <member name="T:CommonUtil.Web.SendQwGroup"> |
| | | <summary> |
| | | åéä¼å¾®æºå¨äºº |
| | | </summary> |
| | | </member> |
| | | <member name="M:CommonUtil.Web.SendQwGroup.SendMessage(System.String)"> |
| | | <summary> |
| | | |
| | | </summary> |
| | | </member> |
| | | <member name="T:CommonUtil.Web.ServiceUtil"> |
| | | <summary> |
| | | |
| | |
| | | <param name="textParams">Text parameters.</param> |
| | | <param name="headerParams">Header parameters.</param> |
| | | </member> |
| | | <member name="M:CommonUtil.Web.WebUtil.DoPostWithJson(System.String,System.String,System.Collections.Generic.IDictionary{System.String,System.String})"> |
| | | <summary> |
| | | post jsonè¯·æ± |
| | | </summary> |
| | | <param name="url"></param> |
| | | <param name="body"></param> |
| | | <param name="headerParams"></param> |
| | | <returns></returns> |
| | | </member> |
| | | <member name="M:CommonUtil.Web.WebUtil.GetWebRequest(System.String,System.String,System.Collections.Generic.IDictionary{System.String,System.String})"> |
| | | <summary> |
| | | çæHttpWebRequest |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace CommonUtil.Web |
| | | { |
| | | /// <summary> |
| | | /// åéä¼å¾®æºå¨äºº |
| | | /// </summary> |
| | | public class SendQwGroup |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public static void SendMessage(string message) |
| | | { |
| | | try |
| | | { |
| | | string body = "{\"msgtype\": \"markdown\",\"markdown\":{\"content\":\"" + message + "\"}}"; |
| | | string res = new WebUtil().DoPostWithJson("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1e5a8b47-b108-40a6-9a29-d629863bd066", body, null); |
| | | |
| | | body = "{\"msgtype\": \"text\",\"text\":{\"content\":\"æ¨ææ°çæ¶æ¯éè¦å¤ç\",\"mentioned_mobile_list\":[\"13382447768\",\"15862977578\",\"17315773080\"]}}"; |
| | | res = new WebUtil().DoPostWithJson("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1e5a8b47-b108-40a6-9a29-d629863bd066", body, null); |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// post jsonè¯·æ± |
| | | /// </summary> |
| | | /// <param name="url"></param> |
| | | /// <param name="body"></param> |
| | | /// <param name="headerParams"></param> |
| | | /// <returns></returns> |
| | | public string DoPostWithJson(string url, string body, IDictionary<string, string> headerParams) |
| | | { |
| | | HttpWebRequest req = GetWebRequest(url, "POST", headerParams); |
| | | req.ContentType = "application/json;charset=utf-8"; |
| | | |
| | | byte[] postData = Encoding.UTF8.GetBytes(body); |
| | | Stream reqStream = req.GetRequestStream(); |
| | | reqStream.Write(postData, 0, postData.Length); |
| | | reqStream.Close(); |
| | | |
| | | HttpWebResponse rsp = (HttpWebResponse)req.GetResponse(); |
| | | Encoding encoding = GetResponseEncoding(rsp); |
| | | return GetResponseAsString(rsp, encoding); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çæHttpWebRequest |
| | | /// </summary> |
| | | /// <param name="url"></param> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using CommonUtil; |
| | | using CommonUtil.Web; |
| | | using Operater.DAL; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace ScheduledTasks.Handle |
| | | { |
| | | public class SmsWarningHandle : IJob |
| | | { |
| | | public async Task Execute(IJobExecutionContext context) |
| | | { |
| | | await Synchronize(context); |
| | | } |
| | | public static async Task Synchronize(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | //æ¥è¯¢è¶
è¿3åéæªå®¡æ ¸ç |
| | | string searchSql = $"select count(1) as count from sms_send where sendstatus=0 and isshowsend=0 and TIMESTAMPDIFF(MINUTE, now(),createtime)>3"; |
| | | DataTable shDt = new YzOrderinfoDAL().SearchBySqlDataTable("Sms", searchSql); |
| | | int shCount = int.Parse(shDt.Rows[0]["count"].ToString()); |
| | | if (shCount > 0) |
| | | {//åé¢è¦ |
| | | string warStr = "æ¨æå¾
å®¡æ ¸çä»»å¡\n>ç±»åï¼å¾
å®¡æ ¸\n>æ°é:" + shCount + "\n>æ¥ç:[ç¹å»å¤ç](https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7a9a40880081340d&redirect_uri=https%3A%2F%2Fsms.ushopvip.com%2Fpages%2Fad_page%2Ftrans&response_type=code&scope=snsapi_base&state=gzh#wechat_redirect)"; |
| | | SendQwGroup.SendMessage(warStr); |
| | | |
| | | } |
| | | //æ¥è¯¢é¿æ¶é´æªåéæå |
| | | searchSql = $"select count(1) as count from sms_send where isshowsend=0 and wantsendtime>now() and sendstatus=0 and TIMESTAMPDIFF(MINUTE, now(),wantsendtime)>5"; |
| | | DataTable wfDt = new YzOrderinfoDAL().SearchBySqlDataTable("Sms", searchSql); |
| | | int wfCount = int.Parse(wfDt.Rows[0]["count"].ToString()); |
| | | if (wfCount > 0) |
| | | {//åé¢è¦ |
| | | string warStr = "é¿æ¶é´æªåé宿任å¡\n>ç±»åï¼ä»»å¡å¼å¸¸\n>æ°é:" + wfCount; |
| | | SendQwGroup.SendMessage(warStr); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogUtil.Info(e.ToString(), "çä¿¡é¢è¦error"); |
| | | Console.WriteLine($"çä¿¡é¢è¦error", e.ToString()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | scheduler = await factory.GetScheduler(); |
| | | //å¼å§è°åº¦å¨ |
| | | await scheduler.Start(); |
| | | |
| | | |
| | | //æèµå1688tokenæ´æ° |
| | | string tokenupdate = ConfigUtil.GetValue<string>("job_tokenupdate"); |
| | | await CreateJob<TokenUpdateHandle>("tokenæ´æ°", "tokenæ´æ°", tokenupdate); |
| | | await CreateJob<DataStatisticsHandle>("æ°æ®ç»è®¡", "æ°æ®ç»è®¡", ConfigUtil.GetValue<string>("job_datastatic")); |
| | | //await CreateJob<YzTradeVerifyHandle>("æèµè®¢åæ ¡éª", "æèµè®¢åæ ¡éª", ConfigUtil.GetValue<string>("job_yztradeverify")); |
| | | await CreateJob<WxMiniTokenHandle>("é微信å°ç¨åºtokenæ´æ°", "é微信å°ç¨åºtokenæ´æ°", ConfigUtil.GetValue<string>("job_fxwxtoken")); |
| | | await CreateJob<SmsWarningHandle>("çä¿¡ç³»ç»é¢è¦", "çä¿¡ç³»ç»é¢è¦", ConfigUtil.GetValue<string>("job_smswarning")); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | }, |
| | | "AllowedHosts": "*", |
| | | //æèµå1688 tokenæ´æ° æ¯å¤©åæ¨1ç¹ |
| | | "job_tokenupdate": "0 0 1 * * ?", |
| | | //æ°æ®ç»è®¡ æ¯å¤©åæ¨3ç¹ |
| | | "job_datastatic": "0 0 3 * * ?", |
| | | //æèµè®¢åæ ¡éª |
| | | "job_yztradeverify": "0 0 2 * * ?", |
| | | //åé微信å°ç¨åºtokenæ´æ° æ¯é10åé触å䏿¬¡ |
| | | "job_fxwxtoken": "0 0/10 * * * ?", |
| | | |
| | | //çä¿¡ç³»ç»é¢è¦ æ¯é5åé触å䏿¬¡ |
| | | "job_smswarning": "0 0/5 * * * ?", |
| | | "DbConnection": [ |
| | | { |
| | | //æ£å¼ |
| | | "Key": "Main", |
| | | "ConnectionString": "server=123.60.83.120;port=3306;uid=fxuser;pwd=opRer16#2e2rdq;database=fx_main;Allow Zero Datetime=True;Charset=utf8;" |
| | | }, |
| | | { |
| | | //æ£å¼ |
| | | "Key": "Sms", |
| | | "ConnectionString": "server=123.60.83.120;port=3306;uid=fxuser;pwd=opRer16#2e2rdq;database=sms_sender;Allow Zero Datetime=True;Charset=utf8;" |
| | | } |
| | | ] |
| | | } |