以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 云MAS平台发送短信 post没有得到传出数据 麻烦老师帮忙看看是不是post出问题了 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=174145) |
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:cnsjroom -- 发布时间:2022/1/4 13:14:00 -- 云MAS平台发送短信 post没有得到传出数据 麻烦老师帮忙看看是不是post出问题了 云MAS平台发送短信 post没有得到传出数据 麻烦老师帮忙看看是不是post出问题了 以下内容是专门发给有点蓝浏览 当前代码如下: Dim jo As new jobject For Each c As Col In Tables("普通短信").cols jo(c.name) = cstr(Tables("普通短信").current(c.name)) Next Dim js As String =jo.Tostring() output.show("以下是json文件") output.show(js) Dim s As String = js Dim b As Byte() = System.Text.Encoding.UTF8.GetBytes(S) Dim base64 = Convert.ToBase64String(b) output.show("以下是Base64编码文件") output.show(base64) output.show("以下是utf8编码文件") Dim name1 As String=Functions.Execute("utf8",base64) output.show(name1) output.show("以下是post传入文件") Dim xmlRequest As String = name1 \'----post传入的内容 output.show(xmlRequest ) Dim xml As String = xmlRequest \'实例化一个字符转码对象\' Dim encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding("utf-8") \'创建一个web请求对象\' \'Dim request As System.Net.WebRequest = System.Net.WebRequest.Create("http://192.168.1.18:5566/services/RouteService?wsdl") \' ----webservice地址 Dim request As System.Net.WebRequest = System.Net.WebRequest.Create("http://112.35.1.155:1992/sms/norsubmit") \' ----webservice地址 \'设置请求方式为post\' request.Method = "POST" \'定义字节数组\' Dim postdata() As System.Byte = encoding.GetBytes(xmlRequest) \'设置request对象的请求字节的长度\' request.ContentLength = postdata.Length \'获取request对象的数据流\' Dim requesstream As System.IO.Stream = request.GetRequestStream() \'将数据内容填充到流中\' requesstream.Write(postdata, 0, postdata.Length) \'关闭流\' requesstream.Close() \'根据请求的request对象获取响应的response对象\' Dim response As System.Net.WebResponse = request.GetResponse() \'获取response数据流对象\' Dim responsestream As New System.IO.StreamReader(response.GetResponseStream()) \'将response流中的数据读取\' Dim html As String = responsestream.ReadToEnd() requesstream.Close() response.Close() \'返回本次请求的响应数据\' output.show("以下是post出文件") output.show(html) \' ----post传出内容 代码运行输入结果: 以下是json文件 { "ecName": "委员会", "apid": "waxjw", "secretKey": "lixiao@163.COM", "mobiles": "1588545", "content": "这是一条测试短信", "sign": "OqyMxu8s7", "addserial": "", "mac": "09d4647a0f93f2656360215608be2601" } 以下是Base64编码文件 ew0KICAiZWNOYW1lIjogIuS4reWFseeTruWuieWOv+e6quW+i+ajgOWvn+WnlOWRmOS8miIsDQogICJhcGlkIjogIndheGp3IiwNCiAgInNlY3JldEtleSI6ICJsaXhpYW9AMTYzLkNPTSIsDQogICJtb2JpbGVzIjogIjE1ODg1NDUwNzAxIiwNCiAgImNvbnRlbnQiOiAi6L+Z5piv5LiA5p2h5rWL6K+V55+t5L+hIiwNCiAgInNpZ24iOiAiT3F5TXh1OHM3IiwNCiAgImFkZHNlcmlhbCI6ICIiLA0KICAibWFjIjogIjA5ZDQ2NDdhMGY5M2YyNjU2MzYwMjE1NjA4YmUyNjAxIg0KfQ== 以下是utf8编码文件 ew0KICAiZWNOYW1lIjogIuS4reWFseeTruWuieWOv+e6quW+i+ajgOWvn+WnlOWRmOS8miIsDQogICJhcGlkIjogIndheGp3IiwNCiAgInNlY3JldEtleSI6ICJsaXhpYW9AMTYzLkNPTSIsDQogICJtb2JpbGVzIjogIjE1ODg1NDUwNzAxIiwNCiAgImNvbnRlbnQiOiAi6L+Z5piv5LiA5p2h5rWL6K+V55+t5L+hIiwNCiAgInNpZ24iOiAiT3F5TXh1OHM3IiwNCiAgImFkZHNlcmlhbCI6ICIiLA0KICAibWFjIjogIjA5ZDQ2NDdhMGY5M2YyNjU2MzYwMjE1NjA4YmUyNjAxIg0KfQ== 以下是post传入文件 ew0KICAiZWNOYW1lIjogIuS4reWFseeTruWuieWOv+e6quW+i+ajgOWvn+WnlOWRmOS8miIsDQogICJhcGlkIjogIndheGp3IiwNCiAgInNlY3JldEtleSI6ICJsaXhpYW9AMTYzLkNPTSIsDQogICJtb2JpbGVzIjogIjE1ODg1NDUwNzAxIiwNCiAgImNvbnRlbnQiOiAi6L+Z5piv5LiA5p2h5rWL6K+V55+t5L+hIiwNCiAgInNpZ24iOiAiT3F5TXh1OHM3IiwNCiAgImFkZHNlcmlhbCI6ICIiLA0KICAibWFjIjogIjA5ZDQ2NDdhMGY5M2YyNjU2MzYwMjE1NjA4YmUyNjAxIg0KfQ== 以下是post出文件 post传出数据没有值怎么解决? 接口文件帮助: <!--[if !supportLists]-->1) <!--[endif]-->业务功能HTTP客户端向云MAS平台发送短信任务请求,云MAS平台接收到请求后验证数据,验证通过将数据发送给短信网关。 <!--[if !supportLists]-->2) <!--[endif]-->数据传输<!--[if !supportLists]-->l <!--[endif]-->连接地址http://112.35.1.155:1992/sms/norsubmit *此地址仅供接口程序访问云MAS平台,浏览器无法访问。 <!--[if !supportLists]-->l <!--[endif]-->请求类型:JSON。 请求方式:POST。 数据编码方式:BASE64。
<!--[if !supportLists]-->l <!--[endif]-->响应
<!--[if !supportLists]-->l <!--[endif]-->示例请求 {"ecName":"政企分公司测试", "apId":"demo0", "mobiles":"13800138000", "content":"移动改变生活。", "sign":"DWItALe3A", "addSerial":"", "mac":"7997ddb079db2155b517b21b2a812370"} BASE64编码后: eyJjb250ZW50IjogIlx1NzlmYlx1NTJhOFx1NjUzOVx1NTNkOFx1NzUxZlx1NmQzYlx1MzAwMiIsICJzaWduIjogIkRXSXRBTGUzQSIsICJhcElkIjogImRlbW8wIiwgIm1hYyI6ICI3OTk3ZGRiMDc5ZGIyMTU1YjUxN2IyMWIyYTgxMjM3MCIsICJlY05hbWUiOiAiXHU2NTNmXHU0ZjAxXHU1MjA2XHU1MTZjXHU1M2Y4XHU2ZDRiXHU4YmQ1IiwgImFkZFNlcmlhbCI6ICIiLCAic2VjcmV0S2V5IjogIjEyM3F3ZSIsICJtb2JpbGVzIjogIjEzODAwMTM4MDAwIn0= 字符集为UTF-8。 [此贴子已经被作者于2022/1/4 13:19:55编辑过]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:有点蓝 -- 发布时间:2022/1/4 13:47:00 -- 测试提示
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:cnsjroom -- 发布时间:2022/1/4 14:24:00 -- 回复:(有点蓝)测试提示InvalidUsrOrPwd非法用户名/... 老师 验证部分已经成功 再请教你一下 mobiles这个一次性最大只能500个号码
有没有办法进行操作呢 大于500就自动拆分成多次操作 下面代码实现当获取的mobiles满足手机号等于11位时的不重复数据的输出,怎么实现判断指定mobiles不重复值大于500时候,就分第二次提交呢 或第三次提交 依次类推 且mobiles的值要形成如1,2,3,4,……格式 Dim Products As List(Of String) Products = DataTables("普通短信").GetValues("mobiles") For Each Product As String In Products If Product.Length=11 Then output.show(Product) End If Next |
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:有点蓝 -- 发布时间:2022/1/4 14:30:00 -- 参考这里获取用户信息的逻辑:http://www.foxtable.com/mobilehelp/topics/0185.htm |
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:cnsjroom -- 发布时间:2022/1/4 19:57:00 -- 回复:(有点蓝)参考这里获取用户信息的逻辑:http:/... Dim Products As List(Of String) Products = DataTables("联系名单").GetValues("电话") Dim t As Table=Tables("告知内容") Dim t1 As Table=Tables("普通短信") Dim Lst As New List(Of String) Dim Arys() As String For Each Product As String In Products If Product.Length=11 Then For i As Integer = 0 To Product.Count - 1 Dim ba As New Jarray \'准备用来获取用户信息的OpenId列表,一次不能超过100个 Lst.Add(Product) If Lst.Count = 3 OrElse i = Product.Count - 1 Then output.show(Product) t.AddNew t.Current("mobiles")=Product t1.addnew Dim tt As String tt = tt & Product & "," Dim tt1 As Integer=tt.LastIndexOf(",") t1.Current("mobiles")=tt.Remove(tt1 ,1) End If Next End If Next 参照老师的指导 还是没有得到要领 上述代码没有达到预期 输出得到的结果 12332113211 12332113211 12332113211 12332113211,12332113211 24242424242 12332113211,12332113211,24242424242 33143234234 12332113211,12332113211,24242424242,33143234234 34432123411 12332113211,12332113211,24242424242,33143234234,34432123411 34443224222 12332113211,12332113211,24242424242,33143234234,34432123411,34443224222 35434233421 12332113211,12332113211,24242424242,33143234234,34432123411,34443224222,35434233421 43243234242 12332113211,12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242 44224242424 12332113211,12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242,44224242424 45554423424 12332113211,12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242,44224242424,45554423424 64142342342 12332113211,12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242,44224242424,45554423424,64142342342 假定我现在联系名单里面有10个电话号码 我要实现循环获取不重复值 每次获取3个 组成1,2,3 然后赋值给普通短信表的mobiles列,并新增告知内容表三条对应记录,mobiles列值的等于三个中的一个 执行完毕之后再重新又获取余下的7个电话号码 循环执行完毕,直至10个电话号码都被执行完毕 程序暂停 普通短信表 mobiles列 (1,2,3) 告知内容表 mobiles列 (1) 告知内容表 mobiles列 (2) 告知内容表 mobiles列 (3) 普通短信表 mobiles列 (4,5,6) 告知内容表 mobiles列 (4) 告知内容表 mobiles列 (5) 告知内容表 mobiles列 (6) 普通短信表 mobiles列 (7,8,9) 告知内容表 mobiles列 (7) 告知内容表 mobiles列 (8) 告知内容表 mobiles列 (9) 普通短信表 mobiles列 (10) 告知内容表 mobiles列 (10) [此贴子已经被作者于2022/1/4 20:37:00编辑过]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:有点蓝 -- 发布时间:2022/1/4 20:33:00 -- Dim Products As new List(Of String) Products.AddRange({"1","2","3","4","5"}) Dim ba As New Jarray For i As Integer = 0 To Products.Count - 1 ba.Add(Products(i)) If ba.Count = 3 OrElse i = Products.Count - 1 Then output.show(ba.ToString()) ba = New Jarray End If Next |
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:cnsjroom -- 发布时间:2022/1/4 20:55:00 -- 回复:(有点蓝)Dim Products As new List(Of String... 还是没有得到要领 可能是我没有理解老师的思路 我当前弄成了如下: Dim Products As List(Of String) Products = DataTables("联系名单").GetValues("电话") Dim t As Table=Tables("告知内容") Dim t1 As Table=Tables("普通短信") For Each Product As String In Products If Product.Length=11 Then For i As Integer = 0 To Product.Count - 1 Dim ba As New Jarray \'准备用来获取用户信息的OpenId列表,一次不能超过100个 ba.Add(Product) If ba.Count = 3 OrElse i = Product.Count - 1 Then output.show(ba.ToString()) ba = New Jarray t.AddNew t.Current("mobiles")=Product t1.addnew Dim tt As String tt = tt & Product & "," Dim tt1 As Integer=tt.LastIndexOf(",") t1.Current("mobiles")=tt.Remove(tt1 ,1) End If Next End If Next 输出的结果 [ "12332113211" ] 12332113211 [ "24242424242" ] 12332113211,24242424242 [ "33143234234" ] 12332113211,24242424242,33143234234 [ "34432123411" ] 12332113211,24242424242,33143234234,34432123411 [ "34443224222" ] 12332113211,24242424242,33143234234,34432123411,34443224222 [ "35434233421" ] 12332113211,24242424242,33143234234,34432123411,34443224222,35434233421 [ "43243234242" ] 12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242 [ "44224242424" ] 12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242,44224242424 [ "45554423424" ] 12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242,44224242424,45554423424 [ "64142342342" ] 12332113211,24242424242,33143234234,34432123411,34443224222,35434233421,43243234242,44224242424,45554423424,64142342342 告知内容表实现了每一个号码新增一行 普通短信表也新增了十行 只想让系统生成红色部分的四条记录
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:cnsjroom -- 发布时间:2022/1/4 21:08:00 -- 回复:(有点蓝)Dim Products As new List(Of String... 老师的思路中怎么融入tels得到的值呢? Dim tels As List(Of String) tels = DataTables("联系名单").GetValues("电话") Dim Products As new List(Of String) Products.AddRange({"1","2","3","4","5"}) 这个部分怎么融入tels得到的值呢? Dim ba As New Jarray For i As Integer = 0 To Products.Count - 1 ba.Add(Products(i)) If ba.Count = 3 OrElse i = Products.Count - 1 Then output.show(ba.ToString()) ba = New Jarray End If Next
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:有点蓝 -- 发布时间:2022/1/4 21:12:00 -- Dim Products As List(Of String) = DataTables("联系名单").GetValues("电话") |
||||||||||||||||||||||||||||||||||||||||||||||||||||
-- 作者:cnsjroom -- 发布时间:2022/1/4 21:27:00 -- 回复:(有点蓝)Dim Products As List(Of String) =&... 老师 根据你的指导 现在代码完成如下 Dim t1 As Table=Tables("普通短信") Dim Products As List(Of String) = DataTables("联系名单").GetValues("电话") Dim ba As New Jarray Dim s As String For i As Integer = 0 To Products.Count - 1 ba.Add(Products(i)) If ba.Count = 3 OrElse i = Products.Count - 1 Then \'output.show(ba.ToString()) s=ba.ToString() s=s.Replace("""","") s=s.Replace("[","") s=s.Replace("]","") s=s.TrimStart s=s.TrimEnd output.show(s) ba = New Jarray \'t1.addnew \'t1.Current("mobiles")=s End If Next 输出值为 12332113211, 24242424242, 33143234234 34432123411, 34443224222, 35434233421 43243234242, 44224242424, 45554423424 64142342342 有没有简便的办法实现 如下效果一 12332113211,24242424242,33143234234 34432123411,34443224222,35434233421 43243234242, 44224242424, 45554423424 64142342342 如下效果二(根据效果一的每一行值 对应拆分成如下格式) 如效果一 12332113211,24242424242,33143234234 那效果二就拆分如下 12332113211 24242424242 33143234234 依次进行如下拆分 直到效果一没有数据为此 34432123411 34443224222 35434233421 43243234242 44224242424 45554423424 64142342342 [此贴子已经被作者于2022/1/4 21:30:57编辑过]
|