Iis 7 来自计划任务内的coldfusion cfhttp post

Iis 7 来自计划任务内的coldfusion cfhttp post,iis-7,coldfusion,scheduled-tasks,cfhttp,Iis 7,Coldfusion,Scheduled Tasks,Cfhttp,我有一个CF计划任务,通过电子邮件发送管理员用户的电话摘要。我想添加的能力,也电子邮件报告的某些管理员用户。每个管理员用户的附加报告都是动态的,并存储在表中。我不能只是报告代码,因为下一个用户可能会更改或不存在报告代码。也许我应该使用CFHTTP,但我并不精通它 <cfloop query="qGetTelemateEmails"> <cfif trim(QGetTime.Call_Email_On_Hour) eq "" or listf

我有一个CF计划任务,通过电子邮件发送管理员用户的电话摘要。我想添加的能力,也电子邮件报告的某些管理员用户。每个管理员用户的附加报告都是动态的,并存储在表中。我不能只是报告代码,因为下一个用户可能会更改或不存在报告代码。也许我应该使用CFHTTP,但我并不精通它

<cfloop query="qGetTelemateEmails">             
  <cfif trim(QGetTime.Call_Email_On_Hour) eq "" or     listfind(#QGetTime.Call_Email_On_Hour#,datepart("h",now()))>
  <cfset TotalTime = 0>
  <cfset NumberOfCalls = 0> 
  <cfmail ........></cfmail>

可能是我需要做一个HTTPS,你可以将你试图重用的代码“远程调用”到cfc中,或者将其包含在cfinclude中

编写CFC将是更好的方式


您可以这样在计划任务中调用cfc

<!--- make the object. assume the cfc is in the same folder named adminreports.cfc --->
<cfset reportObject = createObject("component", "adminReports")>
<cfset reportObject.additionalReports(val(QGetTime.call_admin_user_id), qGetTelemateEmails.Telemate_Email)>


cfhttp
非常简单。查看文档-我不知道cfhttp在这个等式中的位置。我不知道从另一个cfml页面动态执行页面的其他方法。我在上面所做的会得到一条错误消息503。我想我可以在cfinclude函数中添加一个cfinclude。但是,当我找到下一个用户,他们有一个不同的“附加报告”要包含时,会发生什么呢。cffunction是否仍然包含上一个调用中的include?CFC成分的持续时间是多少。我每天每小时运行一次此过程。为什么每个报告都有不同的文件?我仍然只是理解你想要实现的部分目标。很抱歉CFC在请求期间有效,因此每次进程运行时,它都会创建一个新对象。但无论哪种方式,您都可以将cfinclude与动态页面名称一起使用,假设queryName是您的文件名:
我有10个管理员用户整天都在打电话。每小时我都会给他们发一份电话摘要。这是从CF计划任务运行的。在循环查询(按管理员id分组)时,我查看是否有其他用户报告。如果有,我将尝试使用CFHTTP生成报告。下一个用户可能有不同的报告。这似乎是生成报告的唯一合乎逻辑的方法。CFINCLUDE将保留在内存中供下一个用户使用,并且它们将“堆叠起来”。这些“附加报告”是否来自您控制的一个或多个coldfusion页面?
    <cfquery name="QGetCommEct" datasource="#request.dsn#">
      select *
      from Q_ES_Communications_by_Search_Number
      where upper(communication_type) = 'T'
        and Date_Entered = '#dateformat(now(),"yyyy/mm/dd")#'
    and consultant_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.adminid#">
      order by date_Entered
    </cfquery>
    <cfmail>
        <div style="text-align:center; font-weight:bold; ">Communications Files Query</div> 
    <table>
     <tr>
      <td>
        <table style="font:Arial, Helvetica, sans-serif x-small; border:1px solid black; ">
         <tr>
      <td><strong>Type</strong></td>
      <td><strong>Cons</strong></td>
      <td><strong>Last Name</strong></td>
         </tr>
     <cfoutput query="QGetCommEct">     
    <tr valign="top">
      <td>#QGetCommEct.Communication_Type#-#QGetCommEct.Category#</td>
          <td>#QGetCommEct.AS400_Initials#</td>
          <td>#QGetCommEct.lastname#</td>
        </tr>
     </cfoutput>      
     </table> 
    </td>
  </tr>
</table> 
</cfmail>
<cfloop query="QAdditionalReports">
<cfhttp url="#QAdditionalReports.QueryURL##QAdditionalReports.QueryName#?adminid=#val(QGetTime.call_admin_user_id)#&emailto=#qGetTelemateEmails.Telemate_Email#">
<cfmail to="vj@gmail.com" from="server@tt.com" subject="Recap of daily phone calls" type="html" spoolenable="false"><cfdump var="#cfhttp#"></cfmail>
</cfloop>
struct
Charset [empty string] 
ErrorDetail [empty string] 
Filecontent [empty string] 
Header  HTTP/1.1 503 Server Error Content-Type: text/html Date: Wed, 13 Feb 2013 15:11:17 GMT Server: Microsoft-IIS/7.0 
Mimetype    text/html 
Responseheader  struct
Content-Type    text/html 
Date    Wed, 13 Feb 2013 15:11:17 GMT 
Explanation Server Error 
Http_Version    HTTP/1.1 
Server  Microsoft-IIS/7.0 
Status_Code 503 

Statuscode  503 Server Error 
Text    YES 
<cfcomponent ...>
   <cffunction name = "additionalReports" ...>
      <cfargument name = "adminid" ...>
      <cfargument name = "emailto" ...>

      <!--- dynamic query using your adminid here ---->

      <cfmail to = "#arguments.emailTo#" ...>
         <!--- nicely formated output --->
      </cfmail>
   </cffunction>
<cfcomponent>
<!--- make the object. assume the cfc is in the same folder named adminreports.cfc --->
<cfset reportObject = createObject("component", "adminReports")>
<cfset reportObject.additionalReports(val(QGetTime.call_admin_user_id), qGetTelemateEmails.Telemate_Email)>