LockPasswordTemplate.php
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
+-----------------------------------------------------------------------------------------------------------------------
* 短信模板类:各种业务发送短信的模板
+-----------------------------------------------------------------------------------------------------------------------
* PHP version 7
*
* @category App\Sms
* @package App\Sms
* @author Richer <yangzi1028@163.com>
* @date 2020年6月15日,16:08:39
* @copyright 2021-2022 Richer (http://www.Richer.com/)
* @license http://www.Richer.com/ License
* @link http://www.Richer.com/
*/
namespace App\Sms;
use App\Models\Warning;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
/**
* Class Template
*
* @category App\Sms
* @package App\Sms
* @author Richer <yangzi1028@163.com>
* @date 2020年6月15日,16:08:39
* @copyright 2021-2022 Richer (http://www.Richer.com/)
* @license http://www.Richer.com/ License
* @link http://www.Richer.com/
*/
class LockPasswordTemplate
{
/**
* 获取消息发送的参数
*
* @param Model $model 对象模型
* @param string $target 发送目标
* @param string $operate
* @return array
*/
public static function getParams($model, $target = 'tenant', $operate = 'tenant')
{
$params = [];
switch ($operate) {
case 'tenant':
$params = self::getTenantParams($model, $target);
break;
}
return $params;
}
/**
* @param $model
* @param $target
* @return array
*/
protected static function getTenantParams($model, $target)
{
$tenant = $model->$target;
if (!$tenant) {
return false;
}
return [
'house' => optional($tenant->village)->title . optional($tenant->group)->title.
optional($tenant->building)->title . optional($tenant->room)->title,
'password' => $model->password,
'start_date' => format_date($model->enabled_at, 'Y-m-d'),
'end_date' => format_date($model->expired_at, 'Y-m-d'),
];
}
}