<% IP=GetIP Act = Request.QueryString("act") If Act = "logout" Then conn.execute("insert into logRecord (loginName,loginTime,loginAct) values ('"&Session("employee_name")&"','"&now()&"','"&Session("employee_name")&" "&now()&"从"&IP&"退出系统')") Session.Contents.Remove("employee_id") Session.Contents.Remove("employee_name") Session.Contents.Remove("t") Session.Contents.Remove("t1") Session.Contents.Remove("t2") Session.Contents.Remove("t3") Session.Contents.Remove("t4") Session.Contents.Remove("d1") Session.Contents.Remove("d2") End If Session.Contents.Remove("employee_id") If Act = "login" Then loginuser=TextEncode(Request.Form("loginuser")) loginpwd=TextEncode(Request.Form("loginpwd")) logincode=Request.Form("logincode") If loginuser="" Then Response.Write "1":Conn.Close:Set Conn=Nothing:Response.End If loginpwd="" Then Response.Write "2":Conn.Close:Set Conn=Nothing:Response.End If logincode<>Session("zengscode") Then Response.Write "3":Conn.Close:Set Conn=Nothing:Response.End Set Rs=Server.CreateObject("ADODB.RecordSet") Rs.Open "Select id,em_user,em_password,em_role,em_code,em_email,em_tel,lastIp from employee Where em_user='"&loginuser&"'",conn,1,3 If Rs.Recordcount=0 Then Response.Write "4":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End If Rs("em_password")<>MD5(loginpwd) Then Response.Write "5":Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing:Response.End Session("employee_id")=Cint(Rs("id")) Session("employee_name")=Rs("em_user") Response.Write "7" Rs("lastIp")=GetIp()'记录登陆IP Rs.update Rs.Close BackToSeaStr="select id,cs_updatetime,cs_claimdate,cs_claimFrom,cs_chain from customer where cs_claimFrom<>'' and cs_claimdate>'2023-01-01' and cs_deal<>3 and cs_belong="&Session("employee_id") Rs.Open BackToSeaStr,conn,3,1 Do while Not Rs.bof And not Rs.eof If DATEDIFF("d",Rs("cs_claimdate"),now())>4 and DATEDIFF("s",Rs("cs_updatetime"),Rs("cs_claimdate"))=0 Then '已经认领但是认领后无更新 myArray=split(Rs("cs_chain"),",") myLen=UBound(myArray) Litem=myArray(myLen) IF Litem+0=Rs("cs_claimFrom")+0 Then cs_chain=Rs("cs_claimFrom") Else cs_chain=Rs("cs_chain")&","&Rs("cs_claimFrom") End If updatestr="update customer set cs_belong="&Rs("cs_claimFrom")&" ,cs_chain='"&cs_chain&"' where id="&Rs("id") conn.execute(updatestr) ElseIf DATEDIFF("s",Rs("cs_claimdate"),Rs("cs_updatetime"))>0 Then '认领后更新,不参与判断 updatestr="update customer set cs_claimdate='2022-12-31' where id="&Rs("id") conn.execute(updatestr) End If Rs.moveNext Loop Rs.close Rs.Open "Select count(id) from customer where cs_belong="&Session("employee_id"),conn,1,1 Session("t")=Rs(0) Rs.close Rs.Open "Select count(id) from customer where cs_type=1 and cs_belong="&Session("employee_id"),conn,1,1 Session("t1")=Rs(0) Rs.close Rs.Open "Select count(id) from customer where cs_type=2 and cs_belong="&Session("employee_id"),conn,1,1 Session("t2")=Rs(0) Rs.close Rs.Open "Select count(id) from customer where cs_type=3 and cs_belong="&Session("employee_id"),conn,1,1 Session("t3")=Rs(0) Rs.close Rs.Open "Select count(id) from customer where cs_type=4 and cs_belong="&Session("employee_id"),conn,1,1 Session("t4")=Rs(0) Rs.close Rs.Open "Select count(id) from customer where cs_deal=3 and cs_belong="&Session("employee_id"),conn,1,1 Session("d1")=Rs(0) Rs.close Rs.Open "Select count(id) from customer where cs_deal=2 and cs_belong="&Session("employee_id"),conn,1,1 Session("d2")=Rs(0) Rs.close Rs.Open "Select count(id) from customer where DATEDIFF(DAY,cs_updatetime,getdate())>120 and cs_belong="&Session("employee_id"),conn,1,1 Session("d3")=Rs(0) Rs.close Set Rs=Nothing conn.execute("insert into logRecord (loginName,loginTime,loginAct) values ('"&Session("employee_name")&"','"&now()&"','"&Session("employee_name")&" "&now()&"从"&IP&"登录')") Conn.Close:Set Conn=Nothing:Response.End Response.End End If %>