生成海报增加uniH5端的跟原来h5做一个区分
This commit is contained in:
@ -255,7 +255,7 @@ public class StoreBargainController {
|
||||
}
|
||||
YxUser userInfo = LocalUser.getUser();
|
||||
Map<String,Object> map = Maps.newHashMap();
|
||||
String url = creatShareProductService.getBargainPosterUrl(bargainId,userInfo,siteUrl,apiUrl,path);
|
||||
String url = creatShareProductService.getBargainPosterUrl(bargainId,userInfo,siteUrl,apiUrl,path,param.getFrom());
|
||||
map.put("url",url);
|
||||
return ApiResult.ok(map);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class StoreCombinationController {
|
||||
YxUser userInfo = LocalUser.getUser();
|
||||
Map<String,Object> map = Maps.newHashMap();
|
||||
String spreadUrl = creatShareProductService.getPinkPosterUrl(Long.valueOf(param.getId()),userInfo,
|
||||
siteUrl,apiUrl,path);
|
||||
siteUrl,apiUrl,path,param.getFrom());
|
||||
map.put("url",spreadUrl);
|
||||
return ApiResult.ok(map);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class StoreProductController {
|
||||
@ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int")
|
||||
})
|
||||
@ApiOperation(value = "商品详情海报",notes = "商品详情海报")
|
||||
public ApiResult<String> prodoctPoster(@PathVariable Integer id) throws IOException, FontFormatException {
|
||||
public ApiResult<String> prodoctPoster(@PathVariable Integer id,@RequestParam String from) throws IOException, FontFormatException {
|
||||
YxUser userInfo = LocalUser.getUser();
|
||||
|
||||
long uid = userInfo.getUid();
|
||||
@ -153,11 +153,7 @@ public class StoreProductController {
|
||||
if(StrUtil.isEmpty(apiUrl)){
|
||||
return ApiResult.fail("未配置api地址");
|
||||
}
|
||||
String userType = userInfo.getUserType();
|
||||
if(StrUtil.isBlank(userType)) {
|
||||
userType = AppFromEnum.H5.getValue();
|
||||
}
|
||||
String name = id+"_"+uid + "_"+userType+"_product_detail_wap.jpg";
|
||||
String name = id+"_"+uid + "_"+from+"_product_detail_wap.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String sepa = File.separator;
|
||||
String fileDir = path+"qrcode"+ sepa;
|
||||
@ -165,21 +161,25 @@ public class StoreProductController {
|
||||
if(ObjectUtil.isNull(attachment)){
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
//如果类型是小程序
|
||||
if(AppFromEnum.ROUNTINE.getValue().equals(userType)){
|
||||
if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"?productId="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
else if(AppFromEnum.APP.getValue().equals(userType)){
|
||||
else if(AppFromEnum.APP.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"?productId="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.APP.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else{//如果类型是h5
|
||||
}else if(AppFromEnum.H5.getValue().equals(from)){//如果类型是h5
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"/detail/"+id+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else {
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"/pages/shop/GoodsCon/index?id=/"+id+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)),
|
||||
fileDir+name,"qrcode/"+name);
|
||||
@ -188,7 +188,7 @@ public class StoreProductController {
|
||||
}else{
|
||||
qrcodeUrl = apiUrl + "/api/file/" + attachment.getSattDir();
|
||||
}
|
||||
String spreadPicName = id+"_"+uid + "_"+userType+"_product_user_spread.jpg";
|
||||
String spreadPicName = id+"_"+uid + "_"+from+"_product_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
String rr = creatShareProductService.creatProductPic(storeProduct,qrcodeUrl,
|
||||
spreadPicName,spreadPicPath,apiUrl);
|
||||
|
@ -187,12 +187,10 @@ public class CreatShareProductService {
|
||||
}
|
||||
}
|
||||
else{//其他
|
||||
String userType = userInfo.getUserType();
|
||||
if(!userType.equals(AppFromEnum.ROUNTINE.getValue())) {
|
||||
userType = AppFromEnum.H5.getValue();
|
||||
if(!from.equals(AppFromEnum.ROUNTINE.getValue())) {
|
||||
}
|
||||
|
||||
String name = uid + "_"+userType+"_user_wap.jpg";
|
||||
String name = uid + "_"+from+"_user_wap.jpg";
|
||||
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+File.separator;
|
||||
@ -200,8 +198,10 @@ public class CreatShareProductService {
|
||||
if(ObjectUtil.isNull(attachment)){
|
||||
//生成二维码
|
||||
//判断用户是否小程序,注意小程序二维码生成路径要与H5不一样 不然会导致都跳转到小程序问题
|
||||
if(userType.equals(AppFromEnum.ROUNTINE.getValue())){
|
||||
if(from.equals(AppFromEnum.ROUNTINE.getValue())){
|
||||
siteUrl = siteUrl+"/distribution/";
|
||||
}else if(AppFromEnum.UNIAPPH5.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/pages/home/index";
|
||||
}
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
QrCodeUtil.generate(siteUrl+"?spread="+uid, 180, 180,
|
||||
@ -215,7 +215,7 @@ public class CreatShareProductService {
|
||||
qrcodeUrl = attachment.getAttDir();
|
||||
}
|
||||
|
||||
String spreadPicName = uid + "_"+userType+"_user_spread.jpg";
|
||||
String spreadPicName = uid + "_"+from+"_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
|
||||
YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName);
|
||||
@ -274,7 +274,7 @@ public class CreatShareProductService {
|
||||
* @return url
|
||||
*/
|
||||
public String getBargainPosterUrl(Long bargainId, YxUser userInfo,String siteUrl,
|
||||
String apiUrl,String path){
|
||||
String apiUrl,String path,String from){
|
||||
Long uid = userInfo.getUid();
|
||||
YxStoreBargain storeBargainQueryVo = storeBargainService
|
||||
.getById(bargainId);
|
||||
@ -291,11 +291,8 @@ public class CreatShareProductService {
|
||||
double surplusPrice = NumberUtil.sub(coverPrice,
|
||||
storeBargainUser.getPrice()).doubleValue();
|
||||
|
||||
String userType = userInfo.getUserType();
|
||||
if(StrUtil.isBlank(userType)) {
|
||||
userType = AppFromEnum.H5.getValue();
|
||||
}
|
||||
String name = bargainId+"_"+uid + "_"+userType+"_bargain_share_wap.jpg";
|
||||
|
||||
String name = bargainId+"_"+uid + "_"+from+"_bargain_share_wap.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+ File.separator;
|
||||
String qrcodeUrl = "";
|
||||
@ -303,18 +300,21 @@ public class CreatShareProductService {
|
||||
//生成二维码
|
||||
//判断用户是否小程序,注意小程序二维码生成路径要与H5不一样 不然会导致都跳转到小程序问题
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
if(AppFromEnum.ROUNTINE.getValue().equals(userType)){
|
||||
if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/bargain/";
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&spread="+uid+"&pageType=dargain&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&partake="+uid+"&pageType=dargain&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
else if(AppFromEnum.APP.getValue().equals(userType)){
|
||||
else if(AppFromEnum.APP.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/bargain/";
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&spread="+uid+"&pageType=dargain&codeType="+AppFromEnum.APP.getValue(), 180, 180,
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&partake="+uid+"&pageType=dargain&codeType="+AppFromEnum.APP.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else{
|
||||
}else if(AppFromEnum.H5.getValue().equals(from)){
|
||||
QrCodeUtil.generate(siteUrl+"/activity/dargain_detail/"+bargainId+"/"+uid+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else {
|
||||
QrCodeUtil.generate(siteUrl+"/pages/activity/DargainDetails/index?id=/"+bargainId+"&uid="+uid+"&partake="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)),
|
||||
fileDir+name,"qrcode/"+name);
|
||||
@ -323,7 +323,7 @@ public class CreatShareProductService {
|
||||
qrcodeUrl = attachment.getAttDir();
|
||||
}
|
||||
|
||||
String spreadPicName = bargainId+"_"+uid + "_"+userType+"_bargain_user_spread.jpg";
|
||||
String spreadPicName = bargainId+"_"+uid + "_"+from+"_bargain_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
|
||||
YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName);
|
||||
@ -463,7 +463,7 @@ public class CreatShareProductService {
|
||||
* @return url
|
||||
*/
|
||||
public String getPinkPosterUrl(Long pinkId, YxUser userInfo,String siteUrl,
|
||||
String apiUrl,String path){
|
||||
String apiUrl,String path,String from){
|
||||
Long uid = userInfo.getUid();
|
||||
YxStorePink storePink = storePinkService.getById(pinkId);
|
||||
if(ObjectUtil.isNull(storePink)) {
|
||||
@ -474,31 +474,30 @@ public class CreatShareProductService {
|
||||
throw new YshopException("拼团产品不存在");
|
||||
}
|
||||
|
||||
String userType = userInfo.getUserType();
|
||||
if(StrUtil.isBlank(userType)) {
|
||||
userType = AppFromEnum.H5.getValue();
|
||||
}
|
||||
|
||||
String name = pinkId+"_"+uid + "_"+userType+"_pink_share_wap.jpg";
|
||||
String name = pinkId+"_"+uid + "_"+from+"_pink_share_wap.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+ File.separator;
|
||||
String qrcodeUrl = "";
|
||||
if(ObjectUtil.isNull(attachment)){
|
||||
//生成二维码
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
if(userType.equals(AppFromEnum.ROUNTINE.getValue())){
|
||||
if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/pink/";
|
||||
QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid+"&pageType=group&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
else if(userType.equals(AppFromEnum.APP.getValue())){
|
||||
else if(AppFromEnum.APP.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/pink/";
|
||||
QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid+"&pageType=group&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
else {
|
||||
else if(AppFromEnum.H5.getValue().equals(from)){
|
||||
QrCodeUtil.generate(siteUrl+"/activity/group_rule/"+pinkId+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else {
|
||||
QrCodeUtil.generate(siteUrl+"/pages/activity/GroupRule/index?id=/"+pinkId+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
|
||||
|
||||
@ -510,7 +509,7 @@ public class CreatShareProductService {
|
||||
qrcodeUrl = attachment.getAttDir();
|
||||
}
|
||||
|
||||
String spreadPicName = pinkId+"_"+uid + "_"+userType+"_pink_user_spread.jpg";
|
||||
String spreadPicName = pinkId+"_"+uid + "_"+from+"_pink_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
|
||||
YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName);
|
||||
|
@ -20,7 +20,8 @@ public enum AppFromEnum {
|
||||
H5("h5","H5"),
|
||||
WECHAT("wechat","公众号"),
|
||||
APP("app","APP"),
|
||||
ROUNTINE("routine","小程序");
|
||||
ROUNTINE("routine","小程序"),
|
||||
UNIAPPH5("uniappH5","uniappH5");
|
||||
|
||||
|
||||
private String value;
|
||||
|
Reference in New Issue
Block a user