浏览代码

类型转换

duqinya 5 年之前
父节点
当前提交
0a5938d4f0
共有 2 个文件被更改,包括 2 次插入3 次删除
  1. 0 3
      app/Console/Commands/RankingList.php
  2. 2 0
      app/Repositories/BeanRepository.php

+ 0 - 3
app/Console/Commands/RankingList.php

@@ -88,13 +88,11 @@ class RankingList extends Command
         $comment_best_author = $comment_author->toArray();
         foreach ($comment_best_author as $k => $v) {
             $comment_best_author[$k]['type'] = 'comment';
-            $v['count'] = intval($v['count']);
         }
         $general_author = $this->_condition($this->generalRecord);
         $general_best_author = $general_author->toArray();
         foreach ($general_best_author as $k => $v) {
             $general_best_author[$k]['type'] = 'general';
-            $v['count'] = intval($v['count']);
         }
         $release_author = $this->releaseRecord
             ->whereBetween('created_at', [$yesterday_start, $yesterday_end])
@@ -104,7 +102,6 @@ class RankingList extends Command
         $release_best_author = $release_author->toArray();
         foreach ($release_best_author as $k => $v) {
             $release_best_author[$k]['type'] = 'release';
-            $v['count'] = intval($v['count']);
         }
         $all_best_author = array_merge($comment_best_author, $general_best_author, $release_best_author);
 

+ 2 - 0
app/Repositories/BeanRepository.php

@@ -101,6 +101,7 @@ class BeanRepository
                 if ($user_data){
                     foreach ($registered_most as $k=>$v){
                         if(!isset($user_data[$v['superior_uid']])) continue;
+                        $registered_most[$k]['count'] = intval($v['count']);
                         $registered_most[$k]['follow_status'] = $user_data[$v['superior_uid']]['follow_status'];
                         $username = subtext($user_data[$v['superior_uid']]['username'], 10);
 
@@ -121,6 +122,7 @@ class BeanRepository
                 if ($user_data){
                     foreach ($all_best_author as $k=>$v){
                         if(!isset($user_data[$v['content_author_id']])) continue;
+                        $all_best_author[$k]['count'] = intval($v['count']);
                         $all_best_author[$k]['follow_status'] = $user_data[$v['content_author_id']]['follow_status'];
                         $username = subtext($user_data[$v['content_author_id']]['username'], 10);