|
@@ -88,17 +88,24 @@ class Notification extends BaseModel
|
|
$status = 5;
|
|
$status = 5;
|
|
}
|
|
}
|
|
foreach($user_ids as $user_id) {
|
|
foreach($user_ids as $user_id) {
|
|
- Notification::create([
|
|
|
|
|
|
+ $data = [
|
|
'user_id' => $user_id,
|
|
'user_id' => $user_id,
|
|
'order_id' => $order['id'],
|
|
'order_id' => $order['id'],
|
|
'status' => $status,
|
|
'status' => $status,
|
|
'type' => $order['type'],
|
|
'type' => $order['type'],
|
|
'is_read' => 2
|
|
'is_read' => 2
|
|
- ]);
|
|
|
|
|
|
+ ];
|
|
|
|
+ self::createAndSend($data);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static function createAndSend($data)
|
|
|
|
+ {
|
|
|
|
+ $item = Notification::create($data);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 租赁时间到期 status = 4
|
|
* 租赁时间到期 status = 4
|
|
* @param $id
|
|
* @param $id
|
|
@@ -114,13 +121,14 @@ class Notification extends BaseModel
|
|
['project_role_id', $role['id']]
|
|
['project_role_id', $role['id']]
|
|
])->pluck('user_id');
|
|
])->pluck('user_id');
|
|
foreach($user_ids as $user_id) {
|
|
foreach($user_ids as $user_id) {
|
|
- Notification::create([
|
|
|
|
|
|
+ $data = [
|
|
'user_id' => $user_id,
|
|
'user_id' => $user_id,
|
|
'order_id' => $order['id'],
|
|
'order_id' => $order['id'],
|
|
'status' => 4,
|
|
'status' => 4,
|
|
'type' => $order['type'],
|
|
'type' => $order['type'],
|
|
'is_read' => 2
|
|
'is_read' => 2
|
|
- ]);
|
|
|
|
|
|
+ ];
|
|
|
|
+ self::createAndSend($data);
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -136,7 +144,10 @@ class Notification extends BaseModel
|
|
} else if($this['status'] == 2) {
|
|
} else if($this['status'] == 2) {
|
|
return [
|
|
return [
|
|
'name' => '租赁审批待处理通知',
|
|
'name' => '租赁审批待处理通知',
|
|
- 'content' => '你有一条设备租赁申请待审批,请确认相关信息:'
|
|
|
|
|
|
+ 'content' => '你有一条设备租赁申请待审批,请确认相关信息:',
|
|
|
|
+ 'official' => [
|
|
|
|
+ 'template_id'
|
|
|
|
+ ]
|
|
];
|
|
];
|
|
} else if($this['status'] == 3) {
|
|
} else if($this['status'] == 3) {
|
|
return [
|
|
return [
|