|
@@ -8,6 +8,7 @@ import com.caimei365.user.components.WeChatService;
|
|
|
import com.caimei365.user.mapper.*;
|
|
|
import com.caimei365.user.model.ResponseJson;
|
|
|
import com.caimei365.user.model.dto.*;
|
|
|
+import com.caimei365.user.model.po.CmBehaviorInfoPo;
|
|
|
import com.caimei365.user.model.po.OperationPo;
|
|
|
import com.caimei365.user.model.po.SuperVipPo;
|
|
|
import com.caimei365.user.model.vo.MessageCenter;
|
|
@@ -31,6 +32,7 @@ import javax.annotation.Resource;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -64,6 +66,8 @@ public class LoginServiceImpl implements LoginService {
|
|
|
private MessageCenterMapper messageCenterMapper;
|
|
|
@Resource
|
|
|
private RemoteCallService remoteCallService;
|
|
|
+ @Resource
|
|
|
+ private ClubMapper clubMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -708,6 +712,33 @@ public class LoginServiceImpl implements LoginService {
|
|
|
return ResponseJson.success(pageData);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 推送访问(站内信) 记录
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @param link
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson clubBehaviorInfo(Integer userId, String link) {
|
|
|
+ // 行为记录
|
|
|
+ try {
|
|
|
+ if (null == userId) {
|
|
|
+ return ResponseJson.error(-1, "用户数据异常", null);
|
|
|
+ } else {
|
|
|
+ // 记录
|
|
|
+ CmBehaviorInfoPo behaviorInfo = clubMapper.getClubSpId(userId);
|
|
|
+ setBehaviorInfo(behaviorInfo, link);
|
|
|
+ behaviorInfo.setOperateObject(1);
|
|
|
+ behaviorInfo.setType(2);
|
|
|
+ clubMapper.insertBehaviorInfo(behaviorInfo);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ResponseJson<PageInfo<MessageCenter>> shopMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
@@ -1695,4 +1726,72 @@ public class LoginServiceImpl implements LoginService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ private void setBehaviorInfo(CmBehaviorInfoPo behaviorInfo, String link) {
|
|
|
+ Pattern compile = Pattern.compile("^[0-9]+$");
|
|
|
+ behaviorInfo.setPagePath(link);
|
|
|
+ String labels = "";
|
|
|
+ Integer id = 0;
|
|
|
+ // 文章详情
|
|
|
+ // https://www.caimei365.com/info/detail-7855-1.html
|
|
|
+ if (link.contains("info") && link.contains("detail")) {
|
|
|
+ behaviorInfo.setPageType("文章详情");
|
|
|
+ String[] split = link.split("-");
|
|
|
+ for (String s : split) {
|
|
|
+ if (compile.matcher(s).matches()) {
|
|
|
+ id = Integer.parseInt(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 获取文章标签
|
|
|
+ labels = clubMapper.getInfoLabels(id);
|
|
|
+ }
|
|
|
+ // 商品详情
|
|
|
+ id = 0;
|
|
|
+ if (link.contains("product")) {
|
|
|
+ behaviorInfo.setPageType("商品详情");
|
|
|
+ String[] split = link.split("-");
|
|
|
+ // https://www.caimei365.com/product-7729.html
|
|
|
+ if (split.length <= 2) {
|
|
|
+ for (String s : split) {
|
|
|
+ String str = s.substring(0, s.lastIndexOf(".html"));
|
|
|
+ if (compile.matcher(str).matches()) {
|
|
|
+ id = Integer.parseInt(str);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // https://www.caimei365.com/product-7729-1.html
|
|
|
+ for (String s : split) {
|
|
|
+ if (compile.matcher(s).matches()) {
|
|
|
+ id = Integer.parseInt(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 获取商品标签
|
|
|
+ labels = clubMapper.getProductLabels(id);
|
|
|
+ }
|
|
|
+ // 网页
|
|
|
+ id = 0;
|
|
|
+ // https://www.caimei365.com/page-375.html
|
|
|
+ if (link.contains("topic") || link.contains("equipment") || link.contains("page") || link.contains("product/type") || link.contains("product/activity")
|
|
|
+ || link.contains("product/beauty") || link.contains("quickOperation/operation") || link.contains("cmpage/info")) {
|
|
|
+ behaviorInfo.setPageType("网页列表");
|
|
|
+ String[] split = link.split("-");
|
|
|
+ if (split.length <= 2) {
|
|
|
+ for (String s : split) {
|
|
|
+ String str = s.substring(0, s.lastIndexOf(".html"));
|
|
|
+ if (compile.matcher(str).matches()) {
|
|
|
+ id = Integer.parseInt(str);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (String s : split) {
|
|
|
+ if (compile.matcher(s).matches()) {
|
|
|
+ id = Integer.parseInt(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ labels = clubMapper.getPageLabels(id);
|
|
|
+ }
|
|
|
+ behaviorInfo.setLabel(labels);
|
|
|
+ }
|
|
|
+
|
|
|
}
|