Example #1
0
            $subject = '服务请求处理完结通知【' . $notifications['t_maskid'] . '】';
            $url_ticket_id = $notifications['t_ticketid'];
            $first_data = '您的客户【' . $notifications['t_custorgname'] . '】的服务请求已被处理完结!请悉知。';
            $remark_data = ' ';
            $keyword1_data = '服务单号:' . $notifications['t_maskid'];
            $keyword2_data = '完成时间:' . $notifications['n_create_ts'];
            $result_mail = send_mail_pe($notifications['notice_id'], $to_addr, 'adm', $to_name, $subject, $url_ticket_id, $first_data, $remark_data, $keyword1_data, $keyword2_data);
        }
        if ($prefer_mobile) {
            $to_mobile = $notifications['ADM_phone'];
            $url_ticket_id = $notifications['t_ticketid'];
            $first_data = '您的客户【' . $notifications['t_custorgname'] . '】的请求已被处理完结';
            $remark_data = '';
            $keyword1_data = '服务单号:' . $notifications['t_maskid'];
            $keyword2_data = '完成时间:' . $notifications['n_create_ts'];
            $result_sms = send_sms_pe($notifications['notice_id'], $to_mobile, 'adm', $url_ticket_id, $first_data, $remark_data, $keyword1_data);
        }
        break;
    default:
        # code...
        _log('Unknows stage, doing nothing...');
        break;
}
_log('Mark finished...');
// Mark Sent
R::selectDatabase('kayako');
if (!R::testConnection()) {
    exit('DB failed' . PHP_EOL);
}
R::freeze(true);
try {
            array_push($error, 'CSC设置了不通过【邮件】接收【' . $p_stage_text . '】有关的消息');
        }
    }
    if ($p_method_sms == '1') {
        if ($prefer_mobile == true || $p_stage == 'wo_delay' || $p_stage == 'manual' || $p_stage == 'manual_1') {
            $to_mobile = $p_user_phone;
            $url_ticket_id = $p_ky_ticketid;
            $first_data = $p_first;
            $remark_data = $p_remark;
            if ($p_stage != 'manual_1') {
                $keyword1_data = '服务单号:' . $p_ky_maskid;
                $keyword2_data = '工单号:' . $p_wo_id;
            }
            if (preg_match_all("/(1\\d{10})/", $to_mobile, $to_mobile_ext)) {
                _log('Mobile number [' . $to_mobile . '] extracted to [' . var_export($to_mobile_ext, true) . ']...');
                $result_sms = send_sms_pe($notice_id, $to_mobile_ext[0][0], 'csc', $url_ticket_id, $first_data, $remark_data, $keyword1_data, $keyword2_data);
                if ($result_sms != 1) {
                    array_push($error, '向CSC发送短信失败');
                } else {
                    array_push($sent, '发送短信成功');
                }
            } else {
                array_push($error, '手机号码无效,或没有CSC手机号码信息');
            }
        } else {
            _log('CSC设置了不通过【短信】接收【' . $p_stage_text . '】有关的消息');
            array_push($error, 'CSC设置了不通过【短信】接收【' . $p_stage_text . '】有关的消息');
        }
    }
}
_log('Mark finished...');