dyjh пре 6 година
родитељ
комит
95c5dd8641

+ 5 - 2
app/Http/Controllers/Api/V1/AlbumController.php

xqd
@@ -1369,8 +1369,11 @@ class AlbumController extends Controller
             $add['favorite_times'] = 1;
             AlbumStatisticalModel::create($add);
         }
-        $select_info = ['goods_id'=>$data['product_id']];
-        if($userAuth->up_agent_id!=0){
+        $select_info = ['goods_id' => $data['product_id']];
+        if ($userAuth->up_agent_id != 0) {
+            $agent = AlbumAgentModel::where('id'. 'up_agent_id')->first();
+            $agent->favoriteCount++;
+            $agent->save();
             $add_record['agent_id'] = $userAuth->up_agent_id;
             $add_record['open_id'] = $userAuth->open_id;
             $add_record['action'] = 1;

+ 1 - 1
app/Models/AlbumAgentModel.php

xqd
@@ -54,8 +54,8 @@ class AlbumAgentModel extends BaseModel
         'realname',
         'get_count',
         'callCount',
-        'newCount',
         'pointCount',
+        'favoriteCount',
         'share_times'
     ];
 

+ 33 - 0
database/migrations/2019_04_17_092129_add_column_share_to_album_agent.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddColumnShareToAlbumAgent extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_agent', function (Blueprint $table) {
+            //
+            $table->unsignedInteger('favoriteCount')->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_agent', function (Blueprint $table) {
+            //
+        });
+    }
+}