Explorar o código

Merge branch 'develop'

caihongxingqiu %!s(int64=6) %!d(string=hai) anos
pai
achega
82a90257bd

+ 6 - 1
.env.example

@@ -20,4 +20,9 @@ QUEUE_CONNECTION=sync
 
 JWT_SECRET=chxqyhnjuikm67wshaed8ij3hyf2ndh3
 
-PER_PAGE=20
+PER_PAGE=20
+
+APP_ID=chxq-platform-manage
+CLUSTER=default
+APOLLO_NAMESPACES="application,cms-manage"
+APOLLO_CONFIG_SERVER=http://127.0.0.1:18080

+ 1 - 0
.gitignore

@@ -5,3 +5,4 @@ Homestead.yaml
 .env
 composer.lock
 /storage/*
+/config/customer.php

+ 86 - 0
app/Console/Commands/apollo.php

@@ -0,0 +1,86 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Log;
+use Org\Multilinguals\Apollo\Client\ApolloClient;
+
+class Apollo extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'apollo';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Apollo配置服务';
+
+
+    private $apollo;
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+
+        $this->save_dir = storage_path('apollo');
+        $this->config_tpl = config_path() . '/customer.tpl';
+        $this->config_file = config_path() . '/customer.php';
+
+        $this->apollo = new ApolloClient(
+            config('apollo.config_server'),
+            config('apollo.app_id'),
+            config('apollo.namespaces')
+        );
+        $this->apollo->save_dir = $this->save_dir;
+        if (!is_dir($this->save_dir)) {
+            mkdir($this->save_dir);
+        }
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        $this->line('apollo配置服务开启');
+        $restart = true; //失败自动重启
+        do {
+            $error = $this->apollo->start(function () {
+                $list = glob($this->save_dir . DIRECTORY_SEPARATOR . 'apolloConfig.*');
+                $apollo = [];
+                foreach ($list as $l) {
+                    $config = require $l;
+                    if (is_array($config) && isset($config['configurations'])) {
+                        $apollo = array_merge($apollo, $config['configurations']);
+                    }
+                }
+                if (!$apollo) {
+                    Log::error('Load Apollo Config Failed, no config available');
+                }
+                $tpl = file_get_contents($this->config_tpl);
+                foreach ($apollo as $key => $value) {
+                    $tpl = str_replace('{' . $key . '}', $value, $tpl);
+                }
+                file_put_contents($this->config_file, $tpl);
+            }); //此处传入回调
+            if ($error) {
+                Log::info("Apollo Hand error :" . $error);
+            }
+            sleep(60);
+        } while ($error && $restart);
+    }
+}

+ 2 - 1
app/Console/Kernel.php

@@ -2,6 +2,7 @@
 
 namespace App\Console;
 
+use App\Console\Commands\Apollo;
 use Illuminate\Console\Scheduling\Schedule;
 use Laravel\Lumen\Console\Kernel as ConsoleKernel;
 
@@ -13,7 +14,7 @@ class Kernel extends ConsoleKernel
      * @var array
      */
     protected $commands = [
-        //
+        Apollo::class
     ];
 
     /**

+ 18 - 0
app/Helper/helper.php

@@ -0,0 +1,18 @@
+<?php
+/**
+ * 添加自定义辅助函数
+ */
+
+if ( ! function_exists('config_path'))
+{
+    /**
+     * Get the configuration path.
+     *
+     * @param string $path
+     * @return string
+     */
+    function config_path($path = '')
+    {
+        return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
+    }
+}

+ 19 - 4
app/Http/Controllers/CmsContentTemplateSetController.php

