BalanceLogModel.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Models;
  12. use App\Services\RedisService;
  13. /**
  14. * 余额充值提现订单管理-模型
  15. * @author laravel开发员
  16. * @since 2020/11/11
  17. * Class BalanceLogModel
  18. * @package App\Models
  19. */
  20. class BalanceLogModel extends BaseModel
  21. {
  22. // 设置数据表
  23. protected $table = 'balance_logs';
  24. /**
  25. * 验证记录是否已经存在
  26. * @param $hash
  27. * @return array|bool
  28. */
  29. public static function checkExists($hash)
  30. {
  31. $cacheKey = "caches:wallet:balanceLog:{$hash}";
  32. $check = RedisService::get($cacheKey);
  33. if(RedisService::exists($cacheKey)){
  34. return $check;
  35. }
  36. $info = BalanceLogModel::where(['hash'=> $hash,'mark'=>1])->first();
  37. $info = $info? $info->toArray() : [];
  38. if($info){
  39. RedisService::set($cacheKey, $info, rand(600,1200));
  40. }
  41. return $info;
  42. }
  43. }