示例#1
0
     $first_data = '您的服务请求已被处理完成!';
     $remark_data = '感谢你对GDS的理解和支持!';
     $keyword1_data = '服务单号:' . $notifications['t_maskid'];
     $result_sms = send_sms_csc($notifications['notice_id'], $to_mobile, $url_ticket_id, $first_data, $remark_data, $keyword1_data);
 }
 // To ADM
 _log('Processing ADM notification...');
 list($prefer_wechat, $prefer_email, $prefer_mobile) = get_notice_prefer_adm($notifications['ADM_email'], $ticket_stage);
 _log('ADM prefer... ' . json_encode(['ticket_id' => $notifications['t_ticketid'], 'ticket_stage' => $ticket_stage, 'ADM' => $notifications['ADM_email'], 'wechat' => $prefer_wechat, 'email' => $prefer_email, 'mobile' => $prefer_mobile]));
 if ($prefer_wechat) {
     $template_id = 'OFBb_0E6Zy5diGu-ofzsmynT0uySj6-PCU7dPv4sm6o';
     $first_data = '您的客户【' . $notifications['t_custorgname'] . '】的服务请求已被处理完结';
     $remark_data = '请点击详情查看具体信息';
     $keyword1_data = $notifications['t_maskid'];
     $keyword2_data = $notifications['n_create_ts'];
     $openids = get_pe_wechat($notifications['ADM_email']);
     if (!empty($openids)) {
         foreach ($openids as $user_openid) {
             $result_wechat = send_wechat_msg_pe($notifications['notice_id'], $user_openid, 'adm', $template_id, $notifications['t_ticketid'], $first_data, $remark_data, $keyword1_data, $keyword2_data);
         }
     } else {
         _log('No openid binded for ADM ' . $notifications['ADM_email'] . '...');
     }
 }
 if ($prefer_email) {
     $to_addr = $notifications['ADM_email'];
     $to_name = $notifications['ADM_name'];
     $subject = '服务请求处理完结通知【' . $notifications['t_maskid'] . '】';
     $url_ticket_id = $notifications['t_ticketid'];
     $first_data = '您的客户【' . $notifications['t_custorgname'] . '】的服务请求已被处理完结!请悉知。';
     $remark_data = ' ';
        }
    }
}
// To CSC
if ($p_user_type == 'csc') {
    _log('Processing CSC notification...');
    list($prefer_wechat, $prefer_email, $prefer_mobile) = get_notice_prefer_dcs_csc($p_user_mail, $p_stage_val);
    _log('CSC prefer... ' . json_encode(['ticket_id' => $p_ky_ticketid, 'ticket_stage' => $p_stage_val, 'CSC' => $p_user_mail, 'wechat' => $prefer_wechat, 'email' => $prefer_email, 'mobile' => $prefer_mobile]));
    if ($p_method_wechat == '1') {
        if ($prefer_wechat == true || $p_stage == 'wo_delay' || $p_stage == 'manual' || $p_stage == 'manual_1') {
            $template_id = 'nbebyqwxlPD6QdICK7Z6Di8dV7-HyTbSGGzrk-Mvd4A';
            $first_data = $p_stage != 'manual_1' ? $p_first . "\n\n单号:" . $p_ky_maskid : "";
            $remark_data = ($p_stage != 'manual_1' ? "客户:" . $p_cust_org . "\n联系人:" . $p_cust_name . "\nCSC:" . $p_csc_name . "\nADM:" . $p_adm_name . "\nDCS:" . $p_dcs_name . "\n" : $p_first) . "\n" . $p_remark . "\n";
            $keyword1_data = $p_stage != 'manual_1' ? $p_title : '平台通知';
            $keyword2_data = $p_date;
            $openids = get_pe_wechat($p_user_mail);
            _log('Open ids for CSC are ' . var_export($openids, true));
            if (!empty($openids)) {
                foreach ($openids as $user_openid) {
                    $result_wechat = send_wechat_msg_pe($notice_id, $user_openid, 'csc', $template_id, $p_ky_ticketid, $first_data, $remark_data, $keyword1_data, $keyword2_data);
                    if ($result_wechat != 1) {
                        array_push($error, '向CSC发送微信失败');
                    } else {
                        array_push($sent, '发送微信成功');
                    }
                }
            } else {
                _log('No openid binded for CSC ' . $p_user_mail . '...');
                array_push($error, 'CSC没有绑定微信');
            }
        } else {