Explorar o código

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

duqinya %!s(int64=5) %!d(string=hai) anos
pai
achega
23660f0431

+ 14 - 1
app/Repositories/CmsContentTemplateRepository.php

@@ -114,7 +114,20 @@ class CmsContentTemplateRepository {
      * @param $data
      * @return mixed
      */
-    public function updateTemplateName($data){
+    public function updateTemplateName($data)
+    {
+        $template = $this->cmsContentTemplate->select('city_id','apply_type')->where('id',$data['id'])->first();
+        $template_array = $this->cmsContentTemplate->where(['city_id'=>$template->city_id,'apply_type'=>$template->apply_type])->get();
+
+        if (count($template_array)>1){
+            foreach ($template_array->toArray() as $value){
+                $res = $this->cmsContentTemplate->where('id',$value['id'])->update(['title'=>$data['title']]);
+                if (!$res){
+                    throw new HttpException(500, '修改失败,请重试');
+                }
+            }
+        }
+
         return $this->cmsContentTemplate->where('id',$data['id'])->update(['title'=>$data['title']]);
     }
 }

+ 10 - 0
app/Repositories/CmsContentTemplateSetRepository.php

@@ -211,6 +211,11 @@ class CmsContentTemplateSetRepository {
             ];
 
             if (empty($advertisement_id)){
+                if ($request['rule']['link_type'] == 1){
+                    $templates = $this->cmsSubject->where('id',intval($request['rule']['link_url']))->first();
+                    $templates->used_count +=1;
+                    $templates->save();
+                }
                 if (!$this->cmsContentTemplateSet->create($subject)) {
                     throw new HttpException(500, '添加失败');
                 }
@@ -239,6 +244,11 @@ class CmsContentTemplateSetRepository {
                 'updated_at' => date('Y-m-d H:i:s')
             ];
         if (empty($floor_id)){
+            if ($request['rule']['link_type'] == 1){
+                $templates = $this->cmsSubject->where('id',intval($request['rule']['link_url']))->first();
+                $templates->used_count +=1;
+                $templates->save();
+            }
             if (!$this->cmsContentTemplateSet->create($subject)) {
                 throw new HttpException(500, '添加失败');
             }

+ 34 - 0
database/migrations/2019_06_04_023010_create_member_group_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateMemberGroupTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('member_group', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string("name")->nullable()->comment('分组名称');
+            $table->tinyInteger('is_suggest')->default(0)->comment('是否推荐 0不推荐 1推荐');
+            $table->softDeletes();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('member_group');
+    }
+}

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

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateMemberGroupInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('member_group_info', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('member_group_id')->nullable()->default(0)->comment('用户分组id');
+            $table->integer('uid')->nullable()->default(0)->comment('用户id');
+            $table->integer('sort')->nullable()->default(0)->comment('排序');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('member_group_info');
+    }
+}

+ 34 - 0
database/migrations/2019_06_04_023038_create_topic_group_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTopicGroupTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('topic_group', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name')->nullable()->comment('话题名称');
+            $table->tinyInteger('status')->default(1)->comment('状态 1正常 0禁用');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('topic_group');
+    }
+}

+ 34 - 0
database/migrations/2019_06_04_023043_create_topic_gourp_info_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTopicGourpInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('topic_gourp_info', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('topic_group_id')->nullable()->comment('话题分组id');
+            $table->integer('topic_id')->nullable()->comment('话题id');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('topic_gourp_info');
+    }
+}

+ 34 - 0
database/migrations/2019_06_04_023048_create_video_group_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateVideoGroupTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('video_group', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name')->nullable()->comment('视频分组id');
+            $table->integer('status')->default(1)->comment('状态 1正常 0禁用');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('video_group');
+    }
+}

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

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateVideoGroupInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('video_group_info', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('video_group_id')->nullable()->comment('视频分组id');
+            $table->integer('post_id')->nullable()->comment('内容id');
+            $table->integer('sort')->default(0)->comment('排序');
+            $table->softDeletes();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('video_group_info');
+    }
+}

+ 34 - 0
database/migrations/2019_06_04_023107_create_activities_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateActivitiesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('activities', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name')->nullable()->comment('活动名称');
+            $table->text('countent')->nullable()->comment('内容');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('activities');
+    }
+}

+ 1 - 1
routes/api.php

@@ -66,7 +66,7 @@ $api->version('v1', [
         $api->post('/template/create', 'CmsContentTemplateController@create');
         //列表修改模板状态
         $api->put('/template/edit', 'CmsContentTemplateController@edit');
-        //列表修改模板名称状态
+        //列表修改模板名称
         $api->put('/template/editName', 'CmsContentTemplateController@editTemplateName');
 
         //banner设置