feat(admin): 会员列表去角色组/邮箱/等级列,手机号全量展示;新增微信手机号快捷获取接口
需求:后台「会员列表」取消『角色组 / 电子邮箱 / 等级』三列;手机号要全部能取到并展示。 - user/user 列表:移除 group.name / email / level 三列,手机号列移到昵称之后并加格式化: 有绑定号→直接显示;未绑定但有发布信息→显示该会员最近一条发布信息的联系电话并标注「来自发布信息」;两者都没有→显示「未绑定」 - user/user 控制器 index():改用 toArray() 后按行补 mobile_source,未绑定手机号时回落到 fc_post.phone(不含软删) - 新增 A5 POST /api/v1/auth/wx-phone:用小程序 access_token 调 phonenumber.getPhoneNumber 换号写入 fa_user.mobile; access_token 带缓存(fc_config wx.accessToken/wx.accessTokenExpire,提前 5 分钟失效);微信侧失败时给出「请改用手动输入」 的业务文案,前端据此回落 A2 bind-phone —— 修复「微信会员手机号取不到」的根因(此前小程序侧绑定是假实现) - 路由登记:application/route.php 新增 api/v1/auth/wx-phone - tools/verify-api.mjs:新增 A5(缺 code 文案)与 A2(手机号格式)检查
这个提交包含在:
@@ -4,6 +4,7 @@ namespace app\admin\controller\user;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use app\common\library\Auth;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 会员管理
|
||||
@@ -45,11 +46,34 @@ class User extends Backend
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
$rows = [];
|
||||
foreach ($list as $k => $v) {
|
||||
$v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
|
||||
$v->hidden(['password', 'salt']);
|
||||
|
||||
$item = $v->toArray();
|
||||
|
||||
// 手机号全量展示(v1.0.8):
|
||||
// 微信登录注册的会员默认没有绑定手机号(fa_user.mobile 为空),
|
||||
// 此时回落到「该会员最近一条发布信息里的联系电话」,并标记来源 mobile_source=post;
|
||||
// 两者都没有则返回空串,前端显示「未绑定」。
|
||||
$mobile = trim((string)$item['mobile']);
|
||||
if ($mobile === '') {
|
||||
$postPhone = Db::name('fc_post')
|
||||
->where('user_id', $v->id)
|
||||
->where('phone', '<>', '')
|
||||
->whereNull('deletetime')
|
||||
->order('id desc')
|
||||
->value('phone');
|
||||
if ($postPhone) {
|
||||
$item['mobile'] = (string)$postPhone;
|
||||
$item['mobile_source'] = 'post';
|
||||
}
|
||||
}
|
||||
$rows[] = $item;
|
||||
}
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
$result = ["total" => $list->total(), "rows" => $rows];
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户