dyjh 6 gadi atpakaļ
vecāks
revīzija
928ffb5a01

+ 1 - 1
app/Http/Controllers/Api/V1/AlbumBossController.php

xqd
@@ -400,7 +400,7 @@ class AlbumBossController extends Controller
             $total++;
         }
         $activeCustomers = array();
-        $newCustomers = array();
+        $newCustomers = array();dd(11);
         for ($d = 0; $d < 15; $d++) {
             $Start = mktime(0, 0, 0, date('m'), date('d'), date('y')) + 86400 * $d;
             $End = $Start + 86400;

+ 9 - 1
app/Http/Controllers/Api/V1/AlbumController.php

xqd xqd
@@ -231,13 +231,17 @@ class AlbumController extends Controller
                 } else {
                     $add_record['is_new'] = 1;
                 }
+                $checkWatch = AlbumWatchRecord::where([['open_id',$check->open_id],['agent_id', $userAuth->up_agent_id]])->first();
                 AlbumWatchRecord::create($add_record);
                 //   dd($add_record);
                 // print_r($add_record['agent_id']);die;
                 $user_agent = AlbumAgentModel::where([['id',$add_record['agent_id']],['store_id',$datas['store_id']]])->first();
                 //dd($user_agent);
                 if ($user_agent) {
-                    $user_agent->get_count++;
+                    if (empty($checkWatch)) {
+                        $user_agent->get_count++;
+                    }
+                    $user_agent->pointCount++;
                     $user_agent->save();
                     $agent = AlbumUserModel::where([['id',$user_agent->user_id],['store_id',$datas['store_id']]])->first();
                     $this->sendLogsMessage($datas['store_id'], $agent->open_id, 4, $userAuth->username, $agent->g_open_id);
@@ -1728,6 +1732,10 @@ class AlbumController extends Controller
             // dd($add_record);
             $res = AlbumWatchRecord::create($add_record);
             $user_agent = AlbumAgentModel::where('id',$userAuth->up_agent_id)->first();
+            if ($data['type'] == 7 || $data['type'] == 6) {
+                $user_agent->callCount++;
+                $user_agent->save();
+            }
             $agent = AlbumUserModel::where('id',$user_agent->user_id)->first();
             if($res){
                 try{

+ 3 - 0
app/Models/AlbumAgentModel.php

xqd
@@ -53,6 +53,9 @@ class AlbumAgentModel extends BaseModel
         'status',
         'realname',
         'get_count',
+        'callCount',
+        'newCount',
+        'pointCount',
         'share_times'
     ];
 

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

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