消息推送增加邮箱&&增加终版保存功能

This commit is contained in:
mzl
2025-09-15 15:01:19 +08:00
parent 3208fbd501
commit f152529364
14 changed files with 209 additions and 24 deletions
@@ -565,23 +565,34 @@ class ApprovalFlowService
/** 发送通知(接你自己的消息系统即可) */
private function sendNotification(array $userIds, object $instance, string $action, bool $isCC): void
{
$map = ['pending'=>'待审批','approve'=>'已通过','reject'=>'已拒绝','revoked'=>'已撤回'];
$prefix = $isCC ? '[抄送]' : '';
$text = $map[$action] ?? $action;
$msg = "{$prefix}您有一条审批 {$text}:流程ID {$instance->id},类型 {$instance->flow_type}";
// MessageService::send($userIds, $msg);
$pushData = [
'sender_id' => 0,
'sender_type' => 'system',
'title' => $msg,
'content' => $msg,
'scene' => 1,
'recipient' => $userIds,
'push_method' => 1
$map = [
'pending' => '待审批',
'approve' => '已通过',
'reject' => '已拒绝',
'revoked' => '已撤回'
];
$msgId = (new MessageNotificationsService())->pushNotice($pushData);
var_dump($msgId);
$prefix = $isCC ? '【抄送】' : '【审批】';
$text = $map[$action] ?? $action;
$approvalType = array_flip(\app\common\service\SysDictService::pluckKeyValueByCode('approval_type')->toArray());
switch ($instance->flow_type) {
case 'stock_orders': // 备货单
$stockOrder = \app\common\model\StockOrders::find($instance->biz_id);
$title = $prefix."备货单:{$stockOrder->order_no}";
$flowType = $approvalType[$instance->flow_type];
$content = "{$prefix}你有一条审批 {$text}:类型 {$flowType},业务单号 {$stockOrder->order_no}";
break;
case 'stock_orders_nullify': // 备货单作废
break;
}
noticePush([
'title' => $title,
'content' => $content,
'recipient' => $userIds,
'email' => 1
]);
}
private function notifyInitiator(object $instance, string $result): void