📄 msgrobot.asp
字号:
<%
Question=LCase(Question)
xh_mdb_server="/data/#Robot.mdb"
'随机数
Function gen_key(digits)
dim char_array(50)
char_array(0) = "0"
char_array(1) = "1"
char_array(2) = "2"
char_array(3) = "3"
char_array(4) = "4"
char_array(5) = "5"
char_array(6) = "6"
char_array(7) = "7"
char_array(8) = "8"
char_array(9) = "9"
randomize
do while len(output) < digits
num = char_array(Int((10 - 0 + 1) * Rnd + 0))
output = output + num
loop
gen_key=output
End Function
'获取关键字
Function AutoKey(strKey)
CONST lngSubKey=2
Dim lngLenKey,strNew,i,strSubKey
'AutoKey=""
lngLenKey=Len(strKey)
strNew=""
For i=1 To lngLenKey-(lngSubKey-1)
strSubKey=Mid(strKey,i,lngSubKey)
strNew=strNew&" or XH_Question like '%" & strSubKey & "%'"
Next
AutoKey="Select top 1 * from XH_Robot where XH_SendOk=0 and (XH_Question like '%" & strKey & "%' or XH_Question like '%" & strKey & "%'" &strNew&") order by rnd(-1*ID + time())"
End Function
dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath(""&xh_mdb_server&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs=server.createobject("adodb.recordset")
rs.open AutoKey(Question),conn,1,3
if rs.eof then
RobotMsg="无"
rs.addnew
rs("XH_Question")=Question
rs("xh_sendok")=1
rs.update
else
RobotMsg=rs("XH_Answer")
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -