Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共9 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]使用weui开发的自建应用web页面怎么直接调用企业微信通信录?

1楼
YDS 发表于:2024/10/18 16:52:00
使用weui开发的自建应用web页面怎么直接调用企业微信通信录?求大佬指点。
2楼
有点蓝 发表于:2024/10/18 16:55:00
提交到后台通过接口调用:http://www.foxtable.com/mobilehelp/topics/0223.htm

如果要在前端使用js,可以调用jssdk:https://developer.work.weixin.qq.com/document/path/91793
3楼
YDS 发表于:2024/10/18 18:13:00
jssdk.js要怎么写,我一直不对。
4楼
YDS 发表于:2024/10/18 18:16:00
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
wb.Title = "员工选择"
wb.AppendHTML("<script src='https://res.wx.qq.com/open/js/jweixin-1.2.0.js'></script>", True) '引入JS-SDK库
wb.AppendHTML("<script src='./lib/jssdk.js'></script>") '引入脚本文件
'在页面注入权限验证配置
Dim st As New Date(1970, 1, 1, 8, 0, 0)
Dim appid As String = "appid"
Dim timestamp As Integer = CInt((Date.Now - st).TotalSeconds()) '时间戳
Dim noncestr As String = Rand.NextString(16) '随机字符
Dim url As String = "ryxz.htm" '当前页面地址
Dim signature As String = Functions.Execute("GetJsSignature", noncestr, timestamp, url) '生成权限验证签名
Dim cfg As String = "wx.config({appId:'{0}',timestamp:{1},nonceStr:'{2}',signature:'{3}',jsApiList:['invoke']});"
wb.AppendHTML("<script>" & CExp(cfg, appid, timestamp, noncestr, signature) & "</script>", True)
'开始正常生成网页内容
wb.AddForm("", "form1", "ryxz.htm")
With wb.AddInputGroup("form1", "ipg1", "人员选择")
    With .AddInputCell("ic1")
        .AddLabel("lry", "人员", 0)
        .AddInput("sry", "text", 1)
        .AddVcodeButton("ryxz", "人员选择", 2) 
    End With
End With
With wb.AddButtonGroup("form1", "btg1", True)
    .Add("btn1", "确定", "submit")
End With
e.WriteString(wb.Build) '生成网页
5楼
有点蓝 发表于:2024/10/19 8:47:00
参考:http://www.foxtable.com/mobilehelp/topics/0248.htm
6楼
YDS 发表于:2024/10/25 9:52:00
index代码:
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
wb.Title = "会议系统"
wb.AppendHTML("<script src='http://res.wx.qq.com/open/js/jweixin-1.2.0.js'></script>", True) '引入JS-SDK库
wb.AppendHTML("<script src='./lib/jssdk.js'></script>") '引入脚本文件
'在页面注入权限验证配置
Dim st As New Date(1970, 1, 1, 8, 0, 0)
Dim appid As String = Functions.Execute("Get", "企业微信", 0) 'CorpID
Dim timestamp As Integer = CInt((Date.Now - st).TotalSeconds()) '时间戳
Dim noncestr As String = Rand.NextString(16) '随机字符
Dim url As String = e.Request.URL.ToString '当前页面地址
Dim signature As String = Functions.Execute("GetJsSignature", noncestr, timestamp, url) '生成权限验证签名
Dim cfg As String = "wx.config({beta: true, appId:'{0}',timestamp:{1},nonceStr:'{2}',signature:'{3}',jsApiList:['selectEnterpriseContact']});"
wb.AppendHTML("<script>" & CExp(cfg, appid, timestamp, noncestr, signature) & "</script>", True)
'开始正常生成网页内容
wb.AddForm("", "form1", "index.htm")
With wb.AddInputGroup("form1", "ipg1", "参会人员")
    With .AddInputCell("ic1")
        .AddLabel("lbh", "参会人员", 0)
        .AddVcodeButton("ryxz", "打开通信录选择人员", 1) '增加人员选择按钮,2表示显示在右边
    End With
    .AddTextArea("chry", 5).Placeholder = "您也可以直接输入参会人员!"
End With
With wb.AddButtonGroup("form1", "btg1", True)
    .Add("btn1", "确定", "submit")
End With
With wb.AddPageFooter("", "pf1", "Copyright &copy; " & Date.Today.Year & " " & Functions.Execute("Get", "公司信息", 3).split(".")(Functions.Execute("Get", "公司信息", 3).split(".").Length - 2) & "." & Functions.Execute("Get", "公司信息", 3).split(".")(Functions.Execute("Get", "公司信息", 3).split(".").Length - 1))
    .AddLink(Functions.Execute("Get", "公司信息", 0), Functions.Execute("Get", "公司信息", 3))
End With
e.WriteString(wb.Build) '生成网页

GetJsSignature代码:
Static CreateTime As Date '记录最近一次生成Ticket 的时间
Static Ticket As String '记录最近一次生成的Ticket
Dim tp As TimeSpan = Date.Now - CreateTime
Dim ul As String = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token={0}"
If tp.TotalSeconds > 3600 Then
    Dim hc As New HttpClient(CExp(ul, Functions.Execute("GetQYAccessToken")))
    Dim ret As String = hc.GetData()
    If ret = "" Then '如果失败,再尝试一次
        hc.GetData()
    End If
    CreateTime = Date.Now()
    Dim jo As JObject = JObject.Parse(ret)
    If jo("errcode") = "0" Then
        Ticket = jo("ticket")
    Else
        Dim errmsg As String = "内部函数【GetJsSignature】反馈,获取jsapi_ticket失败的原因是:" & jo.ToString
        Functions.Execute("ErrMsg", errmsg)
    End If
End If
Dim signature As String = CExp("jsapi_ticket={0}&noncestr={1}&timestamp={2}&url={3}", Ticket, args(0), args(1), args(2))
Return Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(signature, "SHA1").ToLower()

jssdk.js代码:

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20241025095057.png
图片点击可在新窗口打开查看


请老师帮忙看一下,究竟是哪里出错了!
7楼
有点蓝 发表于:2024/10/25 9:59:00
什么地方有问题?
8楼
YDS 发表于:2024/10/25 11:09:00
1.Dim url As String = e.Request.URL.ToString '当前页面地址
这里获取的网址带端口,我服务器有反代的,所以签名老是出问题
2、企业微信选人后的名字是备注名,我需要用户名。
9楼
有点蓝 发表于:2024/10/25 11:17:00
1、这个要去反代里设置,返回正确的地址

2、这个自行看看微信文档,有就能用,没有也没有办法
共9 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02734 s, 2 queries.