Ver Fonte

wesmiler 报恩寺项目提交

wesmiler há 4 anos atrás
pai
commit
327b79a34d
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      app/Services/MotionService.php

+ 1 - 1
app/Services/MotionService.php

@@ -154,7 +154,7 @@ class MotionService extends BaseService
             $model = $this->model::from(\DB::raw(env('DB_PREFIX').'motions as m,(select (@rank:=0)) as rank'))
                 ->where(['mark'=> 1,'status'=> 1])
                 ->groupBy('user_id')
-                ->orderBy('create_time', 'asc')
+                ->orderBy(\DB::raw('count(id) as total'), 'desc')
                 ->select([\DB::raw('count(id) as total'),'days','user_id',\DB::raw('(@rank:=@rank+1) as rank')]);
             $binds = $model->getBindings();
             $sql = str_replace('?', '%s', $model->toSql());