if ($prefer_mobile) { $to_mobile = $notifications['CSC_phone']; $url_ticket_id = $notifications['t_ticketid']; $first_data = '客户【' . $notifications['t_custorgname'] . '】的服务工单已处理完成'; $remark_data = '请及时更新服务请求状态'; $keyword1_data = '服务单号:' . $notifications['t_maskid']; $keyword2_data = '工单号:' . $notifications['wo_workorderid']; $keyword3_data = '完工时间:' . $notifications['n_create_ts']; $result_sms = send_sms_pe($notifications['notice_id'], $to_mobile, 'csc', $url_ticket_id, $first_data, $remark_data, $keyword1_data, $keyword2_data, $keyword3_data); } break; case 'Resolved': // To Cust _log('Stage Resolved...'); _log('Processing Customer notification...'); list($prefer_wechat, $prefer_email, $prefer_mobile) = get_notice_prefer_cust($notifications['t_custmail'], $ticket_stage); _log('Customer prefer... ' . json_encode(['ticket_id' => $notifications['t_ticketid'], 'ticket_stage' => $ticket_stage, 'customer' => $notifications['t_custmail'], 'wechat' => $prefer_wechat, 'email' => $prefer_email, 'mobile' => $prefer_mobile])); if ($prefer_wechat) { $template_id = 'lR3R5RYP3ZXP4UXQRwlrASXTNFGu2WrrfiZ84ftKjK8'; $first_data = '您好,您的服务请求已被处理完成'; $remark_data = '感谢您对万国数据的理解和支持。'; if ($notifications['t_tickettypeid'] * 1 == 15 || $notifications['t_tickettypeid'] * 1 == 16) { $remark_data .= '服务单号有助于帮助现场工作人员更快地解决问题,建议保存并告知随行人员'; } $keyword1_data = $notifications['t_maskid']; $keyword2_data = $notifications['n_create_ts']; $openids = get_cust_wechat($notifications['t_custmail']); if (!empty($openids)) { foreach ($openids as $user_openid) { $result_wechat = send_wechat_msg_csc($notifications['notice_id'], $user_openid, $template_id, $notifications['t_ticketid'], $first_data, $remark_data, $keyword1_data, $keyword2_data); }
$p_stage_text = parse_stage_text($p_stage); $p_ky_ticketid = $p_stage == 'manual' || $p_stage == 'manual_1' ? -1 : $p_ky_ticketid; _log(json_encode(['p_stage_val' => $p_stage_val])); // Create manual notice log R::addDatabase('kayako', $GLOBALS['db_kayako_url'], $GLOBALS['db_kayako_user'], $GLOBALS['db_kayako_pass']); R::selectDatabase('kayako'); if (!R::testConnection()) { exit('DB failed' . PHP_EOL); } R::freeze(true); $notice_id = add_notice_log($p_ky_ticketid, $p_stage_val); R::close(); // To CUST if ($p_user_type == 'cust') { _log('Processing Customer notification...'); list($prefer_wechat, $prefer_email, $prefer_mobile) = get_notice_prefer_cust($p_user_mail, $p_stage_val); _log('Customer prefer... ' . json_encode(['ticket_id' => $p_ky_ticketid, 'ticket_stage' => $p_stage_val, 'customer' => $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 = 'pexUhrNCr5wTKPvyxFXlhw50WYJwJ4EWgA2PtQc4D2I'; $first_data = $p_stage != 'manual_1' ? $p_first . "\n\n单号:" . $p_ky_maskid : ""; $remark_data = "\n" . ($p_stage != 'manual_1' ? "" : $p_first) . $p_remark . "\n"; $keyword1_data = $p_stage != 'manual_1' ? $p_title : '平台通知'; $keyword2_data = $p_date; $openids = get_cust_wechat($p_user_mail); _log('Open ids for CUST are ' . var_export($openids, true)); if (!empty($openids)) { foreach ($openids as $user_openid) { $result_wechat = send_wechat_msg_csc($notice_id, $user_openid, $template_id, $p_ky_ticketid, $first_data, $remark_data, $keyword1_data, $keyword2_data); if ($result_wechat != 1) { array_push($error, '向客户发送微信失败');