获取openId接口修改
This commit is contained in:
parent
7f8b65a711
commit
2370abaa59
|
|
@ -2,6 +2,8 @@ package com.czg.controller.user;
|
||||||
|
|
||||||
import com.czg.account.dto.auth.LoginTokenDTO;
|
import com.czg.account.dto.auth.LoginTokenDTO;
|
||||||
import com.czg.account.dto.auth.UserAuthorizationLoginDTO;
|
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.account.service.UserAuthorizationService;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.MyStpLogic;
|
import com.czg.sa.MyStpLogic;
|
||||||
|
|
@ -21,6 +23,8 @@ import java.util.Map;
|
||||||
public class UserAuthorizationController {
|
public class UserAuthorizationController {
|
||||||
@Resource
|
@Resource
|
||||||
private UserAuthorizationService userAuthorizationService;
|
private UserAuthorizationService userAuthorizationService;
|
||||||
|
@Resource
|
||||||
|
private ShopInfoService shopInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序登录
|
* 小程序登录
|
||||||
|
|
@ -39,8 +43,17 @@ public class UserAuthorizationController {
|
||||||
* @return 返回openId
|
* @return 返回openId
|
||||||
*/
|
*/
|
||||||
@GetMapping("/openId")
|
@GetMapping("/openId")
|
||||||
public CzgResult<String> getOpenId(@RequestParam String code, @RequestParam String source) {
|
public CzgResult<Map<String, String>> getOpenId(@RequestParam String code, @RequestParam String source, @RequestParam Long shopId) {
|
||||||
return CzgResult.success(userAuthorizationService.getOpenId(code, source));
|
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()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.czg.order.service.ShopOrderStatisticService;
|
||||||
import com.czg.order.service.ShopProdStatisticService;
|
import com.czg.order.service.ShopProdStatisticService;
|
||||||
import com.czg.order.service.ShopTableOrderStatisticService;
|
import com.czg.order.service.ShopTableOrderStatisticService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -18,7 +19,10 @@ public class StatisticTask {
|
||||||
@Resource
|
@Resource
|
||||||
private ShopOrderStatisticService shopOrderStatisticService;
|
private ShopOrderStatisticService shopOrderStatisticService;
|
||||||
|
|
||||||
|
// @Scheduled(cron = "0 0 18 * * ?")
|
||||||
public void run() {
|
public void run() {
|
||||||
shopOrderStatisticService.statistic();
|
shopOrderStatisticService.statistic();
|
||||||
|
shopProdStatisticService.statistic();
|
||||||
|
shopTableOrderStatisticService.statistic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue