package com.iplatform.recvideo.api;
|
|
import com.iplatform.model.po.Rc_video_user;
|
import com.iplatform.recvideo.ResponseValue;
|
import com.iplatform.recvideo.service.VideoShowServiceImpl;
|
import com.walker.infrastructure.utils.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@RestController
|
@RequestMapping("/api/video")
|
public class ShowResultApi {
|
|
private VideoShowServiceImpl videoShowService;
|
|
@Autowired
|
public ShowResultApi(VideoShowServiceImpl videoShowService){
|
this.videoShowService = videoShowService;
|
}
|
|
@RequestMapping("/rec_list")
|
@ResponseBody
|
public ResponseValue showUserRecommendList(String userId){
|
if(StringUtils.isEmpty(userId)){
|
return ResponseValue.error("参数错误");
|
}
|
long userIdValue = Long.parseLong(userId);
|
List<Rc_video_user> data = this.videoShowService.queryRecommendList(userIdValue, 128);
|
ResponseValue<List<Rc_video_user>> responseValue = ResponseValue.success(data);
|
return responseValue;
|
}
|
|
@RequestMapping("/rec_list_test")
|
@ResponseBody
|
public ResponseValue testUserRecommendList(String userId){
|
if(StringUtils.isEmpty(userId)){
|
return ResponseValue.error("参数错误");
|
}
|
long userIdValue = Long.parseLong(userId);
|
// List<Rc_video_user> data = this.videoShowService.queryRecommendList(userIdValue, 128);
|
List<Rc_video_user> data = new ArrayList<>();
|
data.add(this.testAcquireVideoUser(userIdValue, "test"));
|
ResponseValue<List<Rc_video_user>> responseValue = ResponseValue.success(data);
|
return responseValue;
|
}
|
|
private Rc_video_user testAcquireVideoUser(long userId, String videoId){
|
Rc_video_user user = new Rc_video_user();
|
user.setUser_id(userId);
|
user.setVideo_id(videoId);
|
user.setCreate_time(20221011164126L);
|
user.setScore(0.8);
|
user.setId(System.nanoTime());
|
return user;
|
}
|
}
|