Sfoglia il codice sorgente

Merge branch 'develop' of http://git.caihongxingqiu.net/rainbow/community-service into develop

xielin 5 anni fa
parent
commit
111e20c55e

+ 2 - 1
app/Console/Commands/ExcellentResidents.php

@@ -103,6 +103,7 @@ class ExcellentResidents extends Command
 
         //昨日拉新最多用户
         $registered = $this->registeredRecord
+            ->where('superior_uid', '!=', 0)
             ->whereBetween('created_at', [$yesterday_start, $yesterday_end])
             ->select(DB::raw('count(*) as count'), 'superior_uid as content_author_id')//作为用户ID
             ->groupBy('superior_uid')->orderBy('count', 'desc')->limit(1)->get();
@@ -119,7 +120,7 @@ class ExcellentResidents extends Command
         $collent = $this->_condition($this->generalRecord, $virus_id->virus_behavior_id);
         $collent = $collent->toArray();
         foreach ($collent as $k => $v) {
-            $collent[$k]['type'] = 'collent';
+            $collent[$k]['type'] = 'collect';
         }
 
         //文章被喜欢最多用户

+ 4 - 4
app/Console/Commands/RankingList.php

@@ -58,9 +58,9 @@ class RankingList extends Command
     {
         $yesterday_start = Carbon::now()->addDays(-1)->startOfDay()->toDateTimeString();
         $yesterday_end = Carbon::now()->addDays(-1)->endOfDay()->toDateTimeString();
-        return $model->select(DB::raw('count(*) as num'), 'generation_quantity', 'content_author_id', DB::raw('sum(generation_quantity) as count'))
+        return $model->select(DB::raw('count(*) as num'),'content_author_id', DB::raw('sum(generation_quantity) as count'))
             ->whereBetween('created_at', [$yesterday_start, $yesterday_end])
-            ->groupBy('generation_quantity', 'content_author_id')
+            ->groupBy('content_author_id')
             ->orderBy('count', 'desc')
             ->limit(10)
             ->get();
@@ -97,8 +97,8 @@ class RankingList extends Command
         }
         $release_author = $this->releaseRecord
             ->whereBetween('created_at', [$yesterday_start, $yesterday_end])
