获取openId接口修改

This commit is contained in:
张松 2025-03-07 18:37:10 +08:00
parent 7f8b65a711
commit 2370abaa59
2 changed files with 19 additions and 2 deletions

View File

@ -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()
));
}
/**

View File

@ -4,6 +4,7 @@ import com.czg.order.service.ShopOrderStatisticService;
import com.czg.order.service.ShopProdStatisticService;
import com.czg.order.service.ShopTableOrderStatisticService;
import jakarta.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
@ -18,7 +19,10 @@ public class StatisticTask {
@Resource
private ShopOrderStatisticService shopOrderStatisticService;
// @Scheduled(cron = "0 0 18 * * ?")
public void run() {
shopOrderStatisticService.statistic();
shopProdStatisticService.statistic();
shopTableOrderStatisticService.statistic();
}
}