<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
|
<%Session.CodePage=65001%>
|
<!--#include file="JsonPost_user.gds"-->
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<%
|
'获取成员 Https请求方式: GET
|
|
Set rs = Server.CreateObject("ADODB.Recordset")
|
OA_UserID = trim(Request("OA_UserID"))
|
If OA_UserID="" Then Response.Redirect "/"
|
sql="select OA_weixinUserID from OA_User where OA_weixinUserID<>'' and OA_User_ID="&OA_UserID
|
rs.open sql,objConn,1,1
|
if not rs.Eof Then
|
OA_weixinUserID = rs("OA_weixinUserID")
|
Else
|
Response.Redirect "/AdminUser.gds?userID="&OA_UserID&"&h_menu1_1="&session("h_menu1_1")&"&SystemMessageType=4&SMT=2"
|
End If
|
rs.close()
|
|
appUrl="https://qyapi.weixin.qq.com/cgi-bin/user/get"
|
|
method="user_get"
|
Origin="access_token="&access_token&"&userid="&OA_weixinUserID
|
|
'Response.Write Origin &"<BR>"
|
|
HTMLCODE= GetBody(appUrl,Origin)
|
'Response.Write HTMLCODE&"<br><br>"
|
'Response.End
|
|
JsonID=""
|
If Mid(HTMLCODE,12,1)<>"0" Then
|
Response.Write HTMLCODE
|
Response.End
|
Else
|
'结果写入数据库
|
reserve=OA_UserID
|
JsonID = API_JsonSql(method,HTMLCODE,reserve)
|
End If
|
|
|
|
|
If JsonID<>"" Then
|
%>
|
<script language="JScript" runat="Server">
|
function toObject(json) {
|
eval("var o=" + json);
|
return o;
|
}
|
function toArray(s){
|
var dic = Server.CreateObject("Scripting.Dictionary")
|
eval("var a=" + json);
|
for(var i=0;i<a.length;i++){
|
var obj = Server.CreateObject("Scripting.Dictionary")
|
for(x in a[i]) obj.Add(x,a[i][x])
|
dic.Add(i, obj);
|
}
|
return dic
|
}
|
</script>
|
<script language="jscript" runat="server">
|
Array.prototype.get = function(i)
|
{
|
return this[i];
|
};
|
function getjson(str){
|
try{
|
eval("var jsonStr = (" + str + ")");
|
}catch(ex){
|
var jsonStr = null;
|
}
|
return jsonStr;
|
}
|
</script>
|
<%
|
str=HTMLCODE
|
dim obj
|
set obj = getjson(str)
|
OA_weixinUserID = obj.userid '成员UserID。对应管理端的帐号
|
OA_Name = obj.name '成员名称
|
departmentIDs = obj.department '部门信息
|
If departmentIDs<>"" Then
|
departmentIDsSP = SPLIT(departmentIDs,",")
|
If departmentIDsSP(0)="185" And UBOUND(departmentIDsSP)>0 Then
|
departmentID = departmentIDsSP(1)
|
Else
|
departmentID = departmentIDsSP(0)
|
End If
|
|
Else
|
departmentID = 0
|
End If
|
OA_Position = obj.position '职位信息
|
OA_mobile = obj.mobile '手机号码
|
OA_gender = obj.gender '性别。0表示未定义,1表示男性,2表示女性
|
OA_email = obj.email '邮箱
|
'OA_weixinID = obj.weixinid '微信号
|
OA_weixinAvatar = Replace(obj.avatar,"\/","\") '头像url。注:如果要获取小图将url最后的
|
OA_weixinStatus = obj.status '关注状态: 1=已关注,2=已冻结,4=未关注
|
OA_IdentityCard = ""
|
for v=0 to obj.extattr.attrs.length-1
|
If obj.extattr.attrs.get(v).name="身份证" Then
|
OA_IdentityCard=obj.extattr.attrs.get(v).value
|
End If
|
Next
|
'Response.Write OA_IdentityCard&"<br><br>"
|
'Response.End
|
|
'更新库存数据
|
If OA_weixinUserID<>"" And OA_Name<>"" And OA_UserID<>"" Then
|
sql="select OA_User_ID from OA_User where OA_weixinUserID='"&OA_weixinUserID&"'"
|
rs.open sql,objConn,1,1
|
If OA_weixinStatus=2 Then
|
OA_execLevel=-1
|
Else
|
OA_execLevel=1
|
End if
|
if not rs.Eof then
|
OA_User_ID = rs("OA_User_ID")
|
If OA_execLevel=-1 Then
|
execLevelSql=",OA_execLevel=-1 "
|
Else
|
execLevelSql=""
|
End if
|
sql="update OA_User set OA_Name='"&OA_Name&"',OA_Position='"&OA_Position&"',OA_mobile='"&OA_mobile&"',OA_gender="&OA_gender&",OA_email='"&OA_email&"',OA_weixinID='"&OA_weixinID&"',OA_weixinAvatar='"&OA_weixinAvatar&"',OA_IdentityCard='"&OA_IdentityCard&"',OA_weixinStatus="&OA_weixinStatus&",OA_DepartmentID="&departmentID&",OA_DepartmentIDs='"&departmentIDs&"'"&execLevelSql&" where OA_User_ID="&OA_User_ID
|
objConn.Execute sql
|
Else
|
sql="Insert into OA_User (OA_User,OA_Pass,OA_weixinUserID,OA_Name,OA_Position,OA_mobile,OA_gender,OA_email,OA_weixinID,OA_weixinAvatar,OA_IdentityCard,OA_weixinStatus,OA_execLevel,OA_DepartmentID,OA_DepartmentIDs) values ('"&OA_weixinUserID&"',pwdencrypt('000000'),'"&OA_weixinUserID&"','"&OA_Name&"','"&OA_Position&"','"&OA_mobile&"',"&OA_gender&",'"&OA_email&"','"&OA_weixinID&"','"&OA_weixinAvatar&"','"&OA_IdentityCard&"',"&OA_weixinStatus&","&OA_execLevel&","&departmentID&",'"&departmentIDs&"')"
|
objConn.Execute sql
|
end If
|
rs.close()
|
Sum_I=Sum_I+1
|
End if
|
sql="update API_Json set is_Json=is_Json+1,is_Json_time=getdate() where id="&JsonID
|
objConn.Execute sql
|
End if
|
Response.Redirect "/AdminUser.gds?userID="&OA_UserID&"&h_menu1_1="&session("h_menu1_1")&"&SystemMessageType=3&SMT=5"
|
|
%>
|