?? logic_sms.asp
字號(hào):
<%
''===================================================================
'= ASP FILENAME : /inc/logic/logic_sms.asp
'= CREATED TIME : 2006-5-7
'= LAST MODIFIED: 2006-5-7
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION : 站內(nèi)短信
'= Change Log:
'==================================================================='
%>
<%
'== Const define
'== 短信閱讀狀態(tài)
Const CONST_SMS_VIEWED_FLAG = 1 '== 已閱讀
Const CONST_SMS_VIEW_FLAG = 0 '== 未閱讀
''===================================================================
'= Function : GetSmsesLogic()
'= Time : Created At 2006-5-7
'= Input : intUserId : 用戶 ID
'= Input : strFlag : InBox--收件箱;OutBox--發(fā)件箱;IsSend--已發(fā)送;RecycleBox--回收站;
'= Return : boolean
'= Description : 取得用戶短信
'==================================================================='
Function GetSmsesLogic(intUserId,strFlag)
Dim strWhere
Select Case strFlag
Case "InBox" :
strWhere = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_SEND_FLAG=1 AND SMS_DEL_INCEPT=0"
Case "OutBox" :
strWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_SEND_FLAG=0 AND SMS_DEL_SEND=0"
Case "IsSend" :
strWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_SEND_FLAG=1 AND SMS_DEL_SEND=0"
Case "RecycleBox" :
strWhere = "((SMS_SENDER_ID=" & intUserId & " AND SMS_DEL_SEND=1) OR (SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_INCEPT=1)) AND NOT SMS_DEL_SEND=2"
Case Else
strWhere = "SMS_INCEPTER_ID="& intUserId &" AND SMS_SEND_FLAG=1 AND SMS_DEL_INCEPT=0"
End Select
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "*",""
GBL_objPubDB.Order = "SMS_ID DESC"
GBL_objPubDB.Where = strWhere
If Not GBL_objPubDB.SQLRSExecute() Then
GetSmsesLogic = False
Exit Function
End If
GetSmsesLogic = True
End Function
''===================================================================
'= Function : GetUserSmsInfoLogic()
'= Time : Created At 2006-5-7
'= Input : intUserId : 用戶 ID
'= Output : strSmsInfo : 用戶 sms 信息
'= Return : boolean
'= Description : 取得用戶短信信息
'==================================================================='
Function GetUserSmsInfoLogic(intUserId,ByRef strSmsInfo)
Dim strHtmlCode
Dim intInNum,intNoViewNum,intOutNum,intRecycleNum,intSendNum
'== Get inbox all information
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "SMS_ID",""
GBL_objPubDB.Where = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_SEND=0 AND SMS_SEND_FLAG=1"
If Not GBL_objPubDB.SQLRSExecute() Then
GetUserSmsInfoLogic = False
Exit Function
End If
intInNum = GBL_objPubDB.intRSNum
'== Get intbox all no view information
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "SMS_ID",""
GBL_objPubDB.Where = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_SEND=0 AND SMS_SEND_FLAG=1 AND SMS_VIEW_FLAG=0"
If Not GBL_objPubDB.SQLRSExecute() Then
GetUserSmsInfoLogic = False
Exit Function
End If
intNoViewNum = GBL_objPubDB.intRSNum
'== Get outbox all information
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "SMS_ID",""
GBL_objPubDB.Where = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_SEND=0 AND SMS_SEND_FLAG=0 AND SMS_VIEW_FLAG=0"
If Not GBL_objPubDB.SQLRSExecute() Then
GetUserSmsInfoLogic = False
Exit Function
End If
intOutNum = GBL_objPubDB.intRSNum
'== Get recycle all information
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "SMS_ID",""
GBL_objPubDB.Where = "((SMS_SENDER_ID=" & intUserId & " AND SMS_DEL_SEND=1) OR (SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_INCEPT=1)) AND NOT SMS_DEL_SEND=2"
If Not GBL_objPubDB.SQLRSExecute() Then
GetUserSmsInfoLogic = False
Exit Function
End If
intRecycleNum = GBL_objPubDB.intRSNum
'== Get send all information
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "SMS_ID",""
GBL_objPubDB.Where = "SMS_SENDER_ID=" & intUserId & " AND SMS_SEND_FLAG=1 AND SMS_DEL_SEND=0"
If Not GBL_objPubDB.SQLRSExecute() Then
GetUserSmsInfoLogic = False
Exit Function
End If
intSendNum = GBL_objPubDB.intRSNum
strHtmlCode = "目前您收到" & intInNum & "條短信,其中" & intNoViewNum & "條未讀,有" & intOutNum & "條未發(fā)送,已發(fā)送" & intSendNum & "條,垃圾箱里有" & intRecycleNum & "條"
strSmsInfo = strHtmlCode
GetUserSmsInfoLogic = True
End Function
''===================================================================
'= Function : GetNowSmsSizeLogic()
'= Time : Created At 2006-5-7
'= Input : intUserId : 用戶 ID
'= Output : strFlag : 返回用戶 sms 信息
'= Return : boolean
'= Description : 取得用戶短信容量信息
'==================================================================='
Function GetNowSmsSizeLogic(intUserId,strFlag,ByRef strSmsSizeInfo,ByRef intSmsSize)
Dim strWhere
Select Case strFlag
Case "InBox" :
strWhere = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_SEND_FLAG=1 AND SMS_DEL_INCEPT=0"
Case "OutBox" :
strWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_SEND_FLAG=0 AND SMS_DEL_SEND=0"
Case "IsSend" :
strWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_SEND_FLAG=1 AND SMS_DEL_SEND=0"
Case "RecycleBox" :
strWhere = "((SMS_SENDER_ID=" & intUserId & " AND SMS_DEL_SEND=1) OR (SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_INCEPT=1)) AND NOT SMS_DEL_SEND=2"
Case Else
strWhere = "SMS_INCEPTER_ID="& intUserId &" AND SMS_SEND_FLAG=1 AND SMS_DEL_INCEPT=0"
End Select
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "SUM(SMS_SIZE)",""
GBL_objPubDB.Where = strWhere
If Not GBL_objPubDB.SQLRSExecute() Then
GetNowSmsSizeLogic = False
Exit Function
End If
If IsNumeric(GBL_intSmsMaxSize) Then
If GBL_intSmsMaxSize > 0 Then
intSmsSize = (GBL_objPubDB.objPubRS(0) / GBL_intSmsMaxSize) * 100
intSmsSize = strSmsSizeInfo & "%"
ElseIf GBL_intSmsMaxSize = 0 Then
intSmsSize = "的短信容量無限制"
Else
intSmsSize = "???"
End If
Else
intSmsSize = "???"
End If
If GBL_intSmsMaxSize <= GBL_objPubDB.objPubRS(0) And GBL_intSmsMaxSize <> 0 Then
strSmsSizeInfo = "Over"
Else
strSmsSizeInfo = "No"
End If
GetNowSmsSizeLogic = True
End Function
''===================================================================
'= Function : GetSmsLogic
'= Time : Created At 2006-5-7
'= Input : intSmsId : SMS ID
'= Input : intUserId : 用戶 ID
'= Return : boolean
'= Description : 取得用戶短信
'==================================================================='
Function GetSmsLogic(intUserId,intSmsId)
Dim strSql
'== 限定用戶條件
strSql = " AND (SMS_INCEPTER_ID = " & intUserId & " OR SMS_SENDER_ID = " & intUserId & ")"
'== 取記錄
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.Where = "SMS_ID=" & intSmsId & strSql
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "*",""
If Not GBL_objPubDB.SQLRSExecute() Then
GetSmsLogic = False
Exit Function
End If
GetSmsLogic = True
End Function
''===================================================================
'= Function : SaveSmsViewFlagLogic
'= Time : Created At 2006-5-7
'= Input : intSmsId : SMS ID
'= Input : intUserId : 用戶 ID
'= Return : boolean
'= Description : 更新用戶短信閱讀狀態(tài)
'==================================================================='
Function SaveSmsViewFlagLogic(intUserId,intSmsId)
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "UPDATE"
GBL_objPubDB.AddField "SMS_VIEW_FLAG",CONST_SMS_VIEWED_FLAG
GBL_objPubDB.Where = "SMS_ID=" & intSmsId & " AND SMS_INCEPTER_ID=" & intUserId & " And SMS_SEND_FLAG=1 AND SMS_DEL_INCEPT=0 AND SMS_VIEW_FLAG=" & CONST_SMS_VIEW_FLAG
If Not GBL_objPubDB.SQLRSExecute() Then
SaveSmsViewFlagLogic = False
Exit Function
End If
SaveSmsViewFlagLogic = True
End Function
''===================================================================
'= Function : SaveSmsLogic
'= Time : Created At 2006-5-8
'= Input : intUserId : 用戶 ID
'= Input : intIncepterId : 接受者
'= Input : objFormData : 表單數(shù)據(jù)
'= Return : boolean
'= Description : 保存短信
'==================================================================='
Function SaveSmsLogic(intUserId,intIncepterId,objFormData)
Dim strIncepter
'== 取得接收者name
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_USER"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "USER_REALNAME", now()
GBL_objPubDB.Where = " USER_ID=" & intIncepterId
If Not GBL_objPubDB.SQLRSExecute() Then
SaveSmsLogic = False
Exit Function
End If
strIncepter = GBL_objPubDB.objPubRS("USER_REALNAME")
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = "INSERT"
GBL_objPubDB.AddField "SMS_TIME", now()
GBL_objPubDB.AddField "SMS_SENDER", GBL_strUserRealName
GBL_objPubDB.AddField "SMS_SENDER_ID", intUserId
GBL_objPubDB.AddField "SMS_INCEPTER", strIncepter
GBL_objPubDB.AddField "SMS_INCEPTER_ID", intIncepterId
GBL_objPubDB.AddField "SMS_TITLE", objFormData.Item("Title")
GBL_objPubDB.AddField "SMS_CONTENT", HtmlenCode2(objFormData.Item("Content"))
GBL_objPubDB.AddField "SMS_SIZE", Len(Trim(objFormData.Item("Content")))
GBL_objPubDB.AddField "SMS_VIEW_FLAG", "0"
GBL_objPubDB.AddField "SMS_SEND_FLAG", "1"
GBL_objPubDB.AddField "SMS_DEL_SEND", "0"
GBL_objPubDB.AddField "SMS_DEL_INCEPT", "0"
If Not GBL_objPubDB.SQLExecute() Then
SaveSmsLogic = False
Exit Function
End If
SaveSmsLogic = True
End Function
''===================================================================
'= Function : RemoveSmsesLogic
'= Time : Created At 2006-5-8
'= Input : intUserId
'= Input : strIds : 記錄ID集
'= Input : objFormData : 表單數(shù)據(jù)
'= Return : boolean
'= Description : 刪除短信
'==================================================================='
Function RemoveSmsesLogic(intUserId,strIds,objFormData)
Dim GetRSId,arrTmp,strDelWhere,strSetValue,strSQLType,strActType,strAddInfo,i,strDelClew,strAddWhere
GetRSId = strIds
arrTmp = Split(GetRSId,",")
strAddInfo = "該短信記錄"
For i = LBound(arrTmp) To UBound(arrTmp)
If DataCheck("DT_ID",Trim(arrTmp(i)),strAddInfo & GetRSId,"") Then
Call GBL_objException.catchErr(E_USER_PUB,strAddInfo)
RemoveSmsesLogic = False
Exit Function
End If
Next
strDelWhere = ""
strSetValue = ""
strSQLType = ""
strActType = Request("hidBoxName")
If Request("subSmsDel") = "" And Request("subSmsDelAll") <> "" Then
strDelClew = "刪除" & strActType & "中所有短信"
strAddWhere = ""
Else
strDelClew = "刪除" & strActType & "中選中短信"
strAddWhere = " AND SMS_ID IN (" & Replace(GetRSId,"'","") & ")"
End If
If strActType <> "" And strActType <> "廢件箱" Then
'== Set parameters of db
Select Case strActType
Case "收件箱" :
strDelWhere = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_SEND_FLAG=1 AND SMS_DEL_INCEPT=0"
strSetValue = "SMS_DEL_INCEPT"
Case "已發(fā)送" :
strDelWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_SEND_FLAG=1 AND SMS_DEL_SEND=0"
strSetValue = "SMS_DEL_SEND"
Case "發(fā)件箱" :
strDelWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_SEND_FLAG=0 AND SMS_DEL_SEND=0"
strSetValue = "SMS_DEL_SEND"
End Select
strSQLType = "UPDATE"
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
GBL_objPubDB.SQLType = strSQLType
GBL_objPubDB.Where = strDelWhere & strAddWhere
GBL_objPubDB.AddField strSetValue,"1"
If Not GBL_objPubDB.SQLExecute() Then
RemoveSmsesLogic = False
Exit Function
End If
ElseIf strActType = "廢件箱" Then
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_SMS"
'== 完全刪除收到的且放入垃圾箱(delr=1),被發(fā)送者(dels=2)從垃圾箱中刪除的
strDelWhere = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_INCEPT=1 AND SMS_DEL_SEND=2 "
GBL_objPubDB.SQLType = "DELETE"
GBL_objPubDB.Where = strDelWhere & strAddWhere
If Not GBL_objPubDB.SQLExecute() Then
RemoveSmsesLogic = False
Exit Function
End If
'== 完全刪除發(fā)送的且放入垃圾箱(dels=1),且被接收者(delr=2)從垃圾箱刪除的
strDelWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_DEL_SEND=1 AND SMS_DEL_INCEPT=2 AND SMS_SEND_FLAG=1"
GBL_objPubDB.SQLType = "DELETE"
GBL_objPubDB.Where = strDelWhere & strAddWhere
If Not GBL_objPubDB.SQLExecute() Then
RemoveSmsesLogic = False
Exit Function
End If
'== 完全刪除未被發(fā)送(issend=0),且被發(fā)送者放入垃圾箱(dels=1)的
strDelWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_DEL_SEND=1 AND SMS_SEND_FLAG=0"
GBL_objPubDB.SQLType = "DELETE"
GBL_objPubDB.Where = strDelWhere & strAddWhere
If Not GBL_objPubDB.SQLExecute() Then
RemoveSmsesLogic = False
Exit Function
End If
'== 邏輯刪除收到的且放入垃圾箱(delr=1),未被發(fā)送者(dels<>2)從垃圾箱刪除的
strDelWhere = "SMS_INCEPTER_ID=" & intUserId & " AND SMS_DEL_INCEPT=1 AND SMS_DEL_SEND<>2 "
GBL_objPubDB.SQLType = "UPDATE"
GBL_objPubDB.Where = strDelWhere & strAddWhere
GBL_objPubDB.AddField "SMS_DEL_INCEPT",2
If Not GBL_objPubDB.SQLExecute() Then
RemoveSmsesLogic = False
Exit Function
End If
'== 邏輯刪除用戶發(fā)送的且放入垃圾箱(dels=1),未被接收者(delr<>2)從垃圾箱刪除的
strDelWhere = "SMS_SENDER_ID=" & intUserId & " AND SMS_DEL_SEND=1 AND SMS_DEL_INCEPT<>2 AND SMS_SEND_FLAG=1"
GBL_objPubDB.SQLType = "UPDATE"
GBL_objPubDB.Where = strDelWhere & strAddWhere
GBL_objPubDB.AddField "SMS_DEL_SEND",2
If Not GBL_objPubDB.SQLExecute() Then
RemoveSmsesLogic = False
Exit Function
End If
GBL_objPubDB.Clear()
End If
RemoveSmsesLogic = True
End Function
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -