diff --git a/app/common/dao/user/UserDao.php b/app/common/dao/user/UserDao.php index 30b111b..89df3f3 100644 --- a/app/common/dao/user/UserDao.php +++ b/app/common/dao/user/UserDao.php @@ -77,6 +77,12 @@ class UserDao extends BaseDao return $query->where('User.user_type', $where['user_type']); })->when(isset($where['uid']) && $where['uid'] !== '', function (BaseQuery $query) use ($where) { return $query->where('User.uid', $where['uid']); + })->when(isset($where['agent_id']) && $where['agent_id'] !== '', function (BaseQuery $query) use ($where) { + return $query->where('User.agent_district_id' ,'>', 0); + })->when(isset($where['is_share']) && $where['is_share'] !== '', function (BaseQuery $query) use ($where) { + return $query->hasWhere('assets', function ($query) use ($where) { + $query->where('share_point', '>', 0); + }); })->when(isset($where['status']) && $where['status'] !== '', function (BaseQuery $query) use ($where) { return $query->where('User.status', intval($where['status'])); })->when(isset($where['group_id']) && $where['group_id'], function (BaseQuery $query) use ($where) { diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php index 4d25201..b8dc390 100644 --- a/app/common/model/user/User.php +++ b/app/common/model/user/User.php @@ -161,6 +161,11 @@ class User extends BaseModel return $this->hasOne(UserGroup::class, 'group_id', 'group_id'); } + public function assets() + { + return $this->hasOne(UserAssets::class, 'uid', 'uid'); + } + public function spread() { return $this->hasOne(User::class, 'uid', 'spread_uid'); diff --git a/app/common/repositories/user/UserAssetsLogRepository.php b/app/common/repositories/user/UserAssetsLogRepository.php index 9f15a76..aaff4ef 100644 --- a/app/common/repositories/user/UserAssetsLogRepository.php +++ b/app/common/repositories/user/UserAssetsLogRepository.php @@ -733,6 +733,9 @@ class UserAssetsLogRepository extends BaseRepository $changeType = $this->getChangeType(); foreach ($data as $item) { $item['type'] = $changeType[$item['type']]; + if($item['count'] > 0){ + $item['count'] = "+".$item['count']; + } $list[] = $item; } return compact('count', 'list'); diff --git a/app/common/repositories/user/UserRepository.php b/app/common/repositories/user/UserRepository.php index a5f2db3..2ac5d6e 100644 --- a/app/common/repositories/user/UserRepository.php +++ b/app/common/repositories/user/UserRepository.php @@ -180,9 +180,12 @@ class UserRepository extends BaseRepository 'member' => function ($query) { $query->field('user_brokerage_id,brokerage_level,brokerage_name,brokerage_icon'); }, - 'group']); + 'group', + 'assets' => function($query){ + $query->field('share_point'); + }]); $make = app()->make(UserLabelRepository::class); - $count = $query->count($this->dao->getPk()); + $count = $query->count(); $list = $query->page($page, $limit)->select()->each(function ($item) use ($make) { return $item->label = count($item['label_id']) ? $make->labels($item['label_id']) : []; }); diff --git a/app/controller/admin/user/User.php b/app/controller/admin/user/User.php index 7c286f4..6840eb7 100644 --- a/app/controller/admin/user/User.php +++ b/app/controller/admin/user/User.php @@ -15,6 +15,8 @@ namespace app\controller\admin\user; use app\common\repositories\store\ExcelRepository; +use app\common\repositories\user\UserAssetsLogRepository; +use app\common\repositories\user\UserAssetsRepository; use app\common\repositories\user\UserSpreadLogRepository; use app\common\repositories\user\UserVisitRepository; use crmeb\basic\BaseController; @@ -89,6 +91,8 @@ class User extends BaseController 'group_id', 'phone', 'uid', + 'agent_id', + 'is_share', ]); [$page, $limit] = $this->getPage(); return app('json')->success($this->repository->getList($where, $page, $limit)); @@ -470,6 +474,25 @@ class User extends BaseController return app('json')->success($this->repository->userOrderDetail($id)); } + public function info($id){ + if (!$this->repository->exists($id)) + return app('json')->fail('数据不存在'); + $user = $this->repository->getWhere(['uid' => $id]); + $assets = app(UserAssetsRepository::class)->assets($id); + $user['assets'] = $assets; + $user['spread'] = $this->repository->getWhere(['uid' => $user['spread_uid']]); + return app('json')->success($user); + } + + public function assetsLog($id, $type){ + /** + * @var UserAssetsLogRepository $logRepository + */ + $logRepository = \app()->make(UserAssetsLogRepository::class); + [$page, $limit] = $this->getPage(); + return \app('json')->success($logRepository->list($id, ['asset_type' => $type], $page, $limit)); + } + public function order($id, StoreOrderRepository $repository) { if (!$this->repository->exists($id)) diff --git a/app/controller/admin/user/UserGroup.php b/app/controller/admin/user/UserGroup.php index d2bf054..0cb7cc8 100644 --- a/app/controller/admin/user/UserGroup.php +++ b/app/controller/admin/user/UserGroup.php @@ -59,8 +59,11 @@ class UserGroup extends BaseController public function lst() { [$page, $limit] = $this->getPage(); + $all = $this->request->param("all"); $where = array(); - $where[] = ['group_id', '>', 1]; + if(empty($all)){ + $where[] = ['group_id', '>', 1]; + } Log::info(json_encode($where)); return app('json')->success($this->repository->getList($where, $page, $limit)); } diff --git a/route/admin/user.php b/route/admin/user.php index 2fe54d3..6fa92fe 100644 --- a/route/admin/user.php +++ b/route/admin/user.php @@ -85,6 +85,12 @@ Route::group(function () { Route::get('detail/:id', '/detail')->name('systemUserDetail')->option([ '_alias' => '用户详情', ]); + Route::get('info/:id', '/info')->name('systemUserInfo')->option([ + '_alias' => '用户详情', + ]); + Route::get('assets_log/:id/:type', '/assetsLog')->name('systemUserAssetsLog')->option([ + '_alias' => '用户资产记录', + ]); Route::get('order/:id', '/order')->name('systemUserOrder')->option([ '_alias' => '用户消费记录', ]); diff --git a/view/admin/.env.production b/view/admin/.env.production index 18fb70a..f9f4d1d 100644 --- a/view/admin/.env.production +++ b/view/admin/.env.production @@ -2,6 +2,6 @@ ENV = 'production' # base api -VUE_APP_BASE_API = +VUE_APP_BASE_API ='https://b2.njrenzhou.com' # socket 连接地址 -VUE_APP_WS_URL = +VUE_APP_WS_URL ='ws://mer1.crmeb.net' diff --git a/view/admin/src/api/user.js b/view/admin/src/api/user.js index aa3f473..b161526 100644 --- a/view/admin/src/api/user.js +++ b/view/admin/src/api/user.js @@ -182,6 +182,13 @@ export function userNewsApi(data) { export function userDetailApi(uid) { return request.get(`user/detail/${uid}`) } + +/** + * @description 用户 -- 详情头部 + */ +export function userInfoApi(uid) { + return request.get(`user/info/${uid}`) +} /** * @description 用户 -- 详情消费记录 */ @@ -200,6 +207,12 @@ export function userCouponApi(uid, data) { export function userBillApi(uid, data) { return request.get(`user/bill/${uid}`, data) } +/** + * @description 用户 -- 余额明细 + */ +export function userAssetsLogApi(uid, type, data) { + return request.get(`user/assets_log/${uid}/${type}`, data) +} /** * @description 用户 -- 城市列表 */ @@ -310,7 +323,7 @@ export function recordListImportApi(data) { } /** * 获取版权信息 - * @returns + * @returns */ export function getVersion() { return request.get('../api/version') @@ -374,4 +387,4 @@ export function getVersion() { */ export function giveMemberApi(id) { return request.get(`user/svip/${id}/form`) -} \ No newline at end of file +} diff --git a/view/admin/src/views/user/list/index.vue b/view/admin/src/views/user/list/index.vue index 5c416ff..8179e1d 100644 --- a/view/admin/src/views/user/list/index.vue +++ b/view/admin/src/views/user/list/index.vue @@ -2,14 +2,14 @@