Ejemplo n.º 1
0
		public static void LandingPageShouldReturnHtml( SpApi spApi )
		{
			var request = new RestRequest( spApi.GetApiPrefix(ApiType.WebApiRoot) );
			request.AddHeader( "Accept", "text/html" );
			var response = spApi.Execute( request );
			Assert.Equal( HttpStatusCode.OK, response.StatusCode );
			Assert.True( response.ContentType.StartsWith( "text/html" ) );
		}
Ejemplo n.º 2
0
		public static void LandingPageShouldContainSignedVendorId( SpApi spApi )
		{
			var request = new RestRequest( spApi.GetApiPrefix( ApiType.WebApiRoot ) );
			request.AddHeader( "Accept", "text/html" );
			var response = spApi.Execute( request );
			Assert.Equal( HttpStatusCode.OK, response.StatusCode );
			Assert.True( response.ContentType.StartsWith( "text/html" ) );

			HtmlDocument doc = new HtmlDocument();
			doc.LoadHtml( response.Content );
			var node = doc.DocumentNode.SelectSingleNode( "//span[@data-claimid='vendorid']" );
			Assert.NotNull( node );
			Assert.Contains( "bff714f1-3c88-40e7-9e78-a73c041ac8eb", node.InnerText );
		}
Ejemplo n.º 3
0
        /// <summary>
        /// 发送短信
        /// </summary>
        /// <param name="phone">手机号码</param>
        /// <param name="isAndroid">是否为安卓库</param>
        /// <param name="isFormalDataBase">是否为正式库</param>
        /// <returns></returns>
        public static RstArray SendMSG(string phone, string text)
        {
            //接口地址
            string methodUrl = "/cmc/sms/send";

            //初始化一信通SDK
            SpApi sdk = new SpApi();

            //企业编号
            sdk.SpCode = "280393";

            //用户名
            sdk.UserName = "******";

            //签名密钥
            sdk.Key = "3ddbe84d94509a2a30a91247d72539ae";

            //API地址
            sdk.ApiUrl = "https://api.ums86.com";

            //拼接参数
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("text", text);
            param.Add("sendObject", phone);


            //接收返回结果
            RstArray result_array = sdk.Api(methodUrl, param);

            return(result_array);
            //-----------------结果示例-------------------
            //  result_array.Msg={"taskId":"20042716244413580995","returnCode":"200","returnMsg":"成功","productId":"1"}
            //  result_array.Ret=0
            //
            //  返回码列表
            //
            //   200    成功
            //   499    服务错误
            //   1801   签名不合法
            //   1802   必填参数为空
            //   1803   接口服务未开通,账户无权限
            //   1804   频繁调用(同一接口同样的参数10分钟内连续调用超过5次会报此异常)
            //   1805   预约发送时间格式不正确,应为yyyyMMddHHmmss
            //   1806   含有无效的手机号码
            //   1807   Ip不合法
            //   1808   流水号格式不正确
            //   1809   流水号重复
            //   1810   余额不足
            //   1811   需要人工审核
            //   1812   发送内容与模板不符
            //   1813   发送内容含有禁止敏感词
            //   1814   同一号码相同内容发送次数太多
            //   1815   没有与充值流量相匹配的商品
            //   2801   系统错误
            //   2802   生成签名失败
            //   2803   账号或者密码错误
            //   3801   验密不通过
            //--------------------------------------------

            //结果转换成json并读取返回码 返回200则发送成功
            //   string returnCode = JObject.Parse(result_array.Msg)["returnCode"].ToString();
            //   return returnCode == "200" ? code : "";
        }