|
|
|
@@ -100,7 +100,8 @@ public class WxMerchantController extends BaseController { |
|
|
|
|
|
|
|
@ApiOperation("获取微信OpenId") |
|
|
|
@GetMapping("/getOpenIdByPhone") |
|
|
|
public ResultData getOpenIdByPhone() { |
|
|
|
@ApiImplicitParam(name = "phone", value = "商户C端注册手机号", dataType = "String", paramType = "query", required = true) |
|
|
|
public ResultData getOpenIdByPhone(@ModelAttribute String phone) { |
|
|
|
log.debug("[" + getIpAddr() + "] WxMerchantController::getOpenIdByPhone"); |
|
|
|
// hasPermission |
|
|
|
WxMerchantBUser user = getUser(); |
|
|
|
@@ -109,12 +110,17 @@ public class WxMerchantController extends BaseController { |
|
|
|
merchant.setId(user.getMerchantId()); |
|
|
|
WxMerchant wxMerchant = wxMerchantService.findOne(merchant); |
|
|
|
if ( wxMerchant != null && buser.getPhone().equals(wxMerchant.getLinkPhone()) ) { |
|
|
|
if (StringUtils.isBlank(phone)) { |
|
|
|
phone = wxMerchant.getLinkPhone(); |
|
|
|
} |
|
|
|
WxCUser cuUser = new WxCUser(); |
|
|
|
cuUser.updateTenantInfo(getTenantInfo()); |
|
|
|
cuUser.setPhone(wxMerchant.getLinkPhone()); |
|
|
|
cuUser.setPhone(phone); |
|
|
|
WxCUser mUser = cUserService.getByObject(cuUser); |
|
|
|
if (mUser != null) { |
|
|
|
return new ResultData(mUser.getOpenId()); |
|
|
|
} else { |
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(ErrorCode.USER_NO_PERMISSION); |
|
|
|
|