global class ErrorLogBatch implements Database.Batchable<sObject>,Database.AllowsCallouts
在implements后加上Database.AllowsCallouts
@Future(callout=true)方法去掉
例子:
global class RePushSMSTemplateBatch implements Database.Batchable<sObject>,Database.Stateful,Database.AllowsCallouts
{
public String query;
public RePushSMSTemplateBatch()
{
query = 'SELECT Id,OwnerId,PhoneOrder__c,PhoneOrder__r.Consumer__c,PhoneOrder__r.Consumer__r.FirstPhone__c,SMSTemplate__c,SMSTemplate__r.Name,SMSTemplate__r.TemplateId__c,SMSTemplate__r.SMSText__c,SMSTemplate__r.ReplaceSendText__c,SMSTemplate__r.PushUserId__c,ReceiveStatus__c,RepetitionTimes__c,IsProcessed__c FROM InterfaceLog__c WHERE IsProcessed__c = false';
}
global Database.QueryLocator start(Database.BatchableContext bc)
{
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC,