$title, 'customer_message_content' => $content_info['content'], 'customer_message_postscript' => $ps, 'customer_guid' => $content_info['customer_guid'], ]); } /** * 审核通过消息 * * @param string $code_module_category_guid 代码块类目guid * @param string $ps 附言 * @return void * @date 2023-08-01 * @author xjh * @since 1.0.0 */ public static function passAudit(string $code_module_category_guid, string $ps = "无附言"): void { $title = "【公共代码块类目审核结果】"; $content_info = self::bulidContentInfo($code_module_category_guid, '审核结果:通过!'); ModelCustomerMessage::create([ 'customer_message_title' => $title, 'customer_message_content' => $content_info['content'], 'customer_message_postscript' => $ps, 'customer_guid' => $content_info['customer_guid'], ]); } /** * 审核驳回消息 * * @param string $code_module_category_guid 代码块类目guid * @param string $ps 附言 * @return void * @date 2023-08-01 * @author xjh * @since 1.0.0 */ public static function rejectAudit(string $code_module_category_guid, string $ps = "无附言"): void { $title = "【公共代码块类目审核结果】"; $content_info = self::bulidContentInfo($code_module_category_guid, '审核结果:驳回!'); ModelCustomerMessage::create([ 'customer_message_title' => $title, 'customer_message_content' => $content_info['content'], 'customer_message_postscript' => $ps, 'customer_guid' => $content_info['customer_guid'], ]); } /** * 获取审核消息所需信息 * * @param string $code_module_category_guid 代码块类目guid * @param string $type 审核结果类型 * @return array ['content' => 审核消息内容 , 'customer_guid' => 客户guid] * @date 2023-08-01 * @author xjh * @since 1.0.0 */ public static function bulidContentInfo(string $code_module_category_guid, string $main_content): array { $category = ModelCodeModuleCategory::find($code_module_category_guid); if (!$category) { throwErrorMsg("客户消息-代码块类目审核信息构建异常(类目不存在!)"); } //类目提交审核的时间 $start_datetime = date('Y-m-d H:i:s'); //主子级类目区分处理 if ($category->code_module_category_parent_guid == ModelCodeModuleCategory::MASTER_DEFAULT) { $category_name = "主级类目:{$category->code_module_category_name}"; } else { $parent_category = ModelCodeModuleCategory::find($category->code_module_category_parent_guid); if (!$parent_category) { throwErrorMsg("客户消息-代码模块类目审核信息构建异常(所属父级类目不存在!)"); } $category_name = "(所属主级类目:{$parent_category->code_module_category_name})子级类目:{$category->code_module_category_name}"; } //整体消息内容 $content = "您在 {$start_datetime} 提交的公共类目【{$category_name}】" . $main_content; return [ 'content' => $content, 'customer_guid' => $category->customer_guid, ]; } }