예제 #1
0
 /// <summary>
 /// 【异步方法】小程序申诉记录推送
 /// </summary>
 /// <param name="requestMessage"></param>
 /// <returns></returns>
 public virtual async Task <IResponseMessageBase> OnEvent_AppealRecordRequestAsync(RequestMessageEvent_AppealRecord requestMessage)
 {
     return(await DefaultAsyncMethod(requestMessage, () => OnEvent_AppealRecordRequest(requestMessage)).ConfigureAwait(false));
 }
        /// <summary>
        /// 获取请求消息和实体之间的映射结果
        /// </summary>
        /// <param name="requestMsgType"></param>
        /// <returns></returns>
        public override IRequestMessageBase GetRequestEntityMappingResult(RequestMsgType requestMsgType, XDocument doc = null)
        {
            RequestMessageBase requestMessage;

            switch (requestMsgType)
            {
            case RequestMsgType.Text:
                requestMessage = new RequestMessageText();
                break;

            case RequestMsgType.Image:
                requestMessage = new RequestMessageImage();
                break;

            case RequestMsgType.MiniProgramPage:    //小程序页面
                requestMessage = new RequestMessageMiniProgramPage();
                break;

            case RequestMsgType.NeuChar:
                requestMessage = new RequestMessageNeuChar();
                break;

            case RequestMsgType.Event:
                //判断Event类型
                switch (doc.Root.Element("Event").Value.ToUpper())
                {
                case "USER_ENTER_TEMPSESSION":        //进入客服会话
                    requestMessage = new RequestMessageEvent_UserEnterTempSession();
                    break;

                case "WEAPP_AUDIT_SUCCESS":         //小程序审核成功
                    requestMessage = new RequestMessageEvent_WeAppAuditSuccess();
                    break;

                case "WEAPP_AUDIT_FAIL":         //小程序审核失败
                    requestMessage = new RequestMessageEvent_WeAppAuditFail();
                    break;

                case "WEAPP_AUDIT_DELAY":         //小程序审核延后
                    requestMessage = new RequestMessageEvent_WeAppAuditDelay();
                    break;

                case "WXA_NICKNAME_AUDIT":         //名称审核结果
                    requestMessage = new RequestMessageEvent_NicknameAudit();
                    break;

                case "WXA_ILLEGAL_RECORD":         //小程序违规记录事件
                    requestMessage = new RequestMessageEvent_IllegalRecord();
                    break;

                case "WXA_APPEAL_RECORD":         //小程序申诉记录推送
                    requestMessage = new RequestMessageEvent_AppealRecord();
                    break;

                case "WXA_PRIVACY_APPLY":         //隐私权限审核结果推送
                    requestMessage = new RequestMessageEvent_PrivacyApply();
                    break;

                default:        //其他意外类型(也可以选择抛出异常)
                    requestMessage = new RequestMessageEventBase();
                    break;
                }
                break;

            default:
                throw new UnknownRequestMsgTypeException(string.Format("MsgType:{0} 在RequestMessageFactory中没有对应的处理程序!", requestMsgType), new ArgumentOutOfRangeException());    //为了能够对类型变动最大程度容错(如微信目前还可以对公众账号suscribe等未知类型,但API没有开放),建议在使用的时候catch这个异常
            }
            return(requestMessage);
        }
예제 #3
0
 /// <summary>
 /// 小程序申诉记录推送
 /// </summary>
 /// <param name="requestMessage"></param>
 /// <returns></returns>
 public virtual IResponseMessageBase OnEvent_AppealRecordRequest(RequestMessageEvent_AppealRecord requestMessage)
 {
     return(DefaultResponseMessage(requestMessage));
 }