更新 app/api/lists/AccountLogLists.php

补丁
This commit is contained in:
mkm 2023-09-08 21:30:47 +08:00
parent 7e4931803e
commit 00d3998750

View File

@ -16,14 +16,16 @@ namespace app\api\lists;
use app\common\enum\user\AccountLogEnum;
use app\common\model\user\UserAccountLog;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Sum;
use app\common\lists\ListsExtendInterface;
use app\common\lists\ListsSearchInterface;
/**
* 账户流水列表
* Class AccountLogLists
* @package app\shopapi\lists
*/
class AccountLogLists extends BaseApiDataLists
class AccountLogLists extends BaseApiDataLists implements ListsExtendInterface
{
/**
@ -79,16 +81,20 @@ class AccountLogLists extends BaseApiDataLists
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
foreach ($lists as &$item) {
$item['type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
$symbol = $item['action'] == AccountLogEnum::DEC ? '-' : '+';
$item['change_amount_desc'] = $symbol . $item['change_amount'];
}
return $lists;
}
public function extend(){
$deposit=UserAccountLog::where($this->queryWhere())->where('change_type',203)->sum('change_amount');
$user_money=UserAccountLog::where($this->queryWhere())->where('change_type',202)->sum('change_amount');
return ['deposit'=>$deposit,'user_money'=>$user_money];
}
/**
* @notes 获取数量