diff --git a/app/adminapi/lists/user/UserLists.php b/app/adminapi/lists/user/UserLists.php index 5e7bd5cd..4e504e5d 100644 --- a/app/adminapi/lists/user/UserLists.php +++ b/app/adminapi/lists/user/UserLists.php @@ -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' => '注册时间', ]; }