feat(marketing): user profile update, ad placement management, logo limits

- Add PUT /auth/profile endpoint for nickname and avatar updates
- Add ad_placements table and CRUD admin API for managing ad units
- Add GET /marketing/ad-config public API for mini-program to fetch ad config
- Reduce logo limit from 10 to 3 per user, add 2MB file size validation

Made-with: Cursor
This commit is contained in:
nepiedg
2026-04-04 04:02:06 +08:00
parent b4170b4863
commit 1c0aeb152a
11 changed files with 347 additions and 7 deletions
@@ -7,9 +7,13 @@ import (
"wx_service/internal/marketing/repository"
)
const MaxLogosPerUser = 10
const MaxLogosPerUser = 3
const MaxLogoFileSize = 2 * 1024 * 1024 // 2MB
var ErrLogoLimitReached = errors.New("Logo 数量已达上限")
var (
ErrLogoLimitReached = errors.New("Logo 数量已达上限")
ErrLogoTooLarge = errors.New("Logo 文件不能超过 2MB")
)
type UserLogoService struct {
repo *repository.UserLogoRepository
@@ -26,6 +30,10 @@ type SaveLogoRequest struct {
}
func (s *UserLogoService) Save(userID uint, req SaveLogoRequest) (*model.UserLogo, error) {
if req.FileSize > MaxLogoFileSize {
return nil, ErrLogoTooLarge
}
count, err := s.repo.CountByUser(userID)
if err != nil {
return nil, err