|
@@ -224,6 +224,7 @@ public class FeatureService {
|
|
|
|
|
|
public Feature getFeatureV3(RankParam param, Map<String, Map<String, Map<String, String>>> videoBaseInfoMap, List<String> vidList) {
|
|
|
String mid = param.getMid();
|
|
|
+ String mergeMid = getMergeMid(param.getUid(), mid);
|
|
|
String headVid = String.valueOf(param.getHeadVid());
|
|
|
String province = param.getProvince().replaceAll("省$", "");
|
|
|
String apptype = param.getAppType() + "";
|
|
@@ -280,20 +281,20 @@ public class FeatureService {
|
|
|
if (null != videoBaseInfoMap) {
|
|
|
Map<String, Map<String, String>> videoInfo = videoBaseInfoMap.getOrDefault(vid, new HashMap<>());
|
|
|
Map<String, String> baseInfo = videoInfo.getOrDefault("alg_vid_feature_basic_info", new HashMap<>());
|
|
|
- String merge_cate1 = baseInfo.getOrDefault("merge_first_level_cate", "unknown");
|
|
|
+ String merge_cate1 = baseInfo.getOrDefault("merge_first_level_cate", "unknown").trim();
|
|
|
protos.add(genWithKeyMap("alg_merge_cate1_recommend_exp_feature_20250212", vid, ImmutableMap.of("merge_cate1", merge_cate1)));
|
|
|
// 特殊情况
|
|
|
//protos.add(genWithKeyMap("mid_merge_cate1_feature_20250212", vid, ImmutableMap.of("mid", mid, "merge_cate1", merge_cate1)));
|
|
|
|
|
|
- String merge_cate2 = baseInfo.getOrDefault("merge_second_level_cate", "unknown");
|
|
|
+ String merge_cate2 = baseInfo.getOrDefault("merge_second_level_cate", "unknown").trim();
|
|
|
protos.add(genWithKeyMap("alg_merge_cate2_recommend_exp_feature_20250212", vid, ImmutableMap.of("merge_cate2", merge_cate2)));
|
|
|
// 特殊情况
|
|
|
//protos.add(genWithKeyMap("mid_merge_cate2_feature_20250212", vid, ImmutableMap.of("mid", mid, "merge_cate2", merge_cate2)));
|
|
|
|
|
|
- String channel = baseInfo.getOrDefault("channel", "unknown");
|
|
|
+ String channel = baseInfo.getOrDefault("channel", "unknown").trim();
|
|
|
protos.add(genWithKeyMap("alg_channel_recommend_exp_feature_20250212", vid, ImmutableMap.of("channel", channel)));
|
|
|
|
|
|
- String festive = baseInfo.getOrDefault("festive_label2", "unknown");
|
|
|
+ String festive = baseInfo.getOrDefault("festive_label2", "unknown").trim();
|
|
|
protos.add(genWithKeyMap("alg_festive_recommend_exp_feature_20250212", vid, ImmutableMap.of("festive", festive)));
|
|
|
|
|
|
String videoUnionid = baseInfo.getOrDefault("title_time_w_h_unionid", "unknown");
|
|
@@ -315,7 +316,7 @@ public class FeatureService {
|
|
|
// ********************* new mid ******************
|
|
|
protos.add(genWithMid("mid_global_feature_20250212", mid));
|
|
|
protos.add(genWithMid("mid_u2u_friend_index_feature_20250212", mid));
|
|
|
- protos.add(genWithMid("alg_recsys_feature_user_share_return_stat", mid));
|
|
|
+ protos.add(genWithMid("alg_recsys_feature_user_share_return_stat", mergeMid));
|
|
|
|
|
|
return getFeatureByProto(protos);
|
|
|
}
|
|
@@ -362,11 +363,12 @@ public class FeatureService {
|
|
|
return this.getFeatureByProto(protos);
|
|
|
}
|
|
|
|
|
|
- public UserShareReturnProfile getUserProfile(String mid) {
|
|
|
+ public UserShareReturnProfile getUserProfile(String uid, String mid) {
|
|
|
try {
|
|
|
+ String mergeMid = getMergeMid(uid, mid);
|
|
|
String table = "alg_recsys_feature_user_share_return_stat";
|
|
|
List<FeatureKeyProto> protos = new ArrayList<>();
|
|
|
- protos.add(genWithMid(table, mid));
|
|
|
+ protos.add(genWithMid(table, mergeMid));
|
|
|
Feature feature = getFeatureByProto(protos);
|
|
|
Map<String, Map<String, String>> userFeature = feature.getUserFeature();
|
|
|
if (null != userFeature) {
|
|
@@ -384,6 +386,18 @@ public class FeatureService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ public Map<String, String> getHeadVideoInfo(String headVid) {
|
|
|
+ try {
|
|
|
+ if (null != headVid && !headVid.isEmpty()) {
|
|
|
+ Map<String, Map<String, Map<String, String>>> videoBaseInfoMap = getVideoBaseInfo(headVid, new ArrayList<>());
|
|
|
+ return videoBaseInfoMap.getOrDefault(headVid, new HashMap<>()).get("alg_vid_feature_basic_info");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("get head info error! value=[{}]", headVid, e);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
private Feature getFeatureByProto(List<FeatureKeyProto> protos) {
|
|
|
Map<String, String> result = remoteService.getFeature(protos);
|
|
|
Feature feature = new Feature();
|
|
@@ -414,6 +428,14 @@ public class FeatureService {
|
|
|
return feature;
|
|
|
}
|
|
|
|
|
|
+ private String getMergeMid(String uid, String mid) {
|
|
|
+ if (null != uid && !uid.isEmpty() && !uid.equals("null")) {
|
|
|
+ return uid;
|
|
|
+ } else {
|
|
|
+ return mid;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private final String videoUkFormat = "v:%s:%s";
|
|
|
private final String userUkFormat = "u:%s";
|
|
|
private final String kvUkFormat = "v:%s:%s";
|