|
|
@@ -820,6 +820,27 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
return chatgptUser.getUserToken();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public JSONObject getGptUseInfo(String userToken) {
|
|
|
+ ChatgptUser chatgptUser = chatgptUserMapper.selectOne(Wrappers.lambdaQuery(ChatgptUser.class)
|
|
|
+ .eq(ChatgptUser::getUserToken, userToken)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (chatgptUser == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("车票不存在");
|
|
|
+ }
|
|
|
+ Long relationId = chatgptUser.getRelationId();
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectById(relationId);
|
|
|
+ if (relation == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("车票不存在");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String res = HttpUtil.get(String.format("https://image.yhlxj.com/api/getCount?usertoken=%s&limit=%s&time=%s&isVip=%s", userToken, chatgptUser.getLimitNum(), chatgptUser.getLimitTime(), relation.getIsVip()), 5000);
|
|
|
+ return new JSONObject(res);
|
|
|
+ }catch (Exception e){
|
|
|
+ return new JSONObject("{\"count\": 0,\"o1_mini\": 0,\"o1_p\": 0}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private synchronized ChatgptUser createTrialUser(String clientIP) {
|
|
|
//固定 sku id
|
|
|
GoodsDonSku goodsDonSku = skuMapper.selectById(535L);
|