feat(admin,front): 新增师傅资料修改功能,支持头像和接单手机号
- 新增 master/saveProfile 接口用于保存师傅资料 - 新增前端页面入口,允许已认证师傅修改头像和手机号 - 新增头像验证逻辑,确保头像属于当前用户且不超过10MB - 新增 masterProfilePayload 工具函数验证手机号格式 - 优化会员中心账号页面,新增头像上传和展示功能 - 修复头像URL处理逻辑,支持CDN地址转换
这个提交包含在:
@@ -171,7 +171,7 @@ class Auth extends Base
|
||||
'legal_person' => $merchant && isset($merchant['legal_person']) ? (string)$merchant['legal_person'] : '',
|
||||
'legal_mobile' => $merchant && isset($merchant['legal_mobile']) ? (string)$merchant['legal_mobile'] : '',
|
||||
'tech_mobile' => $merchant && isset($merchant['tech_mobile']) ? (string)$merchant['tech_mobile'] : '',
|
||||
'avatar' => $user['avatar'] ?: '',
|
||||
'avatar' => !empty($user['avatar']) ? (strpos((string)$user['avatar'], 'http') === 0 ? $user['avatar'] : cdnurl($user['avatar'], true)) : '',
|
||||
'balance' => (float)$user['money'],
|
||||
'coupon_count' => (int)$couponCount,
|
||||
'unread_count' => (int)$unread,
|
||||
@@ -190,7 +190,8 @@ class Auth extends Base
|
||||
public function saveAccount()
|
||||
{
|
||||
$uid = $this->uid();
|
||||
$userType = trim((string)$this->request->post('user_type', 'personal'));
|
||||
$currentUserType = Db::name('user')->where('id', $uid)->value('user_type');
|
||||
$userType = trim((string)$this->request->post('user_type', $currentUserType ?: 'personal'));
|
||||
if (!in_array($userType, ['personal', 'merchant'], true)) {
|
||||
$userType = 'personal';
|
||||
}
|
||||
@@ -240,9 +241,14 @@ class Auth extends Base
|
||||
}
|
||||
$userUpdate['mobile'] = $mobile;
|
||||
}
|
||||
$avatar = trim((string)$this->request->post('avatar', ''));
|
||||
if ($avatar !== '') {
|
||||
$this->validateAvatar($avatar);
|
||||
$userUpdate['avatar'] = $avatar;
|
||||
}
|
||||
Db::name('user')->where('id', $uid)->update($userUpdate);
|
||||
|
||||
if ($userType === 'merchant' && $merchantRel && $merchantRel['role'] === 'owner') {
|
||||
if ($userType === 'merchant' && $merchantRel && $merchantRel['role'] === 'owner' && $this->request->has('company_name', 'post')) {
|
||||
$existMerchant = $merchantRel['merchant'];
|
||||
$curUser = Db::name('user')->where('id', $uid)->find();
|
||||
$merchantSave = [
|
||||
|
||||
在新工单中引用
屏蔽一个用户