コード例 #1
0
ファイル: B_W_Tools.cs プロジェクト: wangqi0314/crm-tree
 /// <summary>
 /// 顾问通讯
 /// </summary>
 private void AdviserCommunicate()
 {
     if (IsServiceConnectExpire())
     {
         if (IsSelectSend())
         {
             _CS_OpenId = SelectCutomerOpenId();
         }
         B_W_CustomerServiceConnection.AddServiceConnection(new CT_Wechat_CustomerServiceConnection()
         {
             CSC_AD_OpenId         = _x.FromUserName,
             CSC_CS_OpenId         = _CS_OpenId,
             CSC_Connection_dt     = DateTime.Now,
             CSC_Connection_Status = 1
         });
         B_W_Fans      _b_fan = new B_W_Fans();
         CT_Wechat_Fan _fan   = _b_fan.GetFans(_x.FromUserName);
         wechatHandle.SendCustom_text(_CS_OpenId, "@" + _fan.WF_NickName + ":" + _x.Content);
         B_W_CustomSservice _b_custom = new B_W_CustomSservice();
         _b_custom.AddCustomSservice(new CT_Wechat_CustomSservice()
         {
             WCS_FromOpenId = _x.FromUserName, WCS_ToOpenId = _CS_OpenId, WCS_Content = _x.Content, WM_CreateTime = wechatHandle.GetLocalTime(Convert.ToInt64(_x.CreateTime))
         });
         _b_custom.AddCustomSservice(_x.FromUserName, _CS_OpenId, _x.Content, 1);
     }
     else
     {
         wechatHandle.SendCustom_text(_x.FromUserName, "没有客户跟你进行客服连接");
     }
 }
コード例 #2
0
ファイル: B_W_Tools.cs プロジェクト: wangqi0314/crm-tree
 /// <summary>
 /// 客户通讯
 /// </summary>
 private void CustomerCommunicate()
 {
     if (IsCustomConnectExpire())
     {
         B_W_CustomerServiceConnection.AddServiceConnection(new CT_Wechat_CustomerServiceConnection()
         {
             CSC_AD_OpenId         = _AD_OpenId,
             CSC_CS_OpenId         = _x.FromUserName,
             CSC_Connection_dt     = DateTime.Now,
             CSC_Connection_Status = 1
         });
         B_W_Fans      _b_fan = new B_W_Fans();
         CT_Wechat_Fan _fan   = _b_fan.GetFans(_x.FromUserName);
         wechatHandle.SendCustom_text(_AD_OpenId, "@" + _fan.WF_NickName + ":" + _x.Content);
         B_W_CustomSservice _b_custom = new B_W_CustomSservice();
         _b_custom.AddCustomSservice(new CT_Wechat_CustomSservice()
         {
             WCS_FromOpenId = _x.FromUserName, WCS_ToOpenId = _AD_OpenId, WCS_Content = _x.Content, WM_CreateTime = wechatHandle.GetLocalTime(Convert.ToInt64(_x.CreateTime))
         });
         _b_custom.AddCustomSservice(_AD_OpenId, _x.FromUserName, _x.Content, 0);
     }
     else
     {
         try
         {
             Convert.ToInt32(_x.Content);
             CT_Wechat_Member _M_s = B_W_CT_Member.GetMember(_x.Content, 2);
             if (_M_s == null)
             {
                 wechatHandle.SendCustom_text(_x.FromUserName, "请你先选择推荐的顾问,再进行通话。");
                 wechatHandle.SendCustom_text(_x.FromUserName, B_W_TextMessage.GetMessage());
             }
             else
             {
                 B_W_CustomerServiceConnection.AddServiceConnection(new CT_Wechat_CustomerServiceConnection()
                 {
                     CSC_AD_OpenId         = _M_s.MB_OpenID,
                     CSC_CS_OpenId         = _x.FromUserName,
                     CSC_Connection_dt     = DateTime.Now,
                     CSC_Connection_Status = 1
                 });
                 wechatHandle.SendCustom_text(_x.FromUserName, _M_s.AU_Name + ":正在等待你的问题");
             }
         }
         catch
         {
             wechatHandle.SendCustom_text(_x.FromUserName, "请你先选择顾问,再进行通话。否则,你的消息我们仅作留言处理,不能及时回复你。");
             wechatHandle.SendCustom_text(_x.FromUserName, B_W_TextMessage.GetMessage());
             AddTrack();
         }
     }
 }
コード例 #3
0
ファイル: B_W_Tools.cs プロジェクト: wangqi0314/crm-tree
            public static bool IsCustomConnectExpire(string CS_OpenId, int minute, out string OpenId)
            {
                CT_Wechat_CustomerServiceConnection _C = B_W_CustomerServiceConnection.GetServiceConnection(CS_OpenId, 2);

                if (_C == null)
                {
                    OpenId = null;
                    return(false);
                }
                if (_C.CSC_Connection_dt.AddMinutes(minute) < DateTime.Now)
                {
                    OpenId = null;
                    return(false);
                }
                OpenId = _C.CSC_AD_OpenId;
                return(true);
            }
コード例 #4
0
ファイル: B_W_Tools.cs プロジェクト: wangqi0314/crm-tree
            private string SelectCutomerOpenId()
            {
                IList <CT_Wechat_CustomerServiceConnection> _c_s = new B_W_CustomerServiceConnection().GetAdviserConnection(_x.FromUserName);

                if (_c_s == null)
                {
                    return("-1");
                }
                string cs_OpenId = "-1";

                for (int i = 0; i < _c_s.Count; i++)
                {
                    if (_x.Content.Contains(_c_s[i].WF_NickName))
                    {
                        cs_OpenId = _c_s[i].CSC_CS_OpenId;
                        break;
                    }
                }
                return(cs_OpenId);
            }