update QRCode

This commit is contained in:
sjm 2023-12-24 13:57:22 +08:00
parent 3afb5f3228
commit 1358261ad4

View File

@ -33,21 +33,25 @@ public class QRCServiceImpl implements QRCService{
// 通过collect的url_id查找网址id对应网址
UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(collect.getUrl_id()));
if(urlList != null){
List<CollectIconList> list = collectIconListDao.selectByUrlid(collect.getUrl_id());
if(list.size()==0){
if(urlList != null){
// 获取网址url
String url = urlList.getUrl();
String url = urlList.getUrl();
// 将网址生成二维码并返回本地路径
String url_wait = QRCodeUtil.encode(url, logoPath, destPath, true);
String url_wait = QRCodeUtil.encode(url, logoPath, destPath, true);
// 为collect设置二维码本地路径
collect.setQr_url(url_wait);
collectIconListDao.insert(collect);
String base64 = QRCodeUtil.ImageToBase64(url_wait);
return base64;
}else{
HashMap<String,Object> result = new HashMap<>();
result.put("code",500);
result.put("msg", "找不到对应网址");
return JSON.toJSONString(result);
}
collect.setQr_url(url_wait);
collectIconListDao.insert(collect);
String base64 = QRCodeUtil.ImageToBase64(url_wait);
return JSON.toJSONString(base64);
}else{
HashMap<String,Object> result = new HashMap<>();
result.put("code",500);
result.put("msg", "找不到对应网址");
return JSON.toJSONString(result);
}
}else return JSON.toJSONString("不准重复插入");
}
}