Forráskód Böngészése

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

xielin 5 éve
szülő
commit
0ad9114e6d

+ 7 - 10
app/Console/Commands/VirusAdd.php

@@ -46,12 +46,7 @@ class VirusAdd extends Command
         $this->connection = $this->getConnection();
         $this->channel = $this->connection->channel();
         $this->channel->exchange_declare($this->queue, 'fanout', false, true, false);
-        // 初始化virus域名
-        $this->virusClient = new Client([
-            'base_uri' => config('customer.VIRUS_URL'),
-            'timeout' => 3
-        ]);
-        Log::debug('virusClient:'.json_encode($this->virusClient));
+
     }
 
     public function getConnection()
@@ -89,7 +84,6 @@ class VirusAdd extends Command
      */
     public function handle()
     {
-        Log::info('接收一条消息');
         $queue_name = $this->queue;
         $this->channel->queue_declare($queue_name, false, true, false, false);
         $this->channel->queue_bind($queue_name, $this->queue);
@@ -115,7 +109,10 @@ class VirusAdd extends Command
 
     private function send($data)
     {
-        Log::debug('client:'.json_encode($this->virusClient));
+        // 初始化virus域名
+        $client = new Client([
+            'timeout' => 3
+        ]);
         try {
             // 签名设置
             $signKey = [
@@ -182,10 +179,10 @@ class VirusAdd extends Command
                 ];
             }else{
                 Log::debug('行为类型错误'.json_encode($data));
-                return false;
+                return true;
             }
 
-            $response = $this->virusClient->request('POST', '/v2/record/add', [
+            $response = $client->request('POST', config('customer.VIRUS_URL').'/v2/record/add', [
                 'headers' => [
                     'Content-Type' => 'application/json'
                 ],

+ 10 - 9
app/Repositories/Post/PostRepository.php

@@ -68,7 +68,8 @@ class PostRepository
 
         //验证小号
         $userInfo = $this->getUserInfo($request['uid']);
-        if(!$userInfo || !$userInfo['data'] || $userInfo['data']['type'] != 1){
+        Log::debug('发布内容小号信息:'.json_encode($userInfo));
+        if(!$userInfo || $userInfo['type'] != 1){
             return Response::create([
                 'message'  => '所选小号信息有误',
                 'status_code'   => 500
@@ -95,10 +96,10 @@ class PostRepository
         }
 
         $data = [
-            'uid' => $request['uid'],
-            'username' => '暂无',
-            'mobile' => '13720758488',
-            'avatar' => 'https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83ep3asJn8emiat1MnPdviaPNroWY3f65y5ezkTAk2qtibv7ea9Ht9R2ahxr9bicY1DIj5vN5FibpDOwXegg/132',
+            'uid' => $userInfo['uid'],
+            'username' => $userInfo['username'],
+            'mobile' => $userInfo['mobile'],
+            'avatar' => $userInfo['avatar']??'',
             'type' => $request['type'],
             'img' => $request['img'],
             'video' => $request['video'] ?? '',
@@ -340,7 +341,7 @@ class PostRepository
         //验证小号
         $userInfo = $this->getUserInfo($request['uid']);
         Log::debug('评论&回复小号' . json_encode($userInfo));
-        if (!$userInfo || !$userInfo['data'] || $userInfo['data']['type'] != 1) {
+        if (!$userInfo || $userInfo['type'] != 1) {
             return Response::create([
                 'message' => '所选小号信息有误',
                 'status_code' => 500
@@ -358,10 +359,10 @@ class PostRepository
             'uid' => $request['uid'],
             'post_id' => $request['post_id'],
             'parent_id' => 0,
-            'username' => $userInfo['data']['username'],
+            'username' => $userInfo['username'],
             'reply_uid' => 0,
             'reply_username' => '',
-            'avatar' => $userInfo['data']['avatar'],
+            'avatar' => $userInfo['avatar']??'',
             'content' => $request['content'],
             'is_delete' => 0,
         ];
@@ -420,7 +421,7 @@ class PostRepository
                     'reply_uid' => $comment->reply_uid,
                     'reply_username' => $comment->reply_username,
                     'target_id' => $comment->uid,
-                    'action_id' => $post->id,
+                    'action_id' => $comment->id,
                 ]);
             }
             return Response::create();

+ 1 - 1
app/Traits/UserTrait.php

@@ -17,7 +17,7 @@ trait UserTrait
             $array = [
                 'json' => ['uid' => $uid], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
             ];
-            return http($url,$array, false, 'get');
+            return http($url,$array, true, 'get');
         } catch (\Exception $e) {
             return [];
         }

+ 35 - 0
database/migrations/2019_06_26_091019_add_video_id_to_table_post.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddVideoIdToTablePost extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('post', function (Blueprint $table) {
+            $table->string('video_id', 32)
+                ->default('')
+                ->after('video')
+                ->comment('视频id');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('post', function (Blueprint $table) {
+            //
+        });
+    }
+}