| xqd
@@ -2,6 +2,8 @@
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
+use Carbon\Carbon;
|
|
|
+
|
|
|
class Notification extends BaseModel
|
|
|
{
|
|
|
public static function send($order_id, $overdue = false)
|
| xqd
@@ -157,6 +159,12 @@ class Notification extends BaseModel
|
|
|
$order = Order::find($this['order_id']);
|
|
|
$status_name = $order ? $order->getStatusName() : '';
|
|
|
$source = ($order->project ? $order->project->name : '') . '-' . ($order->workPoint ? $order->workPoint->name : '') . '-' . ($order->user ? $order->user->name : '');
|
|
|
+
|
|
|
+ $tomorrow = Carbon::tomorrow();
|
|
|
+ $days = OrderDevice::where([
|
|
|
+ 'order_id' => $order->id,
|
|
|
+ 'end_date' => $tomorrow
|
|
|
+ ])->first() ? 1 : 3;
|
|
|
if($this['type'] == 1) {
|
|
|
$detail = OrderDevice::where('order_id', $order->id)->count() . '个设备,¥' . ($order->money / 100);
|
|
|
$type = '设备租赁订单';
|
| xqd
@@ -202,7 +210,7 @@ class Notification extends BaseModel
|
|
|
'content' => '你有一条设备租赁申请被驳回,请确认相关信息:',
|
|
|
'official' => [
|
|
|
'template_id' => 'dlRsvUWqeziBvGbdT89b69slvZll6gZVRCotIXCwwjM',
|
|
|
- 'page' => 'pages/order-detail/index?id=' . $this['order_id'],
|
|
|
+ 'page' => '/pages/create-order/index?id=' . $order->project_id . '&order_id=' . $order->id . '&type=edit',
|
|
|
'data' => [
|
|
|
'first' => '您有一个订单已被驳回,请注意查看!',
|
|
|
'keyword1' => $this['created_at'],
|
| xqd
@@ -217,7 +225,21 @@ class Notification extends BaseModel
|
|
|
} else if($this['status'] == 4) {
|
|
|
return [
|
|
|
'name' => '租赁时间到期通知',
|
|
|
- 'content' => '你有一条设备租赁已到期消息,请确认相关信息:'
|
|
|
+ 'content' => '你有一条设备租赁已到期消息,请确认相关信息:',
|
|
|
+ 'official' => [
|
|
|
+ 'template_id' => 'dlRsvUWqeziBvGbdT89b69slvZll6gZVRCotIXCwwjM',
|
|
|
+ 'page' => 'pages/order-detail/index?id=' . $this['order_id'],
|
|
|
+ 'data' => [
|
|
|
+ 'first' => '您有一个设备租赁订单即将到期,请注意查看',
|
|
|
+ 'keyword1' => $this['created_at'],
|
|
|
+ 'keyword2' => $type,
|
|
|
+ 'keyword3' => $status_name,
|
|
|
+ 'keyword4' => $source,
|
|
|
+ 'keyword5' => $detail,
|
|
|
+ 'remark' => '你租赁的设备将于' . $days . '天后到期,请进入小程序查看
|
|
|
+',
|
|
|
+ ]
|
|
|
+ ]
|
|
|
];
|
|
|
} else if($this['status'] == 5) {
|
|
|
return [
|
| xqd
@@ -283,7 +305,7 @@ class Notification extends BaseModel
|
|
|
'content' => '你有一条设备调用申请被驳回,请确认相关信息:',
|
|
|
'official' => [
|
|
|
'template_id' => 'dlRsvUWqeziBvGbdT89b69slvZll6gZVRCotIXCwwjM',
|
|
|
- 'page' => 'pages/order-detail/index?id=' . $this['order_id'],
|
|
|
+ 'page' => '/pages/create-order-inner/index?id=' . $order->project_id . '&order_id=' . $order->id . '&type=edit',
|
|
|
'data' => [
|
|
|
'first' => '您有一个订单已被驳回,请注意查看!',
|
|
|
'keyword1' => $this['created_at'],
|
| xqd
@@ -298,7 +320,21 @@ class Notification extends BaseModel
|
|
|
} else if($this['status'] == 4) {
|
|
|
return [
|
|
|
'name' => '调用时间到期通知',
|
|
|
- 'content' => '你有一条设备调用已到期消息,请确认相关信息:'
|
|
|
+ 'content' => '你有一条设备调用已到期消息,请确认相关信息:',
|
|
|
+ 'official' => [
|
|
|
+ 'template_id' => 'dlRsvUWqeziBvGbdT89b69slvZll6gZVRCotIXCwwjM',
|
|
|
+ 'page' => '/pages/create-order-inner/index?id=' . $order->project_id . '&order_id=' . $order->id . '&type=edit',
|
|
|
+ 'data' => [
|
|
|
+ 'first' => '您有一个设备租赁订单即将到期,请注意查看',
|
|
|
+ 'keyword1' => $this['created_at'],
|
|
|
+ 'keyword2' => $type,
|
|
|
+ 'keyword3' => $status_name,
|
|
|
+ 'keyword4' => $source,
|
|
|
+ 'keyword5' => $detail,
|
|
|
+ 'remark' => '你租赁的设备将于' . $days . '天后到期,请进入小程序查看
|
|
|
+',
|
|
|
+ ]
|
|
|
+ ]
|
|
|
];
|
|
|
} else if($this['status'] == 5) {
|
|
|
return [
|
| xqd
@@ -306,7 +342,7 @@ class Notification extends BaseModel
|
|
|
'content' => '你有一条设备调用已完成消息,请确认相关信息:',
|
|
|
'official' => [
|
|
|
'template_id' => 'dlRsvUWqeziBvGbdT89b69slvZll6gZVRCotIXCwwjM',
|
|
|
- 'page' => 'pages/order-detail/index?id=' . $this['order_id'],
|
|
|
+ 'page' => '/pages/create-order-inner/index?id=' . $order->project_id . '&order_id=' . $order->id . '&type=edit',
|
|
|
'data' => [
|
|
|
'first' => '有一个订单已完成,请注意查看!',
|
|
|
'keyword1' => $this['created_at'],
|
| xqd
@@ -321,7 +357,20 @@ class Notification extends BaseModel
|
|
|
} else if($this['status'] == 6) {
|
|
|
return [
|
|
|
'name' => '调用退回通知',
|
|
|
- 'content' => '你有一条设备调用已归还消息,请确认相关信息:'
|
|
|
+ 'content' => '你有一条设备调用已归还消息,请确认相关信息:',
|
|
|
+ 'official' => [
|
|
|
+ 'template_id' => 'dlRsvUWqeziBvGbdT89b69slvZll6gZVRCotIXCwwjM',
|
|
|
+ 'page' => '/pages/create-order-inner/index?id=' . $order->project_id . '&order_id=' . $order->id . '&type=edit',
|
|
|
+ 'data' => [
|
|
|
+ 'first' => '有一个设备调用订单已完成,请注意查看',
|
|
|
+ 'keyword1' => $this['created_at'],
|
|
|
+ 'keyword2' => $type,
|
|
|
+ 'keyword3' => $status_name,
|
|
|
+ 'keyword4' => $source,
|
|
|
+ 'keyword5' => $detail,
|
|
|
+ 'remark' => '请进入小程序查看详情',
|
|
|
+ ]
|
|
|
+ ]
|
|
|
];
|
|
|
} else if($this['status'] == 7) {
|
|
|
return [
|