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); } } else { _log('No openid binded for CUSTOMER ' . $notifications['t_custmail'] . '...'); } } if ($prefer_email) { $to_addr = $notifications['t_custmail']; $to_name = $notifications['t_custname']; $subject = '服务请求处理完成通知通知【' . $notifications['t_maskid'] . '】'; $url_ticket_id = $notifications['t_ticketid']; $first_data = '您的服务请求已被处理完成。'; $remark_data = '感谢你对GDS的理解和支持!';
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, '向客户发送微信失败'); } else { array_push($sent, '发送微信成功'); } } } else { _log('No openid binded for CUSTOMER ' . $p_user_mail . '...'); array_push($error, '客户没有绑定微信'); } } else {