| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- *
- * @copyright ©2020 点小铺
- * @author hanj
- * @link: https://dyuit.com
- * Created by VSCode
- */
- namespace app\api\service;
- use think\Cache;
- class User
- {
- /**
- * 记忆上门自提联系人
- * @param $userId
- * @param $linkman
- * @param $phone
- * @return bool
- */
- public static function setLastExtract($userId, $linkman, $phone)
- {
- // 缓存时间30天
- $expire = 86400 * 30;
- return Cache::set("{$userId}_LastExtract", compact('linkman', 'phone'), $expire);
- }
- /**
- * 记忆上门自提联系人
- * @param $userId
- * @return mixed
- */
- public static function getLastExtract($userId)
- {
- if ($lastExtract = Cache::get("{$userId}_LastExtract")) {
- return $lastExtract;
- }
- return ['linkman' => '', 'phone' => ''];
- }
- }
|