推荐人功能

main
fengxinyhyl 7 months ago
parent 1f827846fb
commit 4b0283071a
  1. 2
      app/common/dao/user/UserDao.php
  2. 4
      app/common/repositories/system/CacheRepository.php
  3. 6
      app/common/repositories/user/UserRepository.php
  4. 17
      app/controller/api/user/User.php
  5. 2
      view/admin/src/views/user/list/index.vue

@ -72,7 +72,7 @@ class UserDao extends BaseDao
} }
$query->whereNull('User.cancel_time') $query->whereNull('User.cancel_time')
->when(isset($where['keyword']) && $where['keyword'], function (BaseQuery $query) use ($where) { ->when(isset($where['keyword']) && $where['keyword'], function (BaseQuery $query) use ($where) {
return $query->where('User.uid|User.real_name|User.nickname|User.phone', 'like', '%' . $where['keyword'] . '%'); return $query->where('User.uid|User.account|User.real_name|User.nickname|User.phone', 'like', '%' . $where['keyword'] . '%');
})->when(isset($where['user_type']) && $where['user_type'] !== '', function (BaseQuery $query) use ($where) { })->when(isset($where['user_type']) && $where['user_type'] !== '', function (BaseQuery $query) use ($where) {
return $query->where('User.user_type', $where['user_type']); return $query->where('User.user_type', $where['user_type']);
})->when(isset($where['uid']) && $where['uid'] !== '', function (BaseQuery $query) use ($where) { })->when(isset($where['uid']) && $where['uid'] !== '', function (BaseQuery $query) use ($where) {

@ -66,6 +66,8 @@ class CacheRepository extends BaseRepository
const COUPON_AGREE = 'sys_coupon_agree'; const COUPON_AGREE = 'sys_coupon_agree';
//付费会员协议 //付费会员协议
const SYS_SVIP = 'sys_svip'; const SYS_SVIP = 'sys_svip';
//品质与服务承诺书
const SYS_MERCHANT_SERVE = 'sys_merchant_serve';
public function getAgreeList($type) public function getAgreeList($type)
{ {
@ -75,6 +77,7 @@ class CacheRepository extends BaseRepository
['label' => '平台规则', 'key' => self::PLATFORM_RULE], ['label' => '平台规则', 'key' => self::PLATFORM_RULE],
['label' => '注销重要提示', 'key' => self::CANCELLATION_PROMPT], ['label' => '注销重要提示', 'key' => self::CANCELLATION_PROMPT],
['label' => '商户入驻申请协议', 'key' => self::INTEGRAL_AGREE], ['label' => '商户入驻申请协议', 'key' => self::INTEGRAL_AGREE],
['label' => '品质与服务承诺书', 'key' => self::SYS_MERCHANT_SERVE],
]; ];
if (!$type) { if (!$type) {
$data[] = ['label' => '注销声明', 'key' => self::CANCELLATION_MSG]; $data[] = ['label' => '注销声明', 'key' => self::CANCELLATION_MSG];
@ -104,6 +107,7 @@ class CacheRepository extends BaseRepository
self::PLATFORM_RULE, self::PLATFORM_RULE,
self::COUPON_AGREE, self::COUPON_AGREE,
self::SYS_SVIP, self::SYS_SVIP,
self::SYS_MERCHANT_SERVE,
]; ];
} }

@ -1033,11 +1033,11 @@ class UserRepository extends BaseRepository
* @author xaboy * @author xaboy
* @day 2020/6/22 * @day 2020/6/22
*/ */
public function getOneLevelList($uid, $nickname, $sort, $page, $limit) public function getOneLevelList($uid, $keyword, $sort, $page, $limit)
{ {
$query = $this->search(['spread_uid' => $uid, 'nickname' => $nickname, 'sort' => $sort]); $query = $this->search(['spread_uid' => $uid, 'keyword' => $keyword, 'sort' => $sort]);
$count = $query->count(); $count = $query->count();
$list = $query->setOption('field', [])->field('uid,avatar,nickname,pay_count,pay_price,spread_count,spread_time')->page($page, $limit)->select(); $list = $query->setOption('field', [])->field('uid,avatar,nickname,phone,create_time')->page($page, $limit)->select();
return compact('list', 'count'); return compact('list', 'count');
} }

@ -325,12 +325,21 @@ class User extends BaseController
*/ */
public function spread_list() public function spread_list()
{ {
[$level, $sort, $nickname] = $this->request->params(['level', 'sort', 'keyword'], true); $keyword = $this->request->param('keyword', '');
$uid = $this->request->uid(); $uid = $this->request->uid();
$user = $this->user;
[$page, $limit] = $this->getPage(); [$page, $limit] = $this->getPage();
return app('json')->success($level == 2
? $this->repository->getTwoLevelList($uid, $nickname, $sort, $page, $limit) $data = $this->repository->getOneLevelList($uid, $keyword, 'create_time', $page, $limit);
: $this->repository->getOneLevelList($uid, $nickname, $sort, $page, $limit)); $spread = $this->repository->get($user['spread_uid']);
if($spread){
$data['spread'] = array('uid' => $spread['uid'], 'avatar' => $spread['avatar'],
'nickname' => $spread['nickname'], 'phone' => $spread['phone']);
}else{
$data['spread'] = null;
}
return app('json')->success($data);
} }
/** /**

@ -196,7 +196,7 @@
<!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="changeIntegral(scope.row)">设置积分</el-dropdown-item>--> <!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="changeIntegral(scope.row)">设置积分</el-dropdown-item>-->
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setGroup(scope.row)">设为项目经理</el-dropdown-item> <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setGroup(scope.row)">设为项目经理</el-dropdown-item>
<el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setLabel(scope.row)">设为区域代理</el-dropdown-item> <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setLabel(scope.row)">设为区域代理</el-dropdown-item>
<!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setModify(scope.row)">修改推荐人</el-dropdown-item>--> <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setModify(scope.row)">修改推荐人</el-dropdown-item>
<!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setPassword(scope.row)">修改密码</el-dropdown-item>--> <!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setPassword(scope.row)">修改密码</el-dropdown-item>-->
<!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMember(scope.row)">编辑会员等级</el-dropdown-item>--> <!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="setMember(scope.row)">编辑会员等级</el-dropdown-item>-->
<!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="giveMember(scope.row)">付费会员设置</el-dropdown-item>--> <!-- <el-dropdown-item v-if="!scope.row.cancel_time" @click.native="giveMember(scope.row)">付费会员设置</el-dropdown-item>-->

Loading…
Cancel
Save