|
@@ -14,6 +14,7 @@ import com.ruoyi.app.domain.vo.AppMemberVo;
|
|
import com.ruoyi.app.service.ITbAppUserService;
|
|
import com.ruoyi.app.service.ITbAppUserService;
|
|
import com.ruoyi.app.service.ITbFamilyMemberService;
|
|
import com.ruoyi.app.service.ITbFamilyMemberService;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
+import com.ruoyi.common.utils.bean.BeanUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -129,8 +130,17 @@ public class TbAppUserController extends BaseController {
|
|
@PreAuthorize("@ss.hasPermi('system:appUser:add')" )
|
|
@PreAuthorize("@ss.hasPermi('system:appUser:add')" )
|
|
@Log(title = "会员" , businessType = BusinessType.INSERT)
|
|
@Log(title = "会员" , businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody TbAppUser tbAppUser) {
|
|
|
|
- return toAjax(iTbAppUserService.save(tbAppUser) ? 1 : 0);
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody AppMemberVo memberVo) {
|
|
|
|
+ if (StringUtils.isBlank(memberVo.getMobile())){
|
|
|
|
+ return AjaxResult.error("手机号不能为空");
|
|
|
|
+ }
|
|
|
|
+ AppMemberVo member = iTbAppUserService.getMember("user",null,memberVo.getMobile());
|
|
|
|
+ if (member != null) {
|
|
|
|
+ return AjaxResult.error("该手机号已经注册");
|
|
|
|
+ }
|
|
|
|
+ member = new AppMemberVo();
|
|
|
|
+ BeanUtils.copyBeanProp(member,memberVo);
|
|
|
|
+ return toAjax(iTbAppUserService.saveOrUpdate(member) ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -141,8 +151,12 @@ public class TbAppUserController extends BaseController {
|
|
@Log(title = "会员" , businessType = BusinessType.UPDATE)
|
|
@Log(title = "会员" , businessType = BusinessType.UPDATE)
|
|
@PutMapping("/editAppMember")
|
|
@PutMapping("/editAppMember")
|
|
public AjaxResult editAppMember(@RequestBody AppMemberVo memberVo) {
|
|
public AjaxResult editAppMember(@RequestBody AppMemberVo memberVo) {
|
|
-
|
|
|
|
- return toAjax(iTbAppUserService.saveOrUpdate(memberVo) ? 1 : 0);
|
|
|
|
|
|
+ if (StringUtils.isBlank(memberVo.getMobile())){
|
|
|
|
+ return AjaxResult.error("手机号不能为空");
|
|
|
|
+ }
|
|
|
|
+ AppMemberVo member = iTbAppUserService.getMember("user",null,memberVo.getMobile());
|
|
|
|
+ BeanUtils.copyBeanProp(member,memberVo);
|
|
|
|
+ return toAjax(iTbAppUserService.saveOrUpdate(member) ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|