手机发送代码投放参考之动易内容管理系统

本次示例版本为SiteWeaver™ CMS 6.5,其他版本可参考修改。

1.准备工作

·站长的联盟ID;
·后台管理帐号以便修改模板文件(后台默认地址http://www.mzwu.com/Admin/Admin_Index.asp);
·文件:Include/PowerEasy.Soft.asp

2.修改步骤

①打开文件"Include/PowerEasy.Soft.asp",修改GetDownloadUrlList和GetSoftPicUrl两个函数(红色新增):
Private Function GetDownloadUrlList(ShowModule)
    Dim DownloadUrls, arrDownloadUrls, arrUrls, iTemp, strUrls
    Dim rsDownServer, sqlDownServer, ShowServerName, iShowModule, iCols
    iShowModule = PE_CLng(ShowModule)
    DownloadUrls = rsSoft("DownloadUrl")
    If DownloadUrls = "" Then
        GetDownloadUrlList = ""
        Exit Function
    End If
    strUrls = ""
    If InStr(DownloadUrls, "@@@") > 0 Then
    '构建镜像服务器下载地址列表
        arrDownloadUrls = Trim(Replace(DownloadUrls, "@@@", "")) '得PE_Soft中的Url地址
        sqlDownServer = "select * from PE_DownServer where ChannelID=" & ChannelID
        Set rsDownServer = Server.CreateObject("adodb.recordset")
        rsDownServer.Open sqlDownServer, Conn, 1, 3
        If rsDownServer.BOF or rsDownServer.EOF Then
           strUrls = "对不起,未找到任何镜像服务器信息!"
        End If
        iCols = 1

        Do While Not rsDownServer.EOF
            If rsDownServer("ShowType") = 0 Then
               ShowServerName = rsDownServer("ServerName")
            Else
               ShowServerName = "<img src='" & rsDownServer("ServerLogo") & "' border=0>"
            End If
            '设置了下载点数的处理(PE_DownServer中有收费相关字段)
            'If EnableProtect = True or ClassPurview > 0 or rsSoft("InfoPoint") > 0 or rsDownServer("InfoPoint") > 0 Then
                strUrls = strUrls & "<a href='" & ChannelUrl_ASPFile & "/ShowSoftDown.asp?UrlID=" & rsDownServer("ServerID") & "&SoftID=" & rsSoft("SoftID") & "' target='_blank' name='unionsoftlinks'>" & ShowServerName & "</a>"
            'Else
            '    strUrls = strUrls & "<a href='" & rsDownServer("ServerUrl") & arrDownloadUrls & "' target='_blank'>" & ShowServerName & "</a>"
            'End If
            If iShowModule = 0 Then
                strUrls = strUrls & "  "
            Else
                If (iCols Mod iShowModule) <> 0 Then
                    strUrls = strUrls & "  "
                Else
                    strUrls = strUrls & "<br>"
                End If
            End If
            iCols = iCols + 1
            rsDownServer.MoveNext
        Loop
        GetDownloadUrlList = strUrls
        rsDownServer.Close
        Set rsDownServer = Nothing
    Else
        iCols = 0
        arrDownloadUrls = Split(DownloadUrls, "$$$")
        For iTemp = 0 To UBound(arrDownloadUrls)
            iCols = iCols + 1
            arrUrls = Split(arrDownloadUrls(iTemp), "|")
            If UBound(arrUrls) >= 1 Then
                If arrUrls(1) <> "" And arrUrls(1) <> "http://" Then
                    'If EnableProtect = True or ClassPurview > 0 or rsSoft("InfoPoint") > 0 Then
                        strUrls = strUrls & "<a href='" & ChannelUrl_ASPFile & "/ShowSoftDown.asp?UrlID=" & iTemp + 1 & "&SoftID=" & rsSoft("SoftID") & "' target='_blank' name='unionsoftlinks'>" & arrUrls(0) & "</a>"
                    'Else
                    '    If Left(arrUrls(1), 1) <> "/" And InStr(arrUrls(1), "://") <= 0 Then
                    '        strUrls = strUrls & "<a href='" & ChannelUrl & "/" & UploadDir & "/" & arrUrls(1) & "' target='_blank'>" & arrUrls(0) & "</a>"
                    '    Else
                    '        strUrls = strUrls & "<a href='" & GetFirstSeparatorToEnd(arrDownloadUrls(iTemp), "|") & "' target='_blank'>" & arrUrls(0) & "</a>"
                    '    End If
                    'End If
                    If iShowModule = 0 Then
                        strUrls = strUrls & "  "
                    Else
                        If (iCols Mod iShowModule) <> 0 Then
                            strUrls = strUrls & "  "
                        Else
                            strUrls = strUrls & "<br>"
                        End If
                    End If
                End If
            End If
        Next
        GetDownloadUrlList = strUrls
    End If
End Function

Private Function GetSoftPicUrl(SoftPicUrl, SoftPicWidth, SoftPicHeight)
    Dim strSoftPicUrl, FileType, strPicUrl

    If SoftPicUrl = "" Then
        strSoftPicUrl = strSoftPicUrl & "<img src='" & strPicUrl & strInstallDir & "images/nopic.gif' "
        If SoftPicWidth > 0 Then strSoftPicUrl = strSoftPicUrl & " width='" & SoftPicWidth & "'"
        If SoftPicHeight > 0 Then strSoftPicUrl = strSoftPicUrl & " height='" & SoftPicHeight & "'"
        strSoftPicUrl = strSoftPicUrl & " border='0'>"
    Else
        FileType = LCase(Mid(SoftPicUrl, InStrRev(SoftPicUrl, ".") + 1))
        If LCase(Left(SoftPicUrl, Len("UploadSoftPic"))) = "uploadsoftpic" Then
            strPicUrl = ChannelUrl & "/" & SoftPicUrl
        Else
            strPicUrl = SoftPicUrl
        End If
        If FileType = "swf" Then
            strSoftPicUrl = strSoftPicUrl & "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' "
            If SoftPicWidth > 0 Then strSoftPicUrl = strSoftPicUrl & " width='" & SoftPicWidth & "'"
            If SoftPicHeight > 0 Then strSoftPicUrl = strSoftPicUrl & " height='" & SoftPicHeight & "'"
            strSoftPicUrl = strSoftPicUrl & "><param name='movie' value='" & strPicUrl & "'><param name='quality' value='high'><embed src='" & strPicUrl & "' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' "
            If SoftPicWidth > 0 Then strSoftPicUrl = strSoftPicUrl & " width='" & SoftPicWidth & "'"
            If SoftPicHeight > 0 Then strSoftPicUrl = strSoftPicUrl & " height='" & SoftPicHeight & "'"
            strSoftPicUrl = strSoftPicUrl & "></embed></object>"
        ElseIf FileType = "gif" or FileType = "jpg" or FileType = "jpeg" or FileType = "jpe" or FileType = "bmp" or FileType = "png" Then
            strSoftPicUrl = strSoftPicUrl & "<img name='unionsoftimg' class='pic2' src='" & strPicUrl & "' "
            If SoftPicWidth > 0 Then strSoftPicUrl = strSoftPicUrl & " width='" & SoftPicWidth & "'"
            If SoftPicHeight > 0 Then strSoftPicUrl = strSoftPicUrl & " height='" & SoftPicHeight & "'"
            strSoftPicUrl = strSoftPicUrl & " border='0'>"
        Else
            strSoftPicUrl = strSoftPicUrl & "<img class='pic2' src='" & strInstallDir & "images/nopic.gif' "
            If SoftPicWidth > 0 Then strSoftPicUrl = strSoftPicUrl & " width='" & SoftPicWidth & "'"
            If SoftPicHeight > 0 Then strSoftPicUrl = strSoftPicUrl & " height='" & SoftPicHeight & "'"
            strSoftPicUrl = strSoftPicUrl & " border='0'>"
        End If
    End If
    GetSoftPicUrl = strSoftPicUrl
End Function

②打开"下载中心管理→软件模板页管理→内容页模板",找到"{$DownloadUrl}",在其前面增加下边代码:
<script language="JavaScript" type="text/JavaScript">
<!--
//悟空网盟(union.5k3g.com)手机发送代码
function mms()
{
    var uid = "";//联盟ID
    var resName = "{$SoftName}{$SoftVersion}";//资源名称
    var fileUrl = GetDownloadUrl();//资源地址
    var imgUrl = GetDownloadImg();//资源图片,没有直接用站点LOGO地址
    
    window.open("http://code.5k3g.com/tl/picDIY/Sendgame.aspx?uid="+uid+"&title="+escape(resName)+"&fileurl="+escape(fileUrl)+"&imgurl="+escape(imgUrl),"unionwin","width=450,height=400");
    return false;
}

function GetDownloadUrl()
{
    var softlink = document.getElementsByName("unionsoftlinks")[0].href;
    return softlink.replace(/downid=[0-9]{1,5}/,"downid=0");
}

function GetDownloadImg()
{
    return document.getElementsByName("unionsoftimg")[0].href;
}
//-->
</script>
<a href="javascript:;" onClick="return mms();" style='color:'>发送到手机</a>  

3.检查结果

在页面(静态页修改后得重新生成)上点击"发送到手机",在弹出的窗口中用右键点击空白部分选择属性,并复制出地址,应和下边地址类似:

http://code.5k3g.com/tl/picDIY/Sendgame.aspx?uid=10009&title=aa&fileurl=http%3A//www.mzwu.com/ebook/aa.rar&imgurl=http://www.mzwu.com/images/logo.gif

主要看下uid是否正确,fileurl必须为绝对地址并且可以直接下载到资源(不能有防盗链、要求安装迅雷、快车等)!

评论: 0 | 引用: 0 | 查看次数: 4238
发表评论
登录后再发表评论!