pluck('user_id'); } // 外部租赁 if($order['type'] == 1) { // 审批成功 if($order['status'] == $checked_id && $role && $last_role && $last_role['key'] == 'manager') { $status = 1; } else if($role && in_array($role['key'], ['machine', 'assist', 'manager'])) { // 审批待处理 $status = 2; } else if($order['status'] == $reject_id) { // 审批被驳回 $status = 3; } else if($order['status'] == $pass_id) { // 租赁时间到期 status = 4 // 租赁已完成 $status = 5; } } else { // 调用 // 调用成功 if($order['status'] == $checked_id && $role && $last_role && $last_role['key'] == 'admin') { $status = $order['is_change'] == 1 ? 7 : 1; } else if($role && in_array($role['key'], ['assist', 'manager', 'admin'])) { // 调用待处理 $status = 2; } else if($order['status'] == $reject_id) { // 调用被驳回 $status = 3; } else if($order['status'] == $pass_id) { // 调用时间到期 status = 4 // 调用已完成 $status = 5; } else if($order['status'] == $back_id) { // 调用已归还 $status = 6; } } foreach($user_ids as $user_id) { Notification::create([ 'user_id' => $user_id, 'order_id' => $order['id'], 'status' => $status, 'type' => $order['type'], 'is_read' => 2 ]); } return true; } public function getNameContent() { if($this['type'] == 1) { if($this['status'] == 1) { return [ 'name' => '设备租赁申请通过', 'content' => '你的设备租赁申请已通过,请确认相关信息:' ]; } else if($this['status'] == 2) { return [ 'name' => '设备租赁审批待处理', 'content' => '你有一条设备租赁申请待审批,请确认相关信息:' ]; } else if($this['status'] == 3) { return [ 'name' => '设备租赁审批被驳回', 'content' => '你有一条设备租赁申请被驳回,请确认相关信息:' ]; } else if($this['status'] == 4) { return [ 'name' => '设备租赁已到期', 'content' => '你有一条设备租赁已到期消息,请确认相关信息:' ]; } else if($this['status'] == 5) { return [ 'name' => '设备租赁已完成', 'content' => '你有一条设备租赁已完成消息,请确认相关信息:' ]; } } else { if($this['status'] == 1) { return [ 'name' => '设备调用申请通过', 'content' => '你的设备调用申请已通过,请确认相关信息:' ]; } else if($this['status'] == 2) { return [ 'name' => '设备调用审批待处理', 'content' => '你有一条设备调用申请待审批,请确认相关信息:' ]; } else if($this['status'] == 3) { return [ 'name' => '设备租赁调用被驳回', 'content' => '你有一条设备调用申请被驳回,请确认相关信息:' ]; } else if($this['status'] == 4) { return [ 'name' => '设备调用已到期', 'content' => '你有一条设备调用已到期消息,请确认相关信息:' ]; } else if($this['status'] == 5) { return [ 'name' => '设备调用已完成', 'content' => '你有一条设备调用已完成消息,请确认相关信息:' ]; } else if($this['status'] == 6) { return [ 'name' => '设备调用已归还', 'content' => '你有一条设备调用已归还消息,请确认相关信息:' ]; } else if($this['status'] == 7) { return [ 'name' => '设备调用被修改', 'content' => '你有一条设备调用被修改消息,请确认相关信息:' ]; } } return ['name' => '', 'content' => '']; } }