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
| <?php
|
| namespace app\api\service\user;
|
| use think\facade\Cache;
|
| class UserService
| {
| /**
| * 记忆上门自提联系人
| */
| public static function setLastExtract($userId, $linkman, $phone)
| {
| // 缓存时间30天
| $expire = 86400 * 30;
| return Cache::set("{$userId}_LastExtract", compact('linkman', 'phone'), $expire);
| }
|
| /**
| * 记忆上门自提联系人
| */
| public static function getLastExtract($userId)
| {
| if ($lastExtract = Cache::get("{$userId}_LastExtract")) {
| return $lastExtract;
| }
| return ['linkman' => '', 'phone' => ''];
| }
|
| }
|
|