|
@@ -87,12 +87,59 @@ class Subject extends Api
|
|
|
|
|
|
$info['video_thumb'] = '';
|
|
|
if(!empty($info['video_file'])){
|
|
|
+ $info['video_file'] = localpath_to_netpath($info['video_file']);
|
|
|
$info['video_thumb'] = $info['video_file'].'?x-oss-process=video/snapshot,t_0,m_fast,f_jpg';
|
|
|
}
|
|
|
|
|
|
+ //名次
|
|
|
+ /*$players = Db::name('vote_player')->where(['subject_id'=>$info['subject_id'],'status'=>1])->order('votes desc,id desc')->column('id,votes');
|
|
|
+ $id_arr = array_keys($players);
|
|
|
+ $mingci = 1; //名次
|
|
|
+ $mingci = array_search($info['id'],$id_arr);
|
|
|
+ $mingci++;
|
|
|
+ $info['mingci'] = $mingci;*/
|
|
|
+
|
|
|
$this->success(1,$info);
|
|
|
}
|
|
|
|
|
|
+ //用户详细资料
|
|
|
+ public function getuserinfo(){
|
|
|
+ $info = $this->auth->getUserinfo();
|
|
|
+
|
|
|
+ //今天,投了几票
|
|
|
+ $today_record = RedisUtil::getInstance(RedisKeyEnum::VOTE_RECORD.date('Y-m-d').':'.$this->auth->id)->get();
|
|
|
+ //今天,免费的的票
|
|
|
+ $gift_votes = config('site.gift_votes_user_eday');
|
|
|
+ //今天,用户答对的次数,也就是答题获得的票数
|
|
|
+ $question_vote = RedisUtil::getInstance(RedisKeyEnum::EAXM_RIGHT.date('Y-m-d').':'.$this->auth->id)->get();
|
|
|
+
|
|
|
+ //基础票数,答题票数
|
|
|
+ $jcps = $gift_votes - $today_record;
|
|
|
+ if($jcps < 0){
|
|
|
+ $jcps = 0;
|
|
|
+ }
|
|
|
+ $dtps = $question_vote - ( ($today_record - $gift_votes) <= 0 ? 0 : ($today_record - $gift_votes) );
|
|
|
+
|
|
|
+ //今日投票记录
|
|
|
+ $player_ids = Db::name('vote_record')->where('user_id',$this->auth->id)->where('createdate',strtotime(date('Y-m-d')))->column('player_id');
|
|
|
+ $map = [
|
|
|
+ 'status' => 1,
|
|
|
+ 'id' => ['IN',$player_ids]
|
|
|
+ ];
|
|
|
+ $lists = Db::name('vote_player')->field('id,title,votes')
|
|
|
+ ->where($map)->order('votes desc,id desc')->select();
|
|
|
+
|
|
|
+
|
|
|
+ $result = [
|
|
|
+ 'info' => $info,
|
|
|
+ 'jcps' => $jcps,
|
|
|
+ 'dtps' => $dtps,
|
|
|
+ 'lists' => $lists,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $this->success(1,$result);
|
|
|
+ }
|
|
|
+
|
|
|
//选手票数排行榜,按票
|
|
|
public function playerlist_votes(){
|
|
|
$subject_id = 1;
|
|
@@ -132,34 +179,6 @@ class Subject extends Api
|
|
|
//处理后的URL为:https://oss-console-img-demo-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/video.mp4?x-oss-process=video/snapshot,t_7000,f_jpg,w_800,h_600,m_fast
|
|
|
|
|
|
|
|
|
- //选手详情
|
|
|
- /*public function playerinfo(){
|
|
|
- $player_id = input('player_id');
|
|
|
- if(!$player_id){
|
|
|
- $this->error();
|
|
|
- }
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'p.id' => $player_id,
|
|
|
- ];
|
|
|
-
|
|
|
- $info = Db::name('vote_player')->alias('p')
|
|
|
- ->field('p.id,p.mobile,p.video_file,p.votes,p.renqi,p.subject_id')
|
|
|
- ->where($map)->find();
|
|
|
- $info = info_domain_image($info,['video_file']);
|
|
|
-
|
|
|
- //名次
|
|
|
- $players = Db::name('vote_player')->where(['subject_id'=>$info['subject_id'],'status'=>1])->order('votes desc')->column('id,votes');
|
|
|
- $id_arr = array_keys($players);
|
|
|
- $mingci = 1; //名次
|
|
|
- $mingci = array_search($info['id'],$id_arr);
|
|
|
- $mingci++;
|
|
|
- $info['mingci'] = $mingci;
|
|
|
-
|
|
|
- $this->success(1,$info);
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
//获得我的名次,票数导向
|
|
|
private function mingci_vote($subject_id,$list){
|
|
|
|