-            ->select(DB::raw('count(*) as num'), 'generation_quantity', 'uid as content_author_id', DB::raw('sum(generation_quantity) as count'))
-            ->groupBy('generation_quantity', 'content_author_id')->orderBy('count', 'desc')->limit(10)->get();
+            ->select(DB::raw('count(*) as num'), 'uid as content_author_id', DB::raw('sum(generation_quantity) as count'))
+            ->groupBy('content_author_id')->orderBy('count', 'desc')->limit(10)->get();
 
         $release_best_author = $release_author->toArray();
         foreach ($release_best_author as $k => $v) {

+ 1 - 0
app/Http/Controllers/V1/PostController.php

@@ -85,6 +85,7 @@ class PostController extends Controller
      */
     public function index(Request $request)
     {
+        Log::debug('内容搜索'.json_encode($request));
         $userInfo = $this->getUserInfo();
         if (empty($userInfo)) {
             return jsonError('获取用户信息失败');

+ 2 - 1
app/Repositories/BeanRepository.php

@@ -141,9 +141,10 @@ class BeanRepository
 
     function getFollowMembersStatus($uids) {
         try {
+            $sign = generateSign(['uids' => $uids], config('customer.app_secret'));
             $url = config("customer.app_service_url").'/user/v2/member/getMemberIds';
             $array = [
-                'json' => ['uids' => $uids], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
+                'json' => ['sign' => $sign,'uids' => $uids], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
             ];
             return http($url,$array,'get');
         } catch (\Exception $e) {

+ 7 - 7
app/Repositories/PostRepositories.php

@@ -70,11 +70,11 @@ class PostRepositories
         if($userInfo['strength']){
             $isValid = 1;
         }
-        $oneHourTime = Carbon::now()->addHours(-1)->toDateTimeString();
-        $oneHourPostCount = $this->post->where('uid', $userInfo['uid'])->where('created_at', '>', $oneHourTime)->count();
-        if($oneHourPostCount > 5){
-            return jsonError('创作欲望太强啦,休息一下,看看其他用户的内容吧!');
-        }
+//        $oneHourTime = Carbon::now()->addHours(-1)->toDateTimeString();
+//        $oneHourPostCount = $this->post->where('uid', $userInfo['uid'])->where('created_at', '>', $oneHourTime)->count();
+//        if($oneHourPostCount > 5){
+//            return jsonError('创作欲望太强啦,休息一下,看看其他用户的内容吧!');
+//        }
 
         $detectionText = $request['title'] .','. $request['content'];
         $detectionTextResult = $this->detectionService->checkText($detectionText);
@@ -148,7 +148,7 @@ class PostRepositories
         try{
             $post = $this->post->create($data);
 
-            $this->postData->create([
+            $postData = $this->postData->create([
                 'post_id' => $post->id,
                 'pv' => 0,
                 'pv_real' => 0,
@@ -187,7 +187,7 @@ class PostRepositories
             return jsonSuccess([
                 'post_id' => $post->id,
                 'h5url' => config('customer.share_post_h5url')."?post_id={$post->id}&invite_code={$userInfo['invite_code']}",
-                'bean' => config('customer.share_post_bean')
+                'bean' => $postData->available_bean,
             ]);
 
         }catch (QueryException $exception){

+ 3 - 3
app/Traits/UserTrait.php

@@ -29,7 +29,7 @@ trait UserTrait
     //检查关注状态
     public function getFollowStatus($uid, $followUid) {
         try {
-            $sign = generateSign([], config('customer.app_secret'));
+            $sign = generateSign(['uid' => $followUid, 'follow_uid' => $uid], config('customer.app_secret'));
             $url = config("customer.app_service_url").'/user/v2/follow/checkStatus';
             //$url = 'http://localhost:8080/v2/follow/checkStatus';
             $array = [
@@ -44,7 +44,7 @@ trait UserTrait
     //检查关注状态 多个uid
     public function getFollowMembersStatus($uids) {
         try {
-            $sign = generateSign([], config('customer.app_secret'));
+            $sign = generateSign(['uids' => $uids], config('customer.app_secret'));
             $url = config("customer.app_service_url").'/user/v2/member/getMemberIds';
             $array = [
                 'json' => ['sign' => $sign, 'uids' => $uids], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
@@ -58,7 +58,7 @@ trait UserTrait
     //检查关注状态 多个uid
     public function getFollowMemberFans($follow_id) {
         try {
-            $sign = generateSign([], config('customer.app_secret'));
+            $sign = generateSign(['follow_id' => $follow_id], config('customer.app_secret'));
             $url = config("customer.app_service_url").'/user/v2/member/getFollowMemberFans';
             //$url = 'http://localhost:8080/v2/member/getFollowMemberFans';
             $array = [

+ 1 - 0
app/Transformers/Post/VideoTransformer.php

@@ -49,6 +49,7 @@ class VideoTransformer extends TransformerAbstract
             'praise_count' => $post->data->praise_count,
             'collect_count' => $post->data->collect_count,
             'comment_count' => $post->data->comment_count,
+            'will_collect_bean' => $post->data->will_collect_bean + 3 * $post->data->pv,
             'is_like' => PostLike::where('post_id', $post['id'])->where('uid', $this->uid)->exists()?1:0,
             'is_collect' => PostCollect::where('post_id', $post['id'])->where('uid', $this->uid)->exists()?1:0,
             'is_follow' => $isFollow,

+ 14 - 8
routes/api.php

@@ -22,8 +22,13 @@ $api->version('v1', [
     $api->get('getPlayUrlByVideoId', 'AliYunVodController@getPlayUrlByVideoId');
     //获取所有行为
     $api->get('getAllBehavior', 'BehaviorController@getAllBehavior');
-    //登录+验签
+    //登录
     $api->group(['middleware' => ['chxq_jwt_auth']], function ($api) {
+        //内容详情
+        $api->get('post/detail', 'PostController@detail');
+    });
+    //登录+验签
+    $api->group(['middleware' => ['chxq_jwt_auth','chxq_sign']], function ($api) {
         //发布内容
         $api->post('post', 'PostController@create');
         //个人中心内容
@@ -32,8 +37,6 @@ $api->version('v1', [
         $api->get('post', 'PostController@index');
         //视频列表
         $api->get('post/video', 'PostController@video');
-        //内容详情
-        $api->get('post/detail', 'PostController@detail');
         //推荐内容
         $api->get('post/suggest', 'PostController@suggestPost');
         //评价&回复
@@ -69,18 +72,21 @@ $api->version('v1', [
         //收藏列表
         $api->get('postCollect', 'PostCollectController@index');
 
+        //用户发布数,收藏数,转发数
+        $api->get('post/memberPostStatistics', 'PostController@memberPostStatistics');
+        //关注feed流
+        $api->get('feed', 'FeedController@index');
+    });
+
+    $api->group(['middleware' => ['chxq_jwt_auth','chxq_sign']], function ($api) {
         //优秀居民信息获取
         $api->get('excellentResidents', 'BeanDetailController@excellentResidents');
         //排行榜
         $api->get('rankingList', 'BeanDetailController@rankingList');
         //星球首页
         $api->get('starHome', 'BeanDetailController@starHome');
-
-        //用户发布数,收藏数,转发数
-        $api->get('post/memberPostStatistics', 'PostController@memberPostStatistics');
-        //关注feed流
-        $api->get('feed', 'FeedController@index');
     });
+
     //分享/邀请首页
     $api->get('starDetail', 'BeanDetailController@starDetail');