public with sharing class LexCommitNeedApprovalController {

    @AuraEnabled
    public static meeting_delay_apply__c init(String recordId){
        meeting_delay_apply__c res = new meeting_delay_apply__c();
        try{
            res = [Select Id,status__c,campaign__c,RecordTypeId
                FROM meeting_delay_apply__c
                    WHERE  Id = : recordId];
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }

    @AuraEnabled
    public static String  newUpdateMeetingDelayApply(String Id){
        meeting_delay_apply__c res = new meeting_delay_apply__c();
        try{
            res.Id=Id;
            res.Status__c ='提交';
            update res;
            return 'success';
        }
        catch (Exception e) {
            String messageText='';
            if(e.getMessage().contains(':')){
                String eMessage =e.getMessage();
                Integer left = eMessage.indexOf(',')+1;
                Integer right= eMessage.lastIndexOf('：')+1;
                if(right>eMessage.length()||right<=left){
                    right=eMessage.length();
                }
                String mes=eMessage.substring(left,right);
                messageText = mes;
                messageText = OppSubmitController.removeUnChinese(messageText);
                return messageText;
            }else{
                messageText=e.getMessage();
                return messageText;
            }
        }

    } 

    @AuraEnabled
    public static Campaign  getCampaignById(String recordId){
        Campaign res = new Campaign();
        try {
              res = [SELECT Status,IF_Submit__c,EndDate
                FROM  Campaign 
                    WHERE Id = :recordId];
            return res;
          }
          catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            return null;
          }
            
    }
}