feat(浏览器扩展): 改用新店铺名称精确匹配店铺接口

This commit is contained in:
2026-08-27 14:14:19 +08:00
parent bf602ed4b2
commit b3c77c08b1
18 changed files with 61 additions and 133 deletions
@@ -21,6 +21,9 @@ public interface PddShopService extends IService<PddShopPO> {
PageResultVO<PddShopVO> getPddShopPage(PageQueryDTO<PddShopFilterDTO> pageQueryDTO);
/** 当前公司内按 mallName trim 后精确匹配;未找到返回 null */
PddShopVO matchByExactMallName(String mallName);
PddShopVO getPddShopDetail(Long id);
/** 转为 VO;withAuth=true 时按 pddAuthId 嵌套授权信息(不含 token) */
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
@@ -149,6 +150,19 @@ public class PddShopServiceImpl extends ServiceImpl<PddShopMapper, PddShopPO> im
(int) pageQueryDTO.getPage(), (int) pageQueryDTO.getPageSize());
}
@Override
public PddShopVO matchByExactMallName(String mallName) {
if (!StringUtils.hasText(mallName)) {
return null;
}
Long companyId = currentUserContext.getCurrentCompanyId();
PddShopPO shop = this.getOne(new LambdaQueryWrapper<PddShopPO>()
.eq(PddShopPO::getCompanyId, companyId)
.eq(PddShopPO::getMallName, mallName.trim())
.last("LIMIT 1"));
return shop == null ? null : toBriefVo(shop);
}
@Override
public PddShopVO getPddShopDetail(Long id) {
PddShopPO shop = this.getById(id);
@@ -2,9 +2,11 @@ package top.xyquan.ecomdmbbackend.modules.open.api.channel.pdd.shop.controller;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.xyquan.ecomdmbbackend.common.annotation.RequireOpenScope;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
@@ -31,4 +33,11 @@ public class OpenPddShopController {
PageResultVO<PddShopVO> result = pddShopService.getPddShopPage(pageQueryDTO);
return ApiResponse.success("获取渠道店铺列表成功", result);
}
@GetMapping("/match-by-name")
@RequireOpenScope(value = "open:shop:pdd:read", description = "按店铺名称精确匹配拼多多渠道店铺")
public ApiResponse<PddShopVO> matchByName(@RequestParam("mallName") String mallName) {
PddShopVO shop = pddShopService.matchByExactMallName(mallName);
return ApiResponse.success(shop != null ? "匹配成功" : "未找到店铺", shop);
}
}
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"updatedAt": "2026-08-26T06:08:57.484Z",
"updatedAt": "2026-08-27T06:07:51.848Z",
"features": [
{
"id": "pdd-ad-fee",
@@ -12,7 +12,7 @@
"https://yingxiao.pinduoduo.com/"
],
"entry": "pdd-ad-fee.js",
"sha256": "20c8c695a82e9b9c9faa4a8ca9284ce79095cea7fe6260ae647a4437ed4482e9",
"sha256": "8a3d135c052c69daaf4eeb61e25e6e124f7cfe82d4b05ebaae372312aa70dcf8",
"executionWorld": "main"
}
]
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long