|
|
@@ -96,7 +96,7 @@ class MoneyLog Extends Model
|
|
|
}
|
|
|
|
|
|
//支收总览
|
|
|
- public static function getCountAllBalance(int $type, string $time = '', string $user_ids='')
|
|
|
+ public static function getCountAllBalance(int $type, string $time = '', array $user_ids=[])
|
|
|
{
|
|
|
$list = self::where('status', self::STATUS_NORMAL);
|
|
|
if($type == 1 && !empty($time)) $list = $list->whereMonth('create_date', $time);
|
|
|
@@ -105,7 +105,7 @@ class MoneyLog Extends Model
|
|
|
$expTime = explode(',', $time);
|
|
|
$list = $list->whereTime('create_date', [$expTime[0], $expTime[1]]);
|
|
|
}
|
|
|
- if(!empty($user_ids)) $list = $list->whereIn('user_id', $user_ids);
|
|
|
+ if(count($user_ids) > 0) $list = $list->whereIn('user_id', $user_ids);
|
|
|
$list = $list
|
|
|
->field('type, sum(if(type=1,`change`,0)) as income, sum(if(type=2,`change`, 0)) as expenditure')
|
|
|
->group('type')
|
|
|
@@ -115,7 +115,7 @@ class MoneyLog Extends Model
|
|
|
|
|
|
|
|
|
//统计用户余额
|
|
|
- public static function getCountAllUserBalance(int $type, string $time = '', string $user_ids='')
|
|
|
+ public static function getCountAllUserBalance(int $type, string $time = '', array $user_ids=[])
|
|
|
{
|
|
|
$list = self::where('status', self::STATUS_NORMAL);
|
|
|
|
|
|
@@ -125,7 +125,7 @@ class MoneyLog Extends Model
|
|
|
$expTime = explode(',', $time);
|
|
|
$list = $list->whereTime('create_date', [$expTime[0], $expTime[1]]);
|
|
|
}
|
|
|
- if(!empty($user_ids)) $list = $list->whereIn('user_id', $user_ids);
|
|
|
+ if(count($user_ids) >0) $list = $list->whereIn('user_id', $user_ids);
|
|
|
$list = $list
|
|
|
->field('bank_account, sum(if(type=1,`change`,0)) as income, sum(if(type=2,`change`, 0)) as expenditure')
|
|
|
->group('bank_account')
|
|
|
@@ -134,7 +134,7 @@ class MoneyLog Extends Model
|
|
|
}
|
|
|
|
|
|
//统计所有月统计
|
|
|
- public static function getCountAllMonthBalance(int $type, string $time = '', string $user_ids='')
|
|
|
+ public static function getCountAllMonthBalance(int $type, string $time = '', array $user_ids=[])
|
|
|
{
|
|
|
$list = self::where('status', self::STATUS_NORMAL);
|
|
|
|
|
|
@@ -146,7 +146,7 @@ class MoneyLog Extends Model
|
|
|
$expTime = explode(',', $time);
|
|
|
$list = $list->whereTime('create_date', [$expTime[0], $expTime[1]]);
|
|
|
}
|
|
|
- if(!empty($user_ids)) $list = $list->whereIn('user_id', $user_ids);
|
|
|
+ if(count($user_ids)> 0) $list = $list->whereIn('user_id', $user_ids);
|
|
|
//月
|
|
|
$list = $list
|
|
|
->field('create_month, sum(if(type=1,`change`,0)) as income, sum(if(type=2,`change`, 0)) as expenditure')
|