| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace app\admin\logic;
- use app\common\model\PaymentModel;
- use app\common\model\ShopGoods;
- use app\common\model\WithDrawLogModel;
- use think\facade\Cache;
- /**
- * 提现记录
- * Class ShopGoodsLogic
- * @package app\admin\logic
- */
- class WithdrawLogic
- {
- /**
- * 提现统计
- * @param string $time 时间节点如:2023-03-01
- * @return mixed
- */
- public static function getTotal($time = '0')
- {
- $cacheKey = "caches:withdraw:total_{$time}";
- if(!Cache::has($cacheKey)){
- $data = WithDrawLogModel::where('status', 1)
- ->where(function($query) use($time){
- if($time){
- $query->where('create_at','>=', $time);
- }
- })->sum('practical_money');
- if($data){
- Cache::set($cacheKey, $data, rand(3,5));
- }
- return $data;
- }
- return Cache::get($cacheKey);
- }
- }
|