public JObject LineNotify_Send(LineNotifyPostModel value) { string result = string.Empty; JObject PostResult = new JObject(); try { LineNotify LineNotifyService = new LineNotify();//宣告LineNotify服務 string CheckResult = LineNotify_Check(value); if (!string.IsNullOrEmpty(CheckResult)) { PostResult.Add("Code", (int)ErrorCodeEnum.ParameterisNull); PostResult.Add("Message", CheckResult); return(PostResult); } CheckResult = LineNotifyService.GroupToken_Get(value.TokenID); if (!string.IsNullOrEmpty(CheckResult)) { PostResult.Add("Code", (int)ErrorCodeEnum.ParameterisNull); PostResult.Add("Message", CheckResult); return(PostResult); } Dictionary <string, string> HeadList = LineNotifyService.SendMessageHeaderCombin(value.GroupKey); string Message = LineNotifyService.SendMessageParameter_Combin(value); //呼叫傳送訊息API PostResult = ApiHelper.Post(LineNotifyService.LineNotifySendMessageURL_Get(), Message, ApiHelper.HeaderCombin(HeadList)); } catch (Exception ex) { this.Logger.LogWarning(ex.Message); throw ex; } return(PostResult); }
public void reSendLine(string token, string msg) { LineNotify lineNoti = new LineNotify(); string str_send = msg.Replace("\\n", "\n"); writeLog(" \r\n --------- re send line ------------- \r\n"); writeLog("msg ==" + str_send); if (lineNoti.SendMessage(token, "\n" + str_send)) { writeLog("-- re sent line notify success...\r\n"); Console.Out.WriteLine("sent line notify success..." + lineNoti.LineError); } else { writeLog("-- re sent line notify failed..."); Console.Out.WriteLine("sent line notify failed...\r\n" + lineNoti.LineError); } }
public void sendLineMore1000Text(string token, List <string> msg) { LineNotify lineNoti = new LineNotify(); for (int i = 0; i < msg.Count; i++) { string str_send = msg[i].Replace("\\n", "\n"); writeLog("msg ==" + str_send); if (lineNoti.SendMessage(token, "\n" + str_send)) { writeLog("sent line notify success...\r\n"); Console.Out.WriteLine("sent line notify success..." + lineNoti.LineError); } else { writeLog("sent line notify failed..."); Console.Out.WriteLine("sent line notify failed...\r\n" + lineNoti.LineError); reSendLine(token, msg[i]); } } }
public HomeController(ILogger <HomeController> logger, LineNotify lineNotify) { _logger = logger; _lineNotify = lineNotify; }