Exemplo n.º 1
0
        /// <summary>
        /// 发送短信接口
        /// </summary>
        /// <param name="content"></param>
        /// <param name="numbers"></param>
        /// <param name="priority"></param>
        /// <returns></returns>
        public static bool SendSMS(string content, string[] numbers, int priority = 5)
        {
            //获取短信接口的序列号,和自定义Key
            string SerialNo = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_SerialNo");
            string Key      = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_Key");

            if (String.IsNullOrWhiteSpace(SerialNo) || String.IsNullOrWhiteSpace(Key))
            {
                LogHelp.AddErrorLog("亿美短信接口缺少企业序列号或者自定义关键字Key", "亿美短信接口调用失败", HttpContext.Current.Request);
                return(false);
            }
            SMSService.SDKClient sdkClient  = new SDKClientClient();
            sendSMSRequest       smsRequest = new sendSMSRequest();

            smsRequest.arg0 = SerialNo;
            smsRequest.arg1 = Key;
            smsRequest.arg3 = numbers;
            smsRequest.arg4 = YSWL.Common.Globals.HtmlEncode(content);
            smsRequest.arg7 = priority;
            sendSMSResponse smsResponse = sdkClient.sendSMS(smsRequest);

            if (smsResponse.@return == 0)
            {
                return(true);
            }
            string msg = SendSMSException(smsResponse.@return);

            LogHelp.AddErrorLog("亿美短信接口发送短信出现异常,【" + msg + "】,错误码【" + smsResponse.@return + "】", "亿美短信接口调用失败", HttpContext.Current.Request);
            return(false);
        }
Exemplo n.º 2
0
    public sendSMS_Resp sendSMS(sendSMS_Req sendSMS_Req)
    {
        sendSMSRequest inValue = new sendSMSRequest();

        inValue.sendSMS_Req = sendSMS_Req;
        sendSMSResponse retVal = ((MobileMKTAdaptorSoap)(this)).sendSMS(inValue);

        return(retVal.sendSMS_Resp);
    }