获取openId接口修改
This commit is contained in:
@@ -2,6 +2,8 @@ package com.czg.controller.user;
|
||||
|
||||
import com.czg.account.dto.auth.LoginTokenDTO;
|
||||
import com.czg.account.dto.auth.UserAuthorizationLoginDTO;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.UserAuthorizationService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.MyStpLogic;
|
||||
@@ -21,6 +23,8 @@ import java.util.Map;
|
||||
public class UserAuthorizationController {
|
||||
@Resource
|
||||
private UserAuthorizationService userAuthorizationService;
|
||||
@Resource
|
||||
private ShopInfoService shopInfoService;
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
@@ -39,8 +43,17 @@ public class UserAuthorizationController {
|
||||
* @return 返回openId
|
||||
*/
|
||||
@GetMapping("/openId")
|
||||
public CzgResult<String> getOpenId(@RequestParam String code, @RequestParam String source) {
|
||||
return CzgResult.success(userAuthorizationService.getOpenId(code, source));
|
||||
public CzgResult<Map<String, String>> getOpenId(@RequestParam String code, @RequestParam String source, @RequestParam Long shopId) {
|
||||
String openId = userAuthorizationService.getOpenId(code, source);
|
||||
ShopInfo shopInfo = shopInfoService.getById(shopId);
|
||||
if (shopInfo == null){
|
||||
return CzgResult.failure("店铺信息不存在");
|
||||
}
|
||||
return CzgResult.success(Map.of(
|
||||
"openId", openId,
|
||||
"shopImage", shopInfo.getLogo(),
|
||||
"shopName", shopInfo.getShopName()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user