@@ -3,6 +3,7 @@ namespace App\Http\Controllers;
 
 use App\Repositories\CmsContentTemplateSetRepository;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Validation\Rule;
 /**
@@ -20,9 +21,23 @@ class CmsContentTemplateSetController extends BaseController
     }
 
 
+    //点击配置
+    public function set(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'tpl_id' => 'required',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+
+        return  $this->cmsContentSetTemplate->set($request->all());
+
+    }
+
     //banner设置
     public function bannerSet(Request $request)
-    {
+    {Log::debug('request-param-bannerSet:'.json_encode($request->all()));
         $validator = Validator::make($request->all(), [
             'rule' => 'required',
             'tpl_id' => 'required|integer',
@@ -38,7 +53,7 @@ class CmsContentTemplateSetController extends BaseController
 
     //专题广告设置
     public function advertisement(Request $request)
-    {
+    {Log::debug('request-param-advertisement:'.json_encode($request->all()));
         $validator = Validator::make($request->all(), [
             'rule' => 'required',
             'tpl_id' => 'required|integer',
@@ -54,7 +69,7 @@ class CmsContentTemplateSetController extends BaseController
 
     //商品楼层设置
     public function floorSet(Request $request)
-    {
+    { Log::debug('request-param-floorSet:'.json_encode($request->all()));
         $validator = Validator::make($request->all(), [
             'rule' => 'required',
             'tpl_id' => 'required|integer',
@@ -71,6 +86,7 @@ class CmsContentTemplateSetController extends BaseController
     //分类专题设置
     public function categorySet(Request $request)
     {
+        Log::debug('request-param-categorySet:'.json_encode($request->all()));
         $validator = Validator::make($request->all(), [
             'rule' => 'required',
             'tpl_id' => 'required|integer',
@@ -79,7 +95,6 @@ class CmsContentTemplateSetController extends BaseController
         if ($validator->fails()) {
             return $this->response->error($validator->errors()->first(), 500);
         }
-
         return  $this->cmsContentSetTemplate->categorySet($request->all());
 
     }

+ 6 - 4
app/Repositories/CmsContentTemplateRepository.php

@@ -17,13 +17,13 @@ class CmsContentTemplateRepository {
         $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
         $where = [];
         if(isset($request['id'])){
-            $where[] = ['id', '=', $request['id']];
+            $where[] = ['id'=>$request['id'],'is_open'=>1];
         }
         if (isset($request['is_open'])){
             $where[] = ['is_open',$request['is_open']];
         }
         if (isset($request['city_id'])){
-            $where[] = ['city_id',$request['city_id']];
+            $where[] = ['city_id'=>$request['city_id'],'is_open'=>1];
         }
 
         return $this->cmsContentTemplate->where($where)->orderBy('id', 'asc')->paginate($perPage);
@@ -35,8 +35,10 @@ class CmsContentTemplateRepository {
      */
     public function create($request)
     {
-        if($this->cmsContentTemplate->where(['city_id'=>$request['city_id'],'title'=>trim($request['title'])])->exists()){
-            throw new HttpException(500, '当前城市该模块已经存在');
+        $where = ['city_id'=>$request['city_id'],'title'=>trim($request['title'])];
+        $template = $this->cmsContentTemplate->where($where)->get();
+        if (count($template)>2){
+            throw new HttpException(500, '每个城市只能存在两个相同的模版');
         }
 
         $subject = [

+ 124 - 29
app/Repositories/CmsContentTemplateSetRepository.php

@@ -8,6 +8,8 @@ use App\Models\CmsContentTemplate;
 use App\Models\CmsContentTemplateSet;
 use App\Models\CmsSubjectProduct;
 use Symfony\Component\HttpKernel\Exception\HttpException;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Database\QueryException;
 
 class CmsContentTemplateSetRepository {
     public function __construct(CmsContentTemplateSet $cmsContentTemplateSet,CmsContentTemplate $cmsContentTemplate,CmsSubjectProduct $cmsSubjectProduct,CmsSubject $cmsSubject) {
@@ -18,31 +20,98 @@ class CmsContentTemplateSetRepository {
         $this->cmsSubject = $cmsSubject;
     }
 
+    /**
+     * 点击内容配置
+     */
+    public function set($request)
+    {
+        $template = $this->cmsContentTemplate->where('id',$request['tpl_id'])->first();
+        $templates = $template->toArray();
+
+        $request = [];
+            if ($templates['is_open'] == 0){
+                $request['type'] = $templates['apply_type'];
+                $request['tpl_id'] = $templates['id'];
+                return $this->preview($request);
+            }
+
+            if ($templates['is_open'] == 1){
+                        $new_template = [
+                            'title' => $templates['title'],
+                            'city_id' => $templates['city_id'],
+                            'city_name' => $templates['city_name'],
+                            'apply_type' => $templates['apply_type'],
+                            'is_open' => 0,
+                        ];
+                        DB::beginTransaction();
+                        try {
+                            $res = $this->cmsContentTemplate->create($new_template);
+                            if (!$res) {
+                                throw new HttpException(500, '添加草稿模板失败');
+                            }
+
+                            $template_set = $this->cmsContentTemplateSet->where('tpl_id', $templates['id'])->get();
+                            if (count($template_set) > 0) {
+                                foreach ($template_set->toArray() as $key => $val) {
+                                    $copy_template = [
+                                        'rule' => $val['rule'],
+                                        'tpl_id' => $res->id,
+                                        'area_type' => $val['area_type'],
+                                        'status' => $val['status'],
+                                    ];
+                                    $result = $this->cmsContentTemplateSet->create($copy_template);
+                                    if (!$result) {
+                                        throw new HttpException(500, '生成模板内容失败');
+                                    }
+                                    $request['type'] = $res->apply_type;
+                                    $request['tpl_id'] = $result->tpl_id;
+                                }
+                            }
+                            DB::commit();
+                           return $this->preview($request);
+    //                        return Response::create();
+
+                        } catch (QueryException $exception) {
+                            DB::rollBack();
+                            return Response::create([
+                                'message' => '生成模板内容失败,请重试',
+                                'error' => $exception->getMessage(),
+                                'status_code' => 500
+                            ]);
+                        }
+                    }
+
+    }
+
     /**
      * banner配置
      */
     public function bannerSet($request)
     {
-            $rules = json_decode($request['rule'],true);
+        $banner_id = $request['id']??'';
+            $rules = $request['rule'];
             if (is_array($rules)){
                 if (count($rules)>10) {
                     throw new HttpException(500, '最多只能添加10个banner海报');
                 }
-                    $decode_floor = json_decode($request['rule'], true);
-                    $count = count($decode_floor);
-                    if ($count > 0) {
-                        for ($i = 0; $i < $count; $i++) {
                             $subject = [
-                                'rule' => json_encode($decode_floor[$i]),
+                                'rule' => json_encode($rules),
                                 'tpl_id' => $request['tpl_id'],
                                 'area_type' => $request['area_type'],
                                 'status' => 0,
+                                'created_at' => date('Y-m-d H:i:s'),
+                                'updated_at' => date('Y-m-d H:i:s')
                             ];
-                            if (!$this->cmsContentTemplateSet->create($subject)) {
-                                throw new HttpException(500, '添加失败');
+                            if ($banner_id){
+                                $banners = $this->cmsContentTemplateSet->where('id',$banner_id)->update($subject);
+                                if (!$banners) {
+                                    throw new HttpException(500, '更新失败');
+                                }
+                            }else{
+                                if (!$this->cmsContentTemplateSet->create($subject)) {
+                                    throw new HttpException(500, '添加失败');
+                                }
                             }
-                        }
-                    }
             }else{
                 throw new HttpException(500, '参数格式有误');
             }
@@ -54,17 +123,26 @@ class CmsContentTemplateSetRepository {
      */
     public function advertisementSet($request)
     {
+        $advertisement_id = $request['id'] ?? '';
             $subject = [
                 'tpl_id' => $request['tpl_id'],
-                'rule' => $request['rule'],
+                'rule' => json_encode($request['rule']),
                 'area_type' => $request['area_type'],
                 'status' => 0,
+                'created_at' => date('Y-m-d H:i:s'),
+                'updated_at' => date('Y-m-d H:i:s')
             ];
 
-            if (!$this->cmsContentTemplateSet->create($subject)) {
-                throw new HttpException(500, '添加失败');
+            if (empty($advertisement_id)){
+                if (!$this->cmsContentTemplateSet->create($subject)) {
+                    throw new HttpException(500, '添加失败');
+                }
+            }else{
+                $advertisement_ids = $this->cmsContentTemplateSet->where('id',$advertisement_id)->update($subject);
+                if (!$advertisement_ids) {
+                    throw new HttpException(500, '更新失败');
+                }
             }
-
     }
 
     /**
@@ -72,16 +150,26 @@ class CmsContentTemplateSetRepository {
      */
     public function floorSet($request)
     {
+        $floor_id = $request['id'] ?? '';
             $subject = [
                 'tpl_id' => $request['tpl_id'],
-                'rule' => $request['rule'],
+                'rule' => json_encode($request['rule']),
                 'area_type' => $request['area_type'],
                 'status' => 0,
+                'created_at' => date('Y-m-d H:i:s'),
+                'updated_at' => date('Y-m-d H:i:s')
             ];
-
+        if (empty($floor_id)){
             if (!$this->cmsContentTemplateSet->create($subject)) {
                 throw new HttpException(500, '添加失败');
             }
+        }else {
+            $floor_ids = $this->cmsContentTemplateSet->where('id',$floor_id)->update($subject);
+            if (!$floor_ids) {
+                throw new HttpException(500, '更新失败');
+            }
+
+        }
 
     }
 
@@ -90,16 +178,26 @@ class CmsContentTemplateSetRepository {
      */
     public function categorySet($request)
     {
+        $category_id = $request['id'] ?? '';
             $subject = [
                 'tpl_id' => $request['tpl_id'],
-                'rule' => $request['rule'],
+                'rule' => json_encode($request['rule']),
                 'area_type' => $request['area_type'],
                 'status' => 0,
+                'created_at' => date('Y-m-d H:i:s'),
+                'updated_at' => date('Y-m-d H:i:s')
             ];
-
+        if (empty($category_id)){
             if (!$this->cmsContentTemplateSet->create($subject)) {
                 throw new HttpException(500, '添加失败');
             }
+        }else {
+            $category_ids = $this->cmsContentTemplateSet->where('id',$category_id)->update($subject);
+            if (!$category_ids) {
+                throw new HttpException(500, '更新失败');
+            }
+
+        }
 
     }
 
@@ -157,17 +255,15 @@ class CmsContentTemplateSetRepository {
             $group_array['content'] =[];
         }
 
-        $group_array['content'][0]['area_type'] ="banner";
-        $banner_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>0])->get();
+        $group_array['content'][0]['area_type'] = 0;
+        $banner_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>0])->orderBy('id', 'desc')->limit(1)->get();
         $new_rule = [];
-
         foreach ($banner_rule->toArray() as $k=>$v){
             $new_rule[$k]['id'] = $v['id'];
             $new_rule[$k]['rule'] = json_decode($v['rule'],true);
         }
         $group_array['content'][0]['rule'] = $new_rule;
-
-        $group_array['content'][1]['area_type'] ="special";
+        $group_array['content'][1]['area_type'] = 1;
         $subject_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>1])->get();
 
         $new_rule = [];
@@ -177,7 +273,7 @@ class CmsContentTemplateSetRepository {
         }
         $group_array['content'][1]['rule'] = $new_rule;
 
-        $group_array['content'][2]['area_type'] ="floor";
+        $group_array['content'][2]['area_type'] = 2;
         $floor_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>2])->get();
         $new_rule = [];
         foreach ($floor_rule->toArray() as $k=>$v){
@@ -187,8 +283,9 @@ class CmsContentTemplateSetRepository {
         foreach ($new_rule as $k=>$v){
             if ($v){
                 $rules = $v['rule'];
+                $show_num = intval($rules['show_num']);
                 $show_type = $this->cmsSubject->select('show_type')->where('id', $rules['link_url'])->first();
-                $product = $this->cmsSubjectProduct->where('subject_id', $rules['link_url'])->orderBy('sort', 'asc')->get();
+                $product = $this->cmsSubjectProduct->where('subject_id', $rules['link_url'])->orderBy('sort', 'asc')->limit($show_num)->get();
                 $pro_array = $product->toArray();
                 $res_id = implode(",", array_column($pro_array, 'product_id'));
                 $new_rule[$k]['product_id'] = $res_id;
@@ -203,7 +300,7 @@ class CmsContentTemplateSetRepository {
                 $group_array['content'][2]['rule'] = $new_rule;
 
         if ($request['type'] == 1){
-            $group_array['content'][3]['area_type'] ="category";
+            $group_array['content'][3]['area_type'] = 3;
             $category_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>3])->get();
             $new_rule = [];
             foreach ($category_rule->toArray() as $k=>$v){
@@ -212,14 +309,12 @@ class CmsContentTemplateSetRepository {
             }
             $group_array['content'][3]['rule'] = $new_rule;
         }
-
         return $group_array;
-
     }
 
     public function getTemplate($cityId)
     {
-        return $this->cmsContentTemplate->select('title','apply_type')->where(['city_id'=>$cityId,'is_open'=>1])->orderBy('apply_type','asc')->get();
+        return $this->cmsContentTemplate->select('id','title','apply_type')->where(['city_id'=>$cityId,'is_open'=>1])->orderBy('apply_type','asc')->get();
 
     }
 

+ 2 - 0
bootstrap/app.php

@@ -25,8 +25,10 @@ $app->withFacades();
 
 $app->withEloquent();
 $app->configure('api');
+$app->configure('apollo');
 $app->configure('auth');
 $app->configure('jwt');
+$app->configure('database');
 
 /*
 |--------------------------------------------------------------------------

+ 5 - 1
composer.json

@@ -12,6 +12,7 @@
         "hhxsv5/laravel-s": "~3.4.0",
         "laravel/lumen-framework": "5.8.*",
         "tymon/jwt-auth": "1.0.0-rc.4.1",
+        "multilinguals/apollo-client": "^0.1.2",
         "vlucas/phpdotenv": "^3.3"
     },
     "require-dev": {
@@ -26,7 +27,10 @@
         ],
         "psr-4": {
             "App\\": "app/"
-        }
+        },
+        "files": [
+            "app/Helper/helper.php"
+        ]
     },
     "autoload-dev": {
         "classmap": [

+ 10 - 0
config/apollo.php

@@ -0,0 +1,10 @@
+<?php
+
+return [
+    'namespaces' => explode(',', env('APOLLO_NAMESPACES')),
+    'cluster' => env('APOLLO_CLUSTER'),
+    'save_dir' => storage_path('apollo'),
+    'config_server' => env('APOLLO_CONFIG_SERVER'),
+    'app_id' => env('APP_ID'),
+    'timeout_interval' => 70
+];

+ 6 - 0
config/customer.tpl

@@ -0,0 +1,6 @@
+<?php
+//此文件为apollo配置文件模板,禁止修改移动
+return [
+    'jwt_secret' => '{jwt_secret}',
+    'manage_service_url' => '{manage_service_url}',
+];

+ 131 - 0
config/database.php

@@ -0,0 +1,131 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Default Database Connection Name
+    |--------------------------------------------------------------------------
+    |
+    | Here you may specify which of the database connections below you wish
+    | to use as your default connection for all database work. Of course
+    | you may use many connections at once using the Database library.
+    |
+    */
+
+    'default' => env('DB_CONNECTION', 'mysql'),
+
+    /*
+    |--------------------------------------------------------------------------
+    | Database Connections
+    |--------------------------------------------------------------------------
+    |
+    | Here are each of the database connections setup for your application.
+    | Of course, examples of configuring each database platform that is
+    | supported by Laravel is shown below to make development simple.
+    |
+    |
+    | All database work in Laravel is done through the PHP PDO facilities
+    | so make sure you have the driver for your particular database of
+    | choice installed on your machine before you begin development.
+    |
+    */
+
+    'connections' => [
+
+        'sqlite' => [
+            'driver' => 'sqlite',
+            'database' => env('DB_DATABASE', database_path('database.sqlite')),
+            'prefix' => env('DB_PREFIX', ''),
+        ],
+
+        'mysql' => [
+            'driver' => 'mysql',
+            'host' => env('DB_HOST', '127.0.0.1'),
+            'port' => env('DB_PORT', 3306),
+            'database' => env('DB_DATABASE', 'forge'),
+            'username' => env('DB_USERNAME', 'forge'),
+            'password' => env('DB_PASSWORD', ''),
+            'unix_socket' => env('DB_SOCKET', ''),
+            'charset' => env('DB_CHARSET', 'utf8mb4'),
+            'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
+            'prefix' => env('DB_PREFIX', ''),
+            'strict' => env('DB_STRICT_MODE', true),
+            'engine' => env('DB_ENGINE', null),
+            'timezone' => env('DB_TIMEZONE', '+08:00'),
+        ],
+
+        'pgsql' => [
+            'driver' => 'pgsql',
+            'host' => env('DB_HOST', '127.0.0.1'),
+            'port' => env('DB_PORT', 5432),
+            'database' => env('DB_DATABASE', 'forge'),
+            'username' => env('DB_USERNAME', 'forge'),
+            'password' => env('DB_PASSWORD', ''),
+            'charset' => env('DB_CHARSET', 'utf8'),
+            'prefix' => env('DB_PREFIX', ''),
+            'schema' => env('DB_SCHEMA', 'public'),
+            'sslmode' => env('DB_SSL_MODE', 'prefer'),
+        ],
+
+        'sqlsrv' => [
+            'driver' => 'sqlsrv',
+            'host' => env('DB_HOST', 'localhost'),
+            'port' => env('DB_PORT', 1433),
+            'database' => env('DB_DATABASE', 'forge'),
+            'username' => env('DB_USERNAME', 'forge'),
+            'password' => env('DB_PASSWORD', ''),
+            'charset' => env('DB_CHARSET', 'utf8'),
+            'prefix' => env('DB_PREFIX', ''),
+        ],
+
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Migration Repository Table
+    |--------------------------------------------------------------------------
+    |
+    | This table keeps track of all the migrations that have already run for
+    | your application. Using this information, we can determine which of
+    | the migrations on disk haven't actually been run in the database.
+    |
+    */
+
+    'migrations' => 'migrations',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Redis Databases
+    |--------------------------------------------------------------------------
+    |
+    | Redis is an open source, fast, and advanced key-value store that also
+    | provides a richer set of commands than a typical key-value systems
+    | such as APC or Memcached. Laravel makes it easy to dig right in.
+    |
+    */
+
+    'redis' => [
+
+        'client' => 'predis',
+
+        'cluster' => env('REDIS_CLUSTER', false),
+
+        'default' => [
+            'host' => env('REDIS_HOST', '127.0.0.1'),
+            'password' => env('REDIS_PASSWORD', null),
+            'port' => env('REDIS_PORT', 6379),
+            'database' => env('REDIS_DB', 0),
+            'read_write_timeout' => 0,
+        ],
+
+        'cache' => [
+            'host' => env('REDIS_HOST', '127.0.0.1'),
+            'password' => env('REDIS_PASSWORD', null),
+            'port' => env('REDIS_PORT', 6379),
+            'database' => env('REDIS_CACHE_DB', 1),
+        ],
+
+    ],
+
+];

+ 1 - 1
config/jwt.php

@@ -25,7 +25,7 @@ return [
     |
     */
 
-    'secret' => env('JWT_SECRET'),
+    'secret' => env('JWT_SECRET',config('customer.jwt_secret')),
 
     /*
     |--------------------------------------------------------------------------

+ 6 - 4
routes/api.php

@@ -51,11 +51,11 @@ $api->version('v1', [
         //新增专题
         $api->post('/subject/create', 'CmsSubjectController@create');
         //查看某专题
-        $api->post('/subject/view', 'CmsSubjectController@view');
+        $api->get('/subject/view', 'CmsSubjectController@view');
         //编辑专题
-        $api->post('/subject/edit', 'CmsSubjectController@edit');
+        $api->put('/subject/edit', 'CmsSubjectController@edit');
         //删除专题
-        $api->post('/subject/delete', 'CmsSubjectController@delete');
+        $api->delete('/subject/delete', 'CmsSubjectController@delete');
         //列表修改专题状态
         $api->post('/subject/editStatus', 'CmsSubjectController@editStatus');
 
@@ -80,8 +80,10 @@ $api->version('v1', [
         $api->post('/templateSet/release', 'CmsContentTemplateSetController@release');
         //内容预览
         $api->post('/templateSet/preview', 'CmsContentTemplateSetController@preview');
+        //点击内容配置
+        $api->post('/templateSet/set', 'CmsContentTemplateSetController@set');
 
         //获取对应城市模板名称
-        $api->post('templateName', 'CmsContentTemplateSetController@templateName');
+        $api->get('templateName', 'CmsContentTemplateSetController@templateName');
     });
 });