/// <summary> /// 联系客服(菜单) /// </summary> /// <param name="recMsg"></param> /// <returns></returns> public async Task <string> ContactKf(PubReceiveMsg recMsg) { try { var timeStamp = ComHelper.ConvertDateTimeInt(DateTime.Now); if (!IsWorkTime()) { var msg = "您好!现在非客服上班时间,请您在每天9-22点联系我们的客服美眉!"; return(await wxAutoComResponse.SendWxText(recMsg.FromUserName, recMsg.ToUserName, timeStamp, msg)); } else { PubKfApi.SendTextMsg(recMsg.FromUserName, "正在为你转接在线客服,请稍后....."); var msg = PubMsgApi.BuildKfTransferMsg(recMsg.FromUserName, recMsg.ToUserName, timeStamp); logHelper.Debug("ContactKf:msg:" + msg.JsonSerialize()); // 发送客服消息提醒 return(await wxAutoComResponse.AutoMsgResponse(msg)); } } catch (Exception ex) { logHelper.Error("ContactKf:联系客服失败:" + ex.Message + " " + ex.StackTrace); } return(wxAutoComResponse.ResponseOK());; }
/// <summary> /// 联系客服 /// </summary> /// <param name="recMsg"></param> /// <returns></returns> public Result <string> ChatWithKf(PubReceiveMsgCData recMsg) { try { if (IsWorkTime() && IsIn5Min(recMsg.FromUserName) && IsKfMsg(recMsg)) { PubKfApi.SendTextMsg(recMsg.FromUserName, "正在为你转接在线客服,请稍后....."); var msg = PubMsgApi.BuildKfTransferMsg(recMsg.FromUserName, recMsg.ToUserName, recMsg.CreateTime); return(new Result <string> { IsSucc = true, Data = msg }); } } catch (Exception ex) { logHelper.Error("ChatWithKf:联系客服失败:" + ex.Message + " " + ex.StackTrace); } return(new Result <string> { Message = "联系客服失败!" }); }