diff --git a/application/admin/controller/user/User.php b/application/admin/controller/user/User.php index 6908ad6..032f2cd 100755 --- a/application/admin/controller/user/User.php +++ b/application/admin/controller/user/User.php @@ -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); } diff --git a/application/api/controller/Auth.php b/application/api/controller/Auth.php index 29df7ee..15af289 100644 --- a/application/api/controller/Auth.php +++ b/application/api/controller/Auth.php @@ -8,7 +8,8 @@ use think\Db; * 用户端 · 认证与登录(Module-AUTH) * 路由: * POST /api/v1/auth/wx-login A1 微信授权登录 - * POST /api/v1/auth/bind-phone A2 手机号绑定 + * POST /api/v1/auth/bind-phone A2 手机号绑定(手动输入) + * POST /api/v1/auth/wx-phone A5 微信手机号快捷获取(getPhoneNumber) * POST /api/v1/auth/switch-type A3 个人/商家身份切换 * GET /api/v1/auth/profile A4 个人资料 */ @@ -91,6 +92,96 @@ class Auth extends V1 $this->ok(['phone' => $phone]); } + /** + * A5 微信手机号快捷获取 + * 入参 { code }(`