| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\CoinLogModel;
- use App\Services\BaseService;
- use App\Services\RedisService;
- /**
- * 币种明细(提币、存币)-服务类
- * Class CoinLogService
- * @package App\Services\Common
- */
- class CoinLogService extends BaseService
- {
- // 静态对象
- protected static $instance = null;
- /**
- * 构造函数
- * @since 2020/11/10
- * CoinLogService constructor.
- */
- public function __construct()
- {
- $this->model = new CoinLogModel();
- }
- /**
- * 静态入口
- * @return static|null
- */
- public static function make()
- {
- if (!self::$instance) {
- self::$instance = (new static());
- }
- return self::$instance;
- }
- /**
- * 验证是否存在
- * @param \App\Services\字段名 $field
- * @param \App\Services\字段值 $value
- * @param string $pk
- * @return mixed
- */
- public function checkExists($field, $value, $pk = 'id')
- {
- $cacheKey = "caches:coinLogs:exists:{$field}_{$value}";
- if($result = RedisService::get($cacheKey)){
- return $result;
- }
- $result = parent::checkExists($field, $value, $pk);
- if($result){
- RedisService::set($cacheKey, $result, rand(3,5));
- }
- return $result;
- }
- }
|