feat(admin,front): 新增师傅资料修改功能,支持头像和接单手机号
- 新增 master/saveProfile 接口用于保存师傅资料 - 新增前端页面入口,允许已认证师傅修改头像和手机号 - 新增头像验证逻辑,确保头像属于当前用户且不超过10MB - 新增 masterProfilePayload 工具函数验证手机号格式 - 优化会员中心账号页面,新增头像上传和展示功能 - 修复头像URL处理逻辑,支持CDN地址转换
这个提交包含在:
@@ -35,6 +35,17 @@ class Base extends Api
|
||||
return (int)$this->auth->id;
|
||||
}
|
||||
|
||||
/** 验证新头像属于当前账号,且是符合限制的图片附件。 */
|
||||
protected function validateAvatar($url)
|
||||
{
|
||||
$attachment = Db::name('attachment')->where('user_id', $this->uid())
|
||||
->where('category', 'avatar')->where('url', $url)->find();
|
||||
if (!$attachment || (int)$attachment['filesize'] > 10 * 1024 * 1024
|
||||
|| !in_array(strtolower((string)$attachment['mimetype']), ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/bmp'], true)) {
|
||||
$this->error('头像无效,请重新上传不超过10MB的图片');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 师傅档案
|
||||
*/
|
||||
|
||||
在新工单中引用
屏蔽一个用户