update 添加会员接口

This commit is contained in:
Guoqs
2025-04-22 14:11:05 +08:00
parent 144526338d
commit 66a5790d1e
2 changed files with 20 additions and 6 deletions

View File

@@ -1,6 +1,5 @@
package com.jsowell.web.controller.pile;
import com.alibaba.fastjson2.JSON;
import com.jsowell.common.annotation.Log;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
@@ -12,7 +11,6 @@ import com.jsowell.pile.domain.MemberGroup;
import com.jsowell.pile.dto.MemberGroupDTO;
import com.jsowell.pile.service.MemberGroupService;
import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.base.LoginUserDetailVO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.web.MemberGroupVO;
import org.springframework.beans.factory.annotation.Autowired;
@@ -122,7 +120,20 @@ public class MemberGroupController extends BaseController {
*/
@PostMapping("/addMember")
public AjaxResult addMember(@RequestBody MemberGroupDTO dto) {
return toAjax(memberGroupService.addMember(dto));
AjaxResult ajaxResult;
try {
int i = memberGroupService.addMember(dto);
if (i > 0) {
ajaxResult = AjaxResult.success();
} else {
ajaxResult = AjaxResult.error();
}
} catch (BusinessException e) {
ajaxResult = AjaxResult.error(e.getMessage());
} catch (Exception e) {
ajaxResult = AjaxResult.error("添加会员失败");
}
return ajaxResult;
}
/**