update 用户首页

This commit is contained in:
chenbo 2024-01-23 17:26:00 +08:00
parent 77f4ace7ef
commit ad17a2ddd0
1 changed files with 10 additions and 2 deletions

View File

@ -16,6 +16,7 @@ namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\user\UserTerminalEnum;
use app\common\lists\ListsExcelInterface;
use app\common\logic\ShopRequestLogic;
use app\common\model\Company;
use app\common\model\contract\Contract;
use app\common\model\user\User;
@ -39,7 +40,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
*/
public function setSearch(): array
{
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end', 'company_id'];
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end', 'company_id', 'province', 'city', 'area', 'street', 'village'];
if (empty($this->params['company_id'])) {
unset($allowSearch['company_id']);
unset($this->params['company_id']);
@ -74,7 +75,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
}
}
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract,group_id";
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract,group_id,invite_code";
$lists = User::withSearch($this->setSearch(), $this->params)
->append(['role_name'])
@ -92,6 +93,10 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
foreach ($lists as &$item) {
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
$inviteUserStatistics = ShopRequestLogic::getInviteUserInfo(['promotion_code' => $item['invite_code']]);
$item['register_num'] = $inviteUserStatistics['data']['user_count'];
// $data['merchant_num'] = $inviteUserStatistics['data']['merchant_count'];
$item['trade_amount'] = Db::name('user_invite_first_order_log')->where('user_id', $item['id'])->sum('order_money');
}
return $lists;
@ -136,6 +141,9 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
'account' => '账号',
'mobile' => '手机号码',
'channel' => '注册来源',
'role_name' => '用户角色',
'register_num' => '成功邀请人数',
'trade_amount' => '总计首单金额',
'create_time' => '注册时间',
];
}