yshop1.9.10,小程序新增商品海报与手机号绑定,海报生成拆分为H5端与小程序端等
This commit is contained in:
@ -292,7 +292,9 @@ public class StoreBargainController extends BaseController {
|
||||
storeBargainUser.getPrice()).doubleValue();
|
||||
|
||||
YxUserQueryVo userInfo = yxUserService.getYxUserById(uid);
|
||||
String name = bargainId+"_"+uid + "_"+userInfo.getIsPromoter()+"_bargain_share_wap.jpg";
|
||||
String userType = userInfo.getUserType();
|
||||
if(!userType.equals("routine")) userType = "H5";
|
||||
String name = bargainId+"_"+uid + "_"+userType+"_bargain_share_wap.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+ File.separator;
|
||||
String qrcodeUrl = "";
|
||||
@ -300,7 +302,7 @@ public class StoreBargainController extends BaseController {
|
||||
//生成二维码
|
||||
//判断用户是否小程序,注意小程序二维码生成路径要与H5不一样 不然会导致都跳转到小程序问题
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
if(userInfo.getUserType().equals("routine")){
|
||||
if(userType.equals("routine")){
|
||||
siteUrl = siteUrl+"/bargain/";
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
@ -318,7 +320,7 @@ public class StoreBargainController extends BaseController {
|
||||
qrcodeUrl = attachment.getAttDir();
|
||||
}
|
||||
|
||||
String spreadPicName = bargainId+"_"+uid + "_"+userInfo.getIsPromoter()+"_bargain_user_spread.jpg";
|
||||
String spreadPicName = bargainId+"_"+uid + "_"+userType+"_bargain_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
|
||||
YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName);
|
||||
|
@ -130,7 +130,9 @@ public class StoreCombinationController extends BaseController {
|
||||
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
YxUserQueryVo userInfo = yxUserService.getYxUserById(uid);
|
||||
String name = pinkId+"_"+uid + "_"+userInfo.getIsPromoter()+"_pink_share_wap.jpg";
|
||||
String userType = userInfo.getUserType();
|
||||
if(!userType.equals("routine")) userType = "H5";
|
||||
String name = pinkId+"_"+uid + "_"+userType+"_pink_share_wap.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+ File.separator;
|
||||
String qrcodeUrl = "";
|
||||
@ -138,7 +140,7 @@ public class StoreCombinationController extends BaseController {
|
||||
//生成二维码
|
||||
//String fileDir = path+"qrcode"+File.separator;
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
if(userInfo.getUserType().equals("routine")){
|
||||
if(userType.equals("routine")){
|
||||
siteUrl = siteUrl+"/pink/";
|
||||
QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
@ -156,7 +158,7 @@ public class StoreCombinationController extends BaseController {
|
||||
qrcodeUrl = attachment.getAttDir();
|
||||
}
|
||||
|
||||
String spreadPicName = pinkId+"_"+uid + "_"+userInfo.getIsPromoter()+"_pink_user_spread.jpg";
|
||||
String spreadPicName = pinkId+"_"+uid + "_"+userType+"_pink_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
|
||||
YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName);
|
||||
|
@ -137,14 +137,18 @@ public class StoreProductController extends BaseController {
|
||||
}
|
||||
|
||||
YxUserQueryVo userInfo = yxUserService.getYxUserById(uid);
|
||||
String name = id+"_"+uid + "_"+userInfo.getIsPromoter()+"_product_detail_wap.jpg";
|
||||
String userType = userInfo.getUserType();
|
||||
if(!userType.equals("routine")) userType = "H5";
|
||||
String name = id+"_"+uid + "_"+userType+"_product_detail_wap.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+ File.separator;
|
||||
String qrcodeUrl = "";
|
||||
String routineQrcodeUrl = "";
|
||||
if(ObjectUtil.isNull(attachment)){
|
||||
//生成二维码
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
if(userInfo.getUserType().equals("routine")){
|
||||
if(userType.equals("routine")){
|
||||
//下载图片
|
||||
siteUrl = siteUrl+"/product/";
|
||||
QrCodeUtil.generate(siteUrl+"?productId="+id+"&spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
@ -158,17 +162,26 @@ public class StoreProductController extends BaseController {
|
||||
fileDir+name,"qrcode/"+name);
|
||||
|
||||
qrcodeUrl = fileDir+name;
|
||||
routineQrcodeUrl = apiUrl + "/api/file/qrcode/"+name;
|
||||
|
||||
}else{
|
||||
qrcodeUrl = attachment.getAttDir();
|
||||
routineQrcodeUrl = apiUrl + "/api/file/" + attachment.getSattDir();
|
||||
}
|
||||
|
||||
try {
|
||||
String base64CodeImg = co.yixiang.utils.FileUtil.fileToBase64(new File(qrcodeUrl));
|
||||
productDTO.getStoreInfo().setCodeBase("data:image/jpeg;base64," + base64CodeImg);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(userType.equals("routine")){
|
||||
productDTO.getStoreInfo().setCodeBase(routineQrcodeUrl);
|
||||
}else{
|
||||
try {
|
||||
String base64CodeImg = co.yixiang.utils.FileUtil.fileToBase64(new File(qrcodeUrl));
|
||||
productDTO.getStoreInfo().setCodeBase("data:image/jpeg;base64," + base64CodeImg);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ApiResult.ok(productDTO);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,11 @@ public class UserBillController extends BaseController {
|
||||
if(StrUtil.isEmpty(siteUrl)){
|
||||
return ApiResult.fail("未配置api地址");
|
||||
}
|
||||
String name = uid + "_"+userInfo.getIsPromoter()+"_user_wap.jpg";
|
||||
|
||||
String userType = userInfo.getUserType();
|
||||
if(!userType.equals("routine")) userType = "H5";
|
||||
|
||||
String name = uid + "_"+userType+"_user_wap.jpg";
|
||||
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+File.separator;
|
||||
@ -141,7 +145,7 @@ public class UserBillController extends BaseController {
|
||||
if(ObjectUtil.isNull(attachment)){
|
||||
//生成二维码
|
||||
//判断用户是否小程序,注意小程序二维码生成路径要与H5不一样 不然会导致都跳转到小程序问题
|
||||
if(userInfo.getUserType().equals("routine")){
|
||||
if(userType.equals("routine")){
|
||||
siteUrl = siteUrl+"/distribution/";
|
||||
}
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
@ -157,7 +161,7 @@ public class UserBillController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
String spreadPicName = uid + "_"+userInfo.getIsPromoter()+"_user_spread.jpg";
|
||||
String spreadPicName = uid + "_"+userType+"_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
|
||||
YxSystemAttachment attachmentT = systemAttachmentService.getInfo(spreadPicName);
|
||||
|
@ -45,6 +45,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020/02/07
|
||||
@ -113,6 +116,7 @@ public class WxMaUserController {
|
||||
wxMaConfig.setAppid(appId);
|
||||
wxMaConfig.setSecret(secret);
|
||||
wxMaService.setWxMaConfig(wxMaConfig);
|
||||
String phone = "";
|
||||
try {
|
||||
WxMaJscode2SessionResult session = wxMaService.getUserService()
|
||||
.getSessionInfo(param.getCode());
|
||||
@ -121,16 +125,19 @@ public class WxMaUserController {
|
||||
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService()
|
||||
.getPhoneNoInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
|
||||
|
||||
phone = phoneNoInfo.getPhoneNumber();
|
||||
YxUser yxUser = new YxUser();
|
||||
yxUser.setPhone(phoneNoInfo.getPhoneNumber());
|
||||
yxUser.setPhone(phone);
|
||||
yxUser.setUid(uid);
|
||||
userService.updateById(yxUser);
|
||||
} catch (WxErrorException e) {
|
||||
e.printStackTrace();
|
||||
return ApiResult.fail(e.getMessage());
|
||||
//e.printStackTrace();
|
||||
}
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("phone",phone);
|
||||
|
||||
|
||||
return ApiResult.ok("绑定成功");
|
||||
return ApiResult.ok(map,"绑定成功");
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user