|
@@ -1,6 +1,8 @@
|
|
|
package com.zhongzheng.modules.course.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.codec.Base64;
|
|
|
+import cn.hutool.core.codec.Base64Decoder;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -21,10 +23,13 @@ import com.zhongzheng.modules.course.vo.CourseSectionWatchPerVo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.wx.service.IWxLoginService;
|
|
|
+import org.apache.commons.codec.digest.DigestUtils;
|
|
|
+import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.security.MessageDigest;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -55,7 +60,12 @@ public class CourseSectionWatchPerServiceImpl extends ServiceImpl<CourseSectionW
|
|
|
// String url = "";
|
|
|
String live = "living-room/";
|
|
|
vo.setEnCode(wxLoginService.getLiveEnCode(bo));
|
|
|
- String url = String.format("%s%s%s?a=1&cid=%s&gid=%s&sid=%s", liveGotoURL,live,section.getLiveUrl(), bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
|
|
|
+ String format = String.format("cid=%s&gid=%s&sid=%s", bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
|
|
|
+
|
|
|
+ String s = Base64.encode(format);
|
|
|
+// String s = DigestUtils.md5Hex(format);
|
|
|
+// String url = String.format("%s%s%s?a=1&cid=%s&gid=%s&sid=%s", liveGotoURL,live,section.getLiveUrl(), bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
|
|
|
+ String url = String.format("%s%s%s?a=1&%s", liveGotoURL,live,section.getLiveUrl(), s);
|
|
|
// //生成微信小程序码
|
|
|
// switch (bo.getSectionType()){
|
|
|
// case 2://直播 living-room/
|
|
@@ -100,13 +110,13 @@ public class CourseSectionWatchPerServiceImpl extends ServiceImpl<CourseSectionW
|
|
|
public CheckSectionWatchVo checkSectionWatchPer(SectionWatchQueryBo bo) {
|
|
|
//校验商品有效期
|
|
|
Goods goods = goodsService.getById(bo.getGoodsId());
|
|
|
- if (ObjectUtils.isNotNull(goods.getValidityStartTime()) && ObjectUtils.isNotNull(goods.getValidityEndTime())){
|
|
|
- Long validityStartTime = goods.getValidityStartTime();
|
|
|
- Long validityEndTime = goods.getValidityEndTime();
|
|
|
- if (DateUtils.getNowTime() < validityStartTime || DateUtils.getNowTime() > validityEndTime){
|
|
|
- throw new CustomException("该商品不在有效期");
|
|
|
- }
|
|
|
- }
|
|
|
+// if (ObjectUtils.isNotNull(goods.getValidityStartTime()) && ObjectUtils.isNotNull(goods.getValidityEndTime())){
|
|
|
+// Long validityStartTime = goods.getValidityStartTime();
|
|
|
+// Long validityEndTime = goods.getValidityEndTime();
|
|
|
+// if (DateUtils.getNowTime() < validityStartTime || DateUtils.getNowTime() > validityEndTime){
|
|
|
+// throw new CustomException("该商品不在有效期");
|
|
|
+// }
|
|
|
+// }
|
|
|
CheckSectionWatchVo watchVo = new CheckSectionWatchVo();
|
|
|
watchVo.setGoodsId(bo.getGoodsId());
|
|
|
watchVo.setCourseId(bo.getCourseId());
|