浏览代码

Merge branch 'develop'

xielin 6 年之前
父节点
当前提交
eebfb96a72
共有 68 个文件被更改,包括 2533 次插入26 次删除
  1. 9 4
      .env.example
  2. 2 0
      .gitignore
  3. 84 0
      .rocketeer/config.php
  4. 40 0
      .rocketeer/hooks.php
  5. 24 0
      .rocketeer/paths.php
  6. 80 0
      .rocketeer/remote.php
  7. 35 0
      .rocketeer/scm.php
  8. 19 0
      .rocketeer/stages.php
  9. 61 0
      .rocketeer/strategies.php
  10. 86 0
      app/Console/Commands/apollo.php
  11. 2 1
      app/Console/Kernel.php
  12. 18 0
      app/Helper/helper.php
  13. 66 0
      app/Http/ApiHelper.php
  14. 10 0
      app/Http/Controllers/AuthController.php
  15. 9 0
      app/Http/Controllers/BaseController.php
  16. 105 0
      app/Http/Controllers/ConfigCityManagementController.php
  17. 83 0
      app/Http/Controllers/ConfigController.php
  18. 66 0
      app/Http/Controllers/ConfigPickupGroupController.php
  19. 210 0
      app/Http/Controllers/ConfigPickupNodeController.php
  20. 51 0
      app/Http/Controllers/ConfigProvinceController.php
  21. 45 0
      app/Http/Controllers/StoreTypeController.php
  22. 71 0
      app/Http/Controllers/UeditorController.php
  23. 64 0
      app/Http/Controllers/UploadController.php
  24. 16 1
      app/Http/Middleware/JwtAuthMiddleware.php
  25. 12 0
      app/Models/BaseModel.php
  26. 23 0
      app/Models/ConfigCityManagement.php
  27. 19 0
      app/Models/ConfigPickupGroup.php
  28. 53 0
      app/Models/ConfigPickupNode.php
  29. 10 0
      app/Models/ConfigProvince.php
  30. 18 0
      app/Models/ConfigStoreType.php
  31. 116 0
      app/Repositories/ConfigCityManagementRepository.php
  32. 44 0
      app/Repositories/ConfigPickupGroupRepository.php
  33. 115 0
      app/Repositories/ConfigPickupNodeRepository.php
  34. 22 0
      app/Repositories/ConfigProvinceRepository.php
  35. 25 0
      app/Repositories/ConfigStoreTypeRepository.php
  36. 23 0
      app/Transformers/CityTransformer.php
  37. 18 0
      app/Transformers/ConfigStoreTypeTransformer.php
  38. 18 0
      app/Transformers/PickupGroupTransformer.php
  39. 34 0
      app/Transformers/PickupNodeTransformer.php
  40. 24 0
      app/Transformers/ProvinceTransformer.php
  41. 1 1
      bin/fswatch
  42. 4 1
      bootstrap/app.php
  43. 11 3
      composer.json
  44. 1 1
      config/api.php
  45. 10 0
      config/apollo.php
  46. 6 0
      config/customer.tpl
  47. 82 0
      config/filesystems.php
  48. 1 1
      config/jwt.php
  49. 1 1
      config/laravels.php
  50. 32 0
      database/migrations/2019_04_23_064937_create_table_config_store_type.php
  51. 35 0
      database/migrations/2019_04_23_071015_create_table_config_province.php
  52. 38 0
      database/migrations/2019_04_23_072002_create_table_config_city_management.php
  53. 45 0
      database/migrations/2019_04_23_072817_create_table_config_pickup_node.php
  54. 32 0
      database/migrations/2019_04_23_074545_create_table_config_pickup_group.php
  55. 32 0
      database/migrations/2019_04_25_103653_update_config_pickup_node_table.php
  56. 36 0
      database/migrations/2019_04_25_143536_add_bjcity_id_config_province_table.php
  57. 32 0
      database/migrations/2019_04_26_035256_update_express_type_config_city_management_table.php
  58. 32 0
      database/migrations/2019_04_26_085923_update_area_id_config_province_table.php
  59. 32 0
      database/migrations/2019_04_26_090540_add_bjcity_id_config_province_table.php
  60. 32 0
      database/migrations/2019_04_30_095318_delete_city_code_to_config_province_table.php
  61. 33 0
      database/migrations/2019_05_13_105357_update_work_time_to_config_pickup_node_table.php
  62. 32 0
      database/migrations/2019_05_13_105659_update_store_ids_to_config_pickup_node_table.php
  63. 20 0
      deploy/nginx/conf.d/app.beta.conf
  64. 20 0
      deploy/nginx/conf.d/app.dev.conf
  65. 2 0
      deploy/php/local.ini
  66. 32 0
      docker-compose-beta.yml
  67. 31 0
      docker-compose-dev.yml
  68. 38 12
      routes/api.php

+ 9 - 4
.env.example

@@ -11,12 +11,17 @@ LOG_SLACK_WEBHOOK_URL=
 DB_CONNECTION=mysql
 DB_CONNECTION=mysql
 DB_HOST=127.0.0.1
 DB_HOST=127.0.0.1
 DB_PORT=3306
 DB_PORT=3306
-DB_DATABASE=homestead
-DB_USERNAME=homestead
-DB_PASSWORD=secret
+DB_DATABASE=platform-config
+DB_USERNAME=root
+DB_PASSWORD=root
 
 
 CACHE_DRIVER=file
 CACHE_DRIVER=file
 QUEUE_CONNECTION=sync
 QUEUE_CONNECTION=sync
 
 
 JWT_SECRET=chxqyhnjuikm67wshaed8ij3hyf2ndh3
 JWT_SECRET=chxqyhnjuikm67wshaed8ij3hyf2ndh3
-PER_PAGE=20
+PER_PAGE=20
+
+APP_ID=chxq-platform-manage
+CLUSTER=default
+APOLLO_NAMESPACES="application,config-manage"
+APOLLO_CONFIG_SERVER=http://127.0.0.1:18080

+ 2 - 0
.gitignore

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

+ 84 - 0
.rocketeer/config.php

@@ -0,0 +1,84 @@
+<?php
+
+use Rocketeer\Services\Connections\ConnectionsHandler;
+
+return [
+
+    // The name of the application to deploy
+    // This will create a folder of the same name in the root directory
+    // configured above, so be careful about the characters used
+    'application_name' => 'config-manage',
+
+    // Plugins
+    ////////////////////////////////////////////////////////////////////
+
+    // The plugins to load
+    'plugins'          => [// 'Rocketeer\Plugins\Slack\RocketeerSlack',
+    ],
+
+    // Logging
+    ////////////////////////////////////////////////////////////////////
+
+    // The schema to use to name log files
+    'logs'             => function (ConnectionsHandler $connections) {
+        return sprintf('%s-%s-%s.log', $connections->getConnection(), $connections->getStage(), date('Ymd'));
+    },
+
+    // Remote access
+    //
+    // You can either use a single connection or an array of connections
+    ////////////////////////////////////////////////////////////////////
+
+    // The default remote connection(s) to execute tasks on
+    'default'          => ['production'],
+
+    // The various connections you defined
+    // You can leave all of this empty or remove it entirely if you don't want
+    // to track files with credentials : Rocketeer will prompt you for your credentials
+    // and store them locally
+    'connections'      => [
+        'production' => [
+            'host'      => '47.92.174.125:2345',
+            'username'  => 'root',
+            'password'  => '',
+            'key'       => '/root/.ssh/id_rsa',
+            'keyphrase' => '',
+            'agent'     => '',
+            'db_role'   => true,
+        ],
+    ],
+
+    /*
+     * In most multiserver scenarios, migrations must be run in an exclusive server.
+     * In the event of not having a separate database server (in which case it can
+     * be handled through connections), you can assign a 'db_role' => true to the
+     * server's configuration and it will only run the migrations in that specific
+     * server at the time of deployment.
+     */
+    'use_roles'        => false,
+
+    // Contextual options
+    //
+    // In this section you can fine-tune the above configuration according
+    // to the stage or connection currently in use.
+    // Per example :
+    // 'stages' => array(
+    // 	'staging' => array(
+    // 		'scm' => array('branch' => 'staging'),
+    // 	),
+    //  'production' => array(
+    //    'scm' => array('branch' => 'master'),
+    //  ),
+    // ),
+    ////////////////////////////////////////////////////////////////////
+
+    'on'               => [
+
+        // Stages configurations
+        'stages'      => [],
+        // Connections configuration
+        'connections' => [],
+
+    ],
+
+];

+ 40 - 0
.rocketeer/hooks.php

@@ -0,0 +1,40 @@
+<?php
+
+return [
+
+    // Tasks
+    //
+    // Here you can define in the `before` and `after` array, Tasks to execute
+    // before or after the core Rocketeer Tasks. You can either put a simple command,
+    // a closure which receives a $task object, or the name of a class extending
+    // the Rocketeer\Abstracts\AbstractTask class
+    //
+    // In the `custom` array you can list custom Tasks classes to be added
+    // to Rocketeer. Those will then be available in the command line
+    // with all the other tasks
+    //////////////////////////////////////////////////////////////////////
+
+    // Tasks to execute before the core Rocketeer Tasks
+    'before' => [
+        'setup'   => [],
+        'deploy'  => [],
+        'cleanup' => [],
+    ],
+
+    // Tasks to execute after the core Rocketeer Tasks
+    'after'  => [
+        'setup'   => [],
+        'deploy'  => [
+            'composer dumpautoload',
+            'php artisan route:clear',
+            'chmod -R 777 bootstrap',
+            'chmod -R 777 storage',
+            'chmod -R 777 public'
+        ],
+        'cleanup' => [],
+    ],
+
+    // Custom Tasks to register with Rocketeer
+    'custom' => [],
+
+];

+ 24 - 0
.rocketeer/paths.php

@@ -0,0 +1,24 @@
+<?php
+
+return [
+
+    // Configurable paths
+    //
+    // Here you can manually set paths to some commands Rocketeer
+    // might try to use, if you leave those empty it will try to find them
+    // manually or assume they're in the root folder
+    //
+    // You can also add in this file custom paths for any command or binary
+    // Rocketeer might go looking for
+    ////////////////////////////////////////////////////////////////////
+
+    // Path to the PHP binary
+    'php'      => '/usr/local/php/bin/php',
+
+    // Path to Composer
+    'composer' => '/usr/local/bin/composer',
+
+    // Path to the Artisan CLI
+    'artisan'  => 'artisan',
+
+];

+ 80 - 0
.rocketeer/remote.php

@@ -0,0 +1,80 @@
+<?php
+
+return [
+
+    // Remote server
+    //////////////////////////////////////////////////////////////////////
+
+    // Variables about the servers. Those can be guessed but in
+    // case of problem it's best to input those manually
+    'variables'      => [
+        'directory_separator' => '/',
+        'line_endings'        => "\n",
+    ],
+
+    // The number of releases to keep at all times
+    'keep_releases'  => 4,
+
+    // Folders
+    ////////////////////////////////////////////////////////////////////
+
+    // The root directory where your applications will be deployed
+    // This path *needs* to start at the root, ie. start with a /
+    'root_directory' => '/data/wwwroot/beta',
+
+    // The folder the application will be cloned in
+    // Leave empty to use `application_name` as your folder name
+    'app_directory'  => '',
+
+    // A list of folders/file to be shared between releases
+    // Use this to list folders that need to keep their state, like
+    // user uploaded data, file-based databases, etc.
+    'shared'         => [
+        'storage',
+        'vendor',
+        '.env',
+    ],
+
+    // Execution
+    //////////////////////////////////////////////////////////////////////
+
+    // If enabled will force a shell to be created
+    // which is required for some tools like RVM or NVM
+    'shell'          => false,
+
+    // An array of commands to run under shell
+    'shelled'        => ['which', 'ruby', 'npm', 'bower', 'bundle', 'grunt'],
+
+    // Enable use of sudo for some commands
+    // You can specify a sudo user by doing
+    // 'sudo' => 'the_user'
+    'sudo' => false,
+
+    // An array of commands to run under sudo
+    'sudoed' => [],
+
+    // Permissions$
+    ////////////////////////////////////////////////////////////////////
+
+    'permissions'    => [
+
+        // The folders and files to set as web writable
+        'files'    => [
+            'bootstrap/cache',
+            'storage',
+        ],
+
+        // Here you can configure what actions will be executed to set
+        // permissions on the folder above. The Closure can return
+        // a single command as a string or an array of commands
+        'callback' => function ($task, $file) {
+            return [
+                sprintf('chmod -R 777 %s', $file),
+                sprintf('chmod -R g+s %s', $file),
+                sprintf('chown -R www:www %s', $file),
+            ];
+        },
+
+    ],
+
+];

+ 35 - 0
.rocketeer/scm.php

@@ -0,0 +1,35 @@
+<?php
+
+return [
+
+    // SCM repository
+    //////////////////////////////////////////////////////////////////////
+
+    // The SCM used (supported: "git", "svn")
+    'scm'        => 'git',
+
+    // The SSH/HTTPS address to your repository
+    // Example: https://github.com/vendor/website.git
+    'repository' => 'http://caihongxingqiu:Ch20151002@git.caihongxingqiu.net/rainbow/config-manage.git',
+
+    // The repository credentials : you can leave those empty
+    // if you're using SSH or if your repository is public
+    // In other cases you can leave this empty too, and you will
+    // be prompted for the credentials on deploy. If you don't want
+    // to be prompted (public repo, etc) set the values to null
+    'username'   => 'null',
+    'password'   => 'null',
+
+    // The branch to deploy
+    'branch'     => 'master',
+
+    // Whether your SCM should do a "shallow" clone of the repository
+    // or not – this means a clone with just the latest state of your
+    // application (no history)
+    // If you're having problems cloning, try setting this to false
+    'shallow'    => true,
+
+    // Recursively pull in submodules. Works only with GIT.
+    'submodules' => true,
+
+];

+ 19 - 0
.rocketeer/stages.php

@@ -0,0 +1,19 @@
+<?php
+
+return [
+
+    // Stages
+    //
+    // The multiples stages of your application
+    // if you don't know what this does, then you don't need it
+    //////////////////////////////////////////////////////////////////////
+
+    // Adding entries to this array will split the remote folder in stages
+    // Like /var/www/yourapp/staging and /var/www/yourapp/production
+    'stages'  => [],
+
+    // The default stage to execute tasks on when --stage is not provided
+    // Falsey means all of them
+    'default' => '',
+
+];

+ 61 - 0
.rocketeer/strategies.php

@@ -0,0 +1,61 @@
+<?php
+
+/*
+ * This file is part of Rocketeer
+ *
+ * (c) Maxime Fabre <ehtnam6@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Rocketeer\Binaries\PackageManagers\Composer;
+use Rocketeer\Tasks\Subtasks\Primer;
+
+return [
+
+    // Task strategies
+    //
+    // Here you can configure in a modular way which tasks to use to
+    // execute various core parts of your deployment's flow
+    //////////////////////////////////////////////////////////////////////
+
+    // Which strategy to use to check the server
+    'check'        => 'Php',
+
+    // Which strategy to use to create a new release
+    'deploy'       => 'Clone',
+
+    // Which strategy to use to test your application
+    'test'         => 'Phpunit',
+
+    // Which strategy to use to migrate your database
+    'migrate'      => 'Artisan',
+
+    // Which strategy to use to install your application's dependencies
+    'dependencies' => 'Composer',
+
+    // Execution hooks
+    //////////////////////////////////////////////////////////////////////
+
+    'composer'     => [
+        'install' => function (Composer $composer, $task) {
+            return $composer->install([], ['--no-interaction' => null, '--prefer-dist' => null]);
+        },
+        'update'  => function (Composer $composer) {
+            return $composer->update();
+        },
+    ],
+
+    // Here you can configure the Primer tasks
+    // which will run a set of commands on the local
+    // machine, determining whether the deploy can proceed
+    // or not
+    'primer'       => function (Primer $task) {
+        return [
+            // $task->executeTask('Test'),
+            // $task->binary('grunt')->execute('lint'),
+        ];
+    },
+
+];

+ 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;
 namespace App\Console;
 
 
+use App\Console\Commands\Apollo;
 use Illuminate\Console\Scheduling\Schedule;
 use Illuminate\Console\Scheduling\Schedule;
 use Laravel\Lumen\Console\Kernel as ConsoleKernel;
 use Laravel\Lumen\Console\Kernel as ConsoleKernel;
 
 
@@ -13,7 +14,7 @@ class Kernel extends ConsoleKernel
      * @var array
      * @var array
      */
      */
     protected $commands = [
     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);
+    }
+}

+ 66 - 0
app/Http/ApiHelper.php

@@ -0,0 +1,66 @@
+<?php
+    
+namespace App\Http;
+
+class ApiHelper
+{
+    /**
+     * 响应正确信息
+     * @param string $message 响应提示信息
+     * @param int $code 响应状态码
+     * @param $data 响应数据
+     * @param $meta 对meta的补充
+     *
+     * @return Array
+     */
+    static public function success($message='Success.', $status_code=200, $data=array(), $meta=array())
+    {
+        $result['meta'] = array(
+            'message' => $message,
+            'status_code' => $status_code
+        );
+
+        if(!empty($meta)){
+            $result['meta'] = array_merge($result['meta'], $meta);
+        }
+        
+        if (!empty($data)) {
+            $result['data'] = $data;
+        }
+        
+        return $result;
+    }
+    
+    /**
+     * 保持返回json格式一致
+     * @param string $message 响应提示信息
+     * @param int $code 响应状态码
+     *
+     * @return Array
+     */
+    static public function meta($message='Success.', $status_code=200)
+    {
+        return [
+            'message' => $message,
+            'status_code' => $status_code
+        ];
+    }
+    
+    /**
+     * 响应错误信息
+     * @param string $message 响应提示信息
+     * @param int $code 响应状态码
+     *
+     * @return Array
+     */
+    static public function error($message='Error!', $status_code=200)
+    {
+        $result['meta'] = array(
+            'message' => $message,
+            'status_code' => $status_code
+        );
+        
+        return $result;
+    }
+    
+}

+ 10 - 0
app/Http/Controllers/AuthController.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Http\Controllers;
+
+
+class  AuthController extends BaseController
+{
+
+
+}

+ 9 - 0
app/Http/Controllers/BaseController.php

@@ -0,0 +1,9 @@
+<?php
+
+namespace App\Http\Controllers;
+
+
+class BaseController extends Controller
+{
+
+}

+ 105 - 0
app/Http/Controllers/ConfigCityManagementController.php

@@ -0,0 +1,105 @@
+<?php
+namespace App\Http\Controllers;
+use App\Repositories\ConfigCityManagementRepository;
+use App\Transformers\CityTransformer;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Validator;
+use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+use League\Fractal\Resource\Collection;
+use League\Fractal\Manager;
+use Illuminate\Validation\Rule;
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/26
+ * Time: 下午13:56
+ */
+
+class ConfigCityManagementController extends Controller
+{
+    public function __construct(ConfigCityManagementRepository $configCityManagementRepository)
+    {
+        $this->configCityManagementRepository = $configCityManagementRepository;
+    }
+
+    //城市列表
+    public function lists(Request $request)
+    {
+
+        $cityList = $this->configCityManagementRepository->index($request->all());
+
+        $fractal = new Manager();
+        $resource = new Collection($cityList, new CityTransformer());
+        $resource->setPaginator(new IlluminatePaginatorAdapter($cityList));
+        $data = $fractal->createData($resource)->toArray();
+        $data['extra'] = [
+            'filters' => [
+                'id'
+            ],
+            'columns' => [
+                'id',
+                'province_id',
+                'province_name',
+                'city_name',
+                'city_id',
+                'express_type',
+                'status',
+            ]
+        ];
+        return $data;
+    }
+
+    /**
+     * 添加城市
+     */
+    public function create(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'province_id' => 'required',
+            'province_name' => 'required|string',
+            'city_id' => 'required',
+            'city_name' => 'required|string',
+            'express_type' => 'required',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->configCityManagementRepository->create($request->all());
+    }
+
+
+    //编辑城市
+    public function edit(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:config_city_management',
+            'province_name' => 'required|string',
+            'province_id' => 'required',
+            'city_id' => 'required',
+            'express_type' => 'required',
+            'city_name' => 'required|string|max:30',
+        ]);
+
+        if ($validator->fails()) {
+
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+
+        return $this->configCityManagementRepository->edit($request->all());
+    }
+
+    //删除城市
+    public function delete(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:config_city_management'
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return $this->configCityManagementRepository->delete($request->all());
+
+    }
+
+}

+ 83 - 0
app/Http/Controllers/ConfigController.php

@@ -0,0 +1,83 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: durong
+ * Date: 2019/5/9
+ * Time: 17:20
+ */
+namespace App\Http\Controllers;
+
+class ConfigController extends Controller
+{
+    /**
+     * Create a new controller instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        //
+    }
+    public function index()
+    {
+        return [
+            //是否开启
+            'is_open' => [
+                '1' => '打开',
+                '0' => '关闭',
+                ],
+            'status' => [
+                '1' => '启用',
+                '0' => '禁用',
+                ],
+            //配送方式
+            'express_type' => [
+                '1' => '自提',
+                '2' => '快递',
+                '0' => '全部',
+            ],
+                //储存方式
+                'store_ids' => [
+                    '1' => '冷冻',
+                    '2' => '冷藏',
+                    '0' => '常温',
+                ],
+                //对应模板
+                'apply_type' => [
+                    '1' => '菜市场',
+                    '0' => '团购',
+                ],
+                //版块类型:
+                'area_type' => [
+                    '1' => '专题广告',
+                    '2' => '商品楼层',
+                    '3' => '分类专题(菜市场)',
+                    '0' => 'banner',
+                ],
+                //商品展示方式
+                'show_type' => [
+                    '1' => '通栏大图',
+                    '2' => '左右滑动',
+                    '0' => '左图右字',
+                ],
+                //接货方式:
+                'receive_type' => [
+                    '1' => '手动确认接货',
+                    '0' => '信任交付',
+                ],
+                //城市级别
+                'level' => [
+                    '1' => '省份province',
+                    '2' => '市city',
+                    '3' => '区县district',
+                    '4' => '街道street',
+                ],
+                //链接方式
+                'link_type' => [
+                    '1' => '专题',
+                    '0' => '仅展示',
+                    '2' => '链接',
+                ],
+        ];
+    }
+}

+ 66 - 0
app/Http/Controllers/ConfigPickupGroupController.php

@@ -0,0 +1,66 @@
+<?php
+namespace App\Http\Controllers;
+use App\Models\ConfigPickupGroup;
+use App\Repositories\ConfigPickupGroupRepository;
+use Illuminate\Http\Request;
+use App\Http\ApiHelper;
+use Illuminate\Support\Facades\Validator;
+use App\Transformers\PickupGroupTransformer;
+//use Illuminate\Support\Facades\Validator;
+use League\Fractal\Resource\Collection;
+use League\Fractal\Manager;
+use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/24
+ * Time: 下午4:16
+ */
+
+ class ConfigPickupGroupController extends BaseController
+ {
+     public function __construct(ConfigPickupGroupRepository $configPickupGroupRepository)
+     {
+         $this->configPickupGroupRepository = $configPickupGroupRepository;
+     }
+
+    //自提点分组列表
+     public function index(Request $request)
+     {
+
+         $configPickup = $this->configPickupGroupRepository->index($request->all());
+
+         $fractal = new Manager();
+         $resource = new Collection($configPickup, new PickupGroupTransformer());
+         $resource->setPaginator(new IlluminatePaginatorAdapter($configPickup));
+         $data = $fractal->createData($resource)->toArray();
+         $data['extra'] = [
+             'filters' => [
+                 'id'
+             ],
+             'columns' => [
+                 'id',
+                 'name',
+             ]
+         ];
+         return $data;
+     }
+
+
+     //新建自提点分组
+     public function create(Request $request)
+     {
+
+         $validator = Validator::make($request->all(), [
+             'name' => 'required|string|max:20',
+         ]);
+         if ($validator->fails()) {
+             return $this->response->error($validator->errors()->first(), 500);
+         }
+
+         return  $this->configPickupGroupRepository->create($request->all());
+
+     }
+
+ }
+

+ 210 - 0
app/Http/Controllers/ConfigPickupNodeController.php

@@ -0,0 +1,210 @@
+<?php
+namespace App\Http\Controllers;
+use App\Repositories\ConfigPickupNodeRepository;
+use Illuminate\Http\Request;
+use App\Transformers\PickupNodeTransformer;
+use Illuminate\Support\Facades\Validator;
+use League\Fractal\Resource\Collection;
+use League\Fractal\Manager;
+use Illuminate\Validation\Rule;
+use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/24
+ * Time: 上午10:51
+ */
+
+class ConfigPickupNodeController extends BaseController
+{
+    public function __construct(ConfigPickupNodeRepository $configPickupNodeRepository)
+    {
+        $this->configPickupNodeRepository = $configPickupNodeRepository;
+    }
+
+    //自提点列表
+    public function index(Request $request)
+    {
+        $ConfigPickupNode = $this->configPickupNodeRepository->index($request->all());
+
+        if (count($ConfigPickupNode)>0) {
+
+            foreach ($ConfigPickupNode as $k => $v) {
+
+                $ConfigPickupNode[$k]->pickup_group_name = $v->getGroupNameAttribute();//自提点分组名称
+            }
+        }
+        $fractal = new Manager();
+        $resource = new Collection($ConfigPickupNode, new PickupNodeTransformer());
+        $resource->setPaginator(new IlluminatePaginatorAdapter($ConfigPickupNode));
+        $data = $fractal->createData($resource)->toArray();
+        $data['extra'] = [
+            'filters' => [
+                'id',
+                'name',
+                'city_id',
+                'status'
+            ],
+            'columns' => [
+                'id',
+                'city_id',
+                'city_name',
+                'name',
+                'address',
+                'work_time',
+                'manager_name',
+                'manager_mobile',
+                'receive_type',
+                'longitude',
+                'latitude',
+                'store_ids',
+                'pickup_group_id',
+                'pickup_group_name',
+                'status',
+                'created_at',
+                'pickup_code',
+            ]
+        ];
+        return $data;
+    }
+
+
+    //新建自提点
+    public function create(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'name' => 'required',
+//            'manager_mobile' => ['required', 'regex:/^1(3[0-9]|4[57]|5[0-35-9]|6[56]|7[0135678]|8[0-9]|9[89])\\d{8}$/'],
+            'manager_mobile' => 'required',
+            'address' => 'required',
+            'pickup_group_id' => 'required',
+            'city_id' => 'required',
+            'city_name' => 'required|string',
+            'longitude' => 'required',
+            'latitude' => 'required',
+            'pickup_code' => 'required',
+            'work_time' => 'required',
+            'store_ids' => 'required',
+            'receive_type' => ['required', Rule::in(0,1)],
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->configPickupNodeRepository->create($request->all());
+
+    }
+
+
+    //编辑自提点
+    public function edit(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:config_pickup_node',
+            'name' => 'required|string',
+            'manager_mobile' => 'required',
+            'address' => 'required|string|max:200',
+            'pickup_group_id' => 'required|integer',
+            'city_id' => 'required',
+            'city_name' => 'required|string',
+            'longitude' => 'required',
+            'latitude' => 'required',
+            'pickup_code' => 'required',
+            'work_time' => 'required',
+            'store_ids' => 'required',
+            'receive_type' => ['required', Rule::in(0,1)],
+        ]);
+
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->configPickupNodeRepository->edit($request->all());
+    }
+
+
+    //查看某自提点
+    public function view(Request $request)
+    {
+        $all = $request->all();
+        $validator = Validator::make($all, [
+            'id' => 'required|integer',
+        ]);
+
+        if($validator->fails()) {
+
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        $getPickup = $this->configPickupNodeRepository->index($request->all());
+
+        if (count($getPickup)>0) {
+            foreach ($getPickup as $k => $v) {
+
+                $getPickup[$k]->receive_type = $v->receive_type == 0 ? '信任交付' : '手动确认接货';
+
+                $getPickup[$k]->status = $v->status == 0 ? '禁用' : '启用';
+
+                $getPickup[$k]->store_ids = $v->getStoreNameAttribute();//储存方式名称
+                $getPickup[$k]->pickup_group_id = $v->getGroupNameAttribute();//自提点分组名称
+            }
+        }
+
+        if(!$getPickup){
+
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+
+        $fractal = new Manager();
+        $resource = new Collection($getPickup, new PickupNodeTransformer());
+        $resource->setPaginator(new IlluminatePaginatorAdapter($getPickup));
+        $data = $fractal->createData($resource)->toArray();
+        $data['extra'] = [
+            'filters' => [
+                'id'
+            ],
+            'columns' => [
+                'id',
+                'city_id',
+                'city_name',
+                'name',
+                'address',
+                'work_time',
+                'manager_name',
+                'manager_mobile',
+                'receive_type',
+                'longitude',
+                'latitude',
+                'store_ids',
+                'pickup_group_id',
+                'status',
+            ]
+        ];
+        return $data;
+
+    }
+
+    //接货
+    public function pickupGoods(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:config_pickup_node'
+        ]);
+
+        if($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->configPickupNodeRepository->pickupGoods($request->all());
+    }
+
+    //给货
+    public function deliver_goods(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'id' => 'required|exists:config_pickup_node'
+        ]);
+
+        if($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        return  $this->configPickupNodeRepository->deliver_goods($request->all());
+
+    }
+}

+ 51 - 0
app/Http/Controllers/ConfigProvinceController.php

@@ -0,0 +1,51 @@
+<?php
+namespace App\Http\Controllers;
+use App\Models\ConfigProvince;
+use App\Repositories\ConfigProvinceRepository;
+use App\Transformers\ProvinceTransformer;
+use Illuminate\Http\Request;
+use League\Fractal\Resource\Collection;
+use League\Fractal\Manager;
+use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/23
+ * Time: 下午3:56
+ */
+
+class ConfigProvinceController extends Controller
+{
+
+    public function __construct(ConfigProvinceRepository $configProvinceRepository)
+    {
+        $this->configProvince = $configProvinceRepository;
+    }
+
+    public function province(Request $request)
+    {
+        $province = $this->configProvince->index($request->all());
+        $fractal = new Manager();
+        $resource = new Collection($province, new ProvinceTransformer());
+        $resource->setPaginator(new IlluminatePaginatorAdapter($province));
+        $data = $fractal->createData($resource)->toArray();
+        $data['extra'] = [
+            'filters' => [
+                'bjcity_id'
+            ],
+            'columns' => [
+                'bjcity_id',
+                'parent_id',
+                'area_name',
+                'level',
+                'sort',
+                'area_code',
+                'city_code',
+                'center',
+            ]
+        ];
+        return $data;
+
+    }
+}

+ 45 - 0
app/Http/Controllers/StoreTypeController.php

@@ -0,0 +1,45 @@
+<?php
+namespace App\Http\Controllers;
+use App\Repositories\ConfigStoreTypeRepository;
+use App\Transformers\ConfigStoreTypeTransformer;
+use Illuminate\Http\Request;
+use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+use League\Fractal\Resource\Collection;
+use League\Fractal\Manager;
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/23
+ * Time: 下午3:56
+ */
+
+class StoreTypeController extends BaseController
+{
+
+    public function __construct(ConfigStoreTypeRepository $configStoreTypeRepository)
+    {
+        $this->configStoreTypeRepository = $configStoreTypeRepository;
+    }
+
+    //分类列表
+    public function index(Request $request)
+    {
+
+        $configStoreType = $this->configStoreTypeRepository->index($request->all());
+        $fractal = new Manager();
+        $resource = new Collection($configStoreType, new ConfigStoreTypeTransformer());
+        $resource->setPaginator(new IlluminatePaginatorAdapter($configStoreType));
+        $data = $fractal->createData($resource)->toArray();
+        $data['extra'] = [
+            'filters' => [
+                'id'
+            ],
+            'columns' => [
+                'id',
+                'name',
+            ]
+        ];
+        return $data;
+    }
+
+}

+ 71 - 0
app/Http/Controllers/UeditorController.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use Intervention\Image\Facades\Image;
+use Illuminate\Support\Facades\Storage;
+
+class UeditorController extends Controller
+{
+    //
+
+    public function index(Request $request)
+    {
+        $action = $request->action;
+        switch ($action) {
+            case 'config':
+                $callback = $request->callback;
+
+                $CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents(public_path("config.json"))), true);
+
+                return  response($callback.'('.json_encode($CONFIG).')');
+                break;
+            case 'uploadimage':
+
+                if($request->hasFile('upfile') && $request->file('upfile')->isValid()){
+                    $path = $request['path'] ? $request['path'].'/' : date('Ym').'/';
+                    //获取文件的原文件名 包括扩展名
+                    $yuanname= $request->file('upfile')->getClientOriginalName();
+                    $size = $request->file('upfile')->getSize();
+                    //获取文件的扩展名
+                    $kuoname=$request->file('upfile')->getClientOriginalExtension();
+                    //获取文件的绝对路径,但是获取到的在本地不能打开
+                    $filePath=$request->file('upfile')->getRealPath();
+                    //要保存的文件名 时间+扩展名
+                    $filename=time() . '_' . uniqid() .'.'.$kuoname;
+
+                    $img = Image::make($filePath);
+                    if ($img->getWidth()>480) {
+                        $img->resize(480, null, function ($constraint) {
+                            $constraint->aspectRatio();
+                        });
+                        $img->encode('jpg', 90);
+                        $data = $img->getEncoded();
+                        $imageUrl = Storage::put($path.$filename, $data);
+                    } else {
+                        $imageUrl = Storage::put($path.$filename, file_get_contents($filePath));
+                    }
+
+
+                    if($imageUrl){
+                        return [
+                            'state' => 'SUCCESS',
+                                'url'   => config('common.oss').$path.$filename,
+                                'title' => $filename,
+                                'original'  => $yuanname,
+                                'type'  => $kuoname,
+                                'size'  => $size
+                            ];
+                    }else{
+                        return $this->response->error('图片上传失败,请重试', 500);
+                    }
+                }else{
+                    return $this->response->error('图片上传失败,请重试', 500);
+                }
+
+                break;
+        }
+    }
+
+}

+ 64 - 0
app/Http/Controllers/UploadController.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Storage;
+
+class UploadController extends Controller
+{
+    public function uploadImage(Request $request)
+    {
+        if ($request->hasFile('image') && $request->file('image')->isValid()) {
+            $path = $request->get('path') ? $request->get('path') . '/' : date('Ym') . '/';
+            //获取文件的原文件名 包括扩展名
+//            $yuanname= $request->file('image')->getClientOriginalName();
+//            //获取文件的扩展名
+            $kuoname = $request->file('image')->getClientOriginalExtension();
+//            //获取文件的类型
+//            $type=$request->file('image')->getClientMimeType();
+//            //获取文件的绝对路径,但是获取到的在本地不能打开
+            $filePath = $request->file('image')->getRealPath();
+            //要保存的文件名 时间+扩展名
+            $filename = time() . '_' . uniqid() . '.' . $kuoname;
+            $imageUrl = Storage::put($path . $filename, file_get_contents($filePath));
+            if ($imageUrl) {
+                return [
+                    'data' => ['url' => $path . $filename]
+                ];
+            } else {
+                return $this->response->error('图片上传失败,请重试', 500);
+            }
+        } else {
+            return $this->response->error('图片上传失败,请重试', 500);
+        }
+    }
+
+    public function uploadImages(Request $request)
+    {
+        $files = $request->file('image');
+        $fileCount = count($files);
+        $urls = [];
+        for ($i = 0; $i < $fileCount; $i++) {
+            $kuoname = $files[$i]->getClientOriginalExtension();
+            $filePath = $files[$i]->getRealPath();
+            //要保存的文件名 时间+扩展名
+            $filename = time() . '_' . uniqid() . '.' . $kuoname;
+            $imageUrl = Storage::put($filename, file_get_contents($filePath));
+            if ($imageUrl) {
+                array_push($urls, $filename);
+            } else {
+                Log::debug('文件上传失败。' . $filename);
+            }
+        }
+        if ($urls) {
+            return [
+                'data' => $urls
+            ];
+        } else {
+            return $this->response->error('图片上传失败,请重试', 500);
+        }
+
+    }
+}

+ 16 - 1
app/Http/Middleware/JwtAuthMiddleware.php

@@ -5,6 +5,7 @@ namespace App\Http\Middleware;
 use Closure;
 use Closure;
 use Tymon\JWTAuth\Exceptions\JWTException;
 use Tymon\JWTAuth\Exceptions\JWTException;
 use Tymon\JWTAuth\Exceptions\TokenExpiredException;
 use Tymon\JWTAuth\Exceptions\TokenExpiredException;
+use Tymon\JWTAuth\Exceptions\TokenInvalidException;
 use Tymon\JWTAuth\Facades\JWTAuth;
 use Tymon\JWTAuth\Facades\JWTAuth;
 use Tymon\JWTAuth\Http\Middleware\BaseMiddleware;
 use Tymon\JWTAuth\Http\Middleware\BaseMiddleware;
 
 
@@ -21,7 +22,15 @@ class JwtAuthMiddleware
     {
     {
 
 
         try {
         try {
-            JWTAuth::parseToken()->authenticate();
+            $token = JWTAuth::getToken();
+            if(empty($token)){
+                $error = [
+                    'message' => 'token is required',
+                    'code' => 401,
+                ];
+                return response()->json($error);
+            }
+            $data = JWTAuth::decode($token);
         } catch (TokenExpiredException $e) {
         } catch (TokenExpiredException $e) {
             $error = [
             $error = [
                 'message' => 'Token is Expired',
                 'message' => 'Token is Expired',
@@ -40,6 +49,12 @@ class JwtAuthMiddleware
                 'code' => 401,
                 'code' => 401,
             ];
             ];
             return response()->json($error);
             return response()->json($error);
+        }catch (\Exception $e){
+            $error = [
+                'message' => $e->getMessage(),
+                'code' => 401,
+            ];
+            return response()->json($error);
         }
         }
         return $next($request);
         return $next($request);
     }
     }

+ 12 - 0
app/Models/BaseModel.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class BaseModel extends Model
+{
+    protected $guarded = ['id'];
+
+    protected $hidden = ['deleted_at'];
+}

+ 23 - 0
app/Models/ConfigCityManagement.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Models;
+
+
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class ConfigCityManagement extends BaseModel
+{
+    use SoftDeletes;
+
+    protected $dates = ['deleted_at'];
+    protected  $table = 'config_city_management';
+
+    /**
+     * 可被批量赋值的字段
+     * @var array
+     */
+    protected $fillable = ['province_id','city_id','province_name','city_name','express_type'];
+
+
+
+}

+ 19 - 0
app/Models/ConfigPickupGroup.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Models;
+
+
+class ConfigPickupGroup extends BaseModel
+{
+    protected  $table = 'config_pickup_group';
+
+    /**
+     * 相对关联到自提点表
+     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+     */
+    public function configPickupNode(){
+        return $this->belongsTo('App\Models\ConfigPickupNode', 'pickup_group_id');
+    }
+
+
+}

+ 53 - 0
app/Models/ConfigPickupNode.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Models;
+
+
+class ConfigPickupNode extends BaseModel
+{
+    protected  $table = 'config_pickup_node';
+
+    /**
+     * 可被批量赋值的字段
+     * @var array
+     */
+    protected $fillable = ['pickup_group_id','store_ids','city_name','city_id','distance','name','address','longitude','latitude','pickup_code','work_time','manager_name','manager_mobile','store_ids','receive_type'];
+
+    //一对多关联储存方式表
+    public function configStoreType()
+    {
+        return $this->hasMany('App\Models\ConfigStoreType','store_ids');
+    }
+
+    //一对多关联自提点分组表
+    public function configPickupGroup()
+    {
+        return $this->hasMany('App\Models\configPickupGroup','pickup_group_id');
+    }
+
+    //获取储存方式名称
+    public function getStoreNameAttribute()
+    {
+        $storeId = ConfigStoreType::find($this->store_ids);
+
+        if($storeId){
+            return $storeId->name;
+        }
+        return '';
+
+    }
+
+    //获取自提点分组名称
+    public function getGroupNameAttribute()
+    {
+        $groupName = ConfigPickupGroup::find($this->pickup_group_id);
+
+        if($groupName){
+            return $groupName->name;
+        }
+        return '';
+
+    }
+
+
+}

+ 10 - 0
app/Models/ConfigProvince.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models;
+
+
+class ConfigProvince extends BaseModel
+{
+    protected  $table = 'config_province';
+
+}

+ 18 - 0
app/Models/ConfigStoreType.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Models;
+
+
+class ConfigStoreType extends BaseModel
+{
+    protected  $table = 'config_store_type';
+
+    /**
+     * 相对关联到自提点表
+     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+     */
+    public function configPickupNode(){
+        return $this->belongsTo('App\Models\ConfigPickupNode', 'store_ids');
+    }
+
+}

+ 116 - 0
app/Repositories/ConfigCityManagementRepository.php

@@ -0,0 +1,116 @@
+<?php
+
+namespace App\Repositories;
+
+
+use App\Models\ConfigCityManagement;
+use Symfony\Component\HttpKernel\Exception\HttpException;
+use Dingo\Api\Http\Response;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Database\QueryException;
+
+class ConfigCityManagementRepository {
+    public function __construct(ConfigCityManagement $configCityManagement) {
+
+        $this->configCityManagement = $configCityManagement;
+    }
+    //列表
+    public function index($request)
+    {
+        $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
+        $where = [];
+        if(isset($request['id'])){
+            $where[] = ['id', '=', $request['id']];
+        }
+
+
+        return $this->configCityManagement->where($where)->orderBy('id', 'asc')->paginate($perPage);
+
+    }
+
+    public function create($request)
+    {
+        if($this->configCityManagement->where('city_id', $request['city_id'])->exists()){
+            throw new HttpException(500, '该城市已经存在');
+        }
+
+        $data = [
+            'province_id' => $request['province_id'],
+            'province_name' => $request['province_name'],
+            'city_id' => $request['city_id'],
+            'city_name' => $request['city_name'],
+            'express_type' => $request['express_type'],
+            'status' => $request['status']?$request['status']:0,
+        ];
+
+        if (!$this->configCityManagement->create($data)) {
+            throw new HttpException(500, '添加失败');
+        }
+
+    }
+
+    public function edit($request)
+    {
+        $configCity = $this->configCityManagement->where('id', $request['id'])->first();
+
+        $configCity->province_id = $request['province_id'];
+        $configCity->province_name = $request['province_name'];
+        $configCity->city_id = $request['city_id'];
+        $configCity->city_name = $request['city_name'];
+        $configCity->express_type = $request['express_type'];
+        $configCity->status = $request['status']?$request['status']:0;
+
+        DB::beginTransaction();
+        try {
+            $res = $configCity->save();
+
+            if ($res) {
+                DB::commit();
+                return Response::create();
+            }
+            DB::rollBack();
+            return Response::create([
+                'message' => '编辑失败,请重试',
+                'status_code' => 500
+            ]);
+
+        } catch (QueryException $exception) {
+            DB::rollBack();
+            return Response::create([
+                'message' => '编辑失败,请重试',
+                'error' => $exception->getMessage(),
+                'status_code' => 500
+            ]);
+        }
+    }
+
+    public function delete($request)
+    {
+        $configCity = $this->configCityManagement->where('id', $request['id'])->first();
+
+        DB::beginTransaction();
+        try{
+            $res = $configCity->delete();
+
+            if($res){
+                DB::commit();
+                return Response::create();
+            }
+            DB::rollBack();
+            return Response::create([
+                'message'  => '删除失败,请重试',
+                'status_code'   => 500
+            ]);
+
+        }catch (QueryException $exception){
+            DB::rollBack();
+            return Response::create([
+                'message'  => '删除失败,请重试',
+                'error' => $exception->getMessage(),
+                'status_code'   => 500
+            ]);
+        }
+    }
+
+
+}

+ 44 - 0
app/Repositories/ConfigPickupGroupRepository.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Repositories;
+
+
+use App\Models\ConfigPickupGroup;
+use Symfony\Component\HttpKernel\Exception\HttpException;
+
+class ConfigPickupGroupRepository {
+    public function __construct(ConfigPickupGroup $configPickupGroup) {
+
+        $this->configPickupGroup = $configPickupGroup;
+    }
+    //列表
+    public function index($request)
+    {
+        $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
+        $where = [];
+        if(isset($request['id'])){
+            $where[] = ['id', '=', $request['id']];
+        }
+
+        return $this->configPickupGroup->where($where)->orderBy('id', 'asc')->paginate($perPage);
+
+    }
+
+    /**
+     * 添加自提点分组
+     */
+    public function create($request)
+    {
+        if($this->configPickupGroup->where('name', trim($request['name']))->exists()){
+            throw new HttpException(500, '该自提点已经存在');
+        }
+
+        $data = [
+            'name' => $request['name'],
+        ];
+
+        if (!$this->configPickupGroup->create($data)) {
+            throw new HttpException(500, '添加失败');
+        }
+    }
+}

+ 115 - 0
app/Repositories/ConfigPickupNodeRepository.php

@@ -0,0 +1,115 @@
+<?php
+
+namespace App\Repositories;
+
+
+use Symfony\Component\HttpKernel\Exception\HttpException;
+use App\Models\ConfigPickupNode;
+use Dingo\Api\Http\Response;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Database\QueryException;
+
+class ConfigPickupNodeRepository {
+    public function __construct(ConfigPickupNode $configPickupNode) {
+
+        $this->configPickupNode = $configPickupNode;
+    }
+    //列表
+    public function index($request)
+    {
+        $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
+        $where = [];
+        if(isset($request['id'])){
+            $where[] = ['id', '=', $request['id']];
+        }
+
+        if(isset($request['name'])){
+            $where[] = ['name', 'like', "%{$request['name']}%"];
+
+        }
+
+        if(isset($request['city_id'])){
+            $where[] = ['city_id', '=', $request['city_id']];
+        }
+
+        if(isset($request['status'])){
+            $where[] = ['status', '=', $request['status']];
+        }
+        return $this->configPickupNode->where($where)->paginate($perPage);
+
+    }
+
+    /**
+     * 添加自提点
+     */
+    public function create($request)
+    {
+        if($this->configPickupNode->where('name', trim($request['name']))->exists()){
+            throw new HttpException(500, '该自提点已经存在');
+        }
+
+        $data = [
+            'name' => $request['name'],
+            'city_id' => $request['city_id'],
+            'city_name' => $request['city_name'],
+            'address' => $request['address'],
+            'work_time' => $request['work_time'],
+            'manager_name' => $request['manager_name']??'',
+            'manager_mobile' => $request['manager_mobile'],
+            'receive_type' => $request['receive_type'],
+            'longitude' => $request['longitude'],
+            'latitude' => $request['latitude'],
+            'store_ids' => $request['store_ids'],
+            'pickup_group_id' => $request['pickup_group_id'],
+            'pickup_code' => $request['pickup_code'],
+            'status' => $request['status']?$request['status']:0
+        ];
+
+        if (!$this->configPickupNode->create($data)) {
+            throw new HttpException(500, '添加失败');
+        }
+    }
+
+    public function edit($request)
+    {
+        $pickupNode = $this->configPickupNode->where('id', $request['id'])->first();
+
+        $pickupNode->name = $request['name'];
+        $pickupNode->city_id = $request['city_id'];
+        $pickupNode->city_name = $request['city_name'];
+        $pickupNode->address = $request['address'];
+        $pickupNode->work_time = $request['work_time'];
+        $pickupNode->manager_name = $request['manager_name']??'';
+        $pickupNode->manager_mobile = $request['manager_mobile'];
+        $pickupNode->receive_type = $request['receive_type'];
+        $pickupNode->longitude = $request['longitude'];
+        $pickupNode->latitude = $request['latitude'];
+        $pickupNode->store_ids = $request['store_ids'];
+        $pickupNode->pickup_group_id = $request['pickup_group_id'];
+        $pickupNode->status = $request['status']?$request['status']:0;
+
+        DB::beginTransaction();
+        try{
+            $res = $pickupNode->save();
+
+            if($res){
+                DB::commit();
+                return Response::create();
+            }
+            DB::rollBack();
+            return Response::create([
+                'message'  => '编辑失败,请重试',
+                'status_code'   => 500
+            ]);
+
+        }catch (QueryException $exception){
+            DB::rollBack();
+            return Response::create([
+                'message'  => '编辑失败,请重试',
+                'error' => $exception->getMessage(),
+                'status_code'   => 500
+            ]);
+        }
+    }
+
+}

+ 22 - 0
app/Repositories/ConfigProvinceRepository.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Repositories;
+
+use App\Models\ConfigProvince;
+
+class ConfigProvinceRepository {
+    public function __construct(ConfigProvince $configProvince) {
+        $this->configProvince = $configProvince;
+    }
+    //省市区列表
+    public function index($request)
+    {
+        $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
+        $where = [];
+        if(isset($request['id'])){
+            $where[] = ['bjcity_id', '=', $request['bjcity_id']];
+        }
+
+        return $this->configProvince->where($where)->orderBy('bjcity_id', 'asc')->paginate($perPage);
+    }
+}

+ 25 - 0
app/Repositories/ConfigStoreTypeRepository.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Repositories;
+
+
+
+
+use App\Models\ConfigStoreType;
+
+class ConfigStoreTypeRepository {
+    public function __construct(ConfigStoreType $configStoreType) {
+        $this->configStoreType = $configStoreType;
+    }
+    //列表
+    public function index($request)
+    {
+        $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
+        $where = [];
+        if(isset($request['id'])){
+            $where[] = ['id', '=', $request['id']];
+        }
+
+        return $this->configStoreType->where($where)->orderBy('id', 'asc')->paginate($perPage);
+    }
+}

+ 23 - 0
app/Transformers/CityTransformer.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Transformers;
+
+use App\Models\ConfigCityManagement;
+use League\Fractal\TransformerAbstract;
+
+class CityTransformer extends TransformerAbstract
+{
+
+    public function transform(ConfigCityManagement $city)
+    {
+        return [
+            'id'  => $city['id'],
+            'province_id'  => $city['province_id'],
+            'province_name'    => $city['province_name'],
+            'city_name'    => $city['city_name'],
+            'city_id'    => $city['city_id'],
+            'express_type'    => $city['express_type'],
+            'status'    => $city['status'],
+        ];
+    }
+}

+ 18 - 0
app/Transformers/ConfigStoreTypeTransformer.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Transformers;
+
+use App\Models\ConfigStoreType;
+use League\Fractal\TransformerAbstract;
+
+class ConfigStoreTypeTransformer extends TransformerAbstract
+{
+
+    public function transform(ConfigStoreType $ConfigStoreType)
+    {
+        return [
+            'id'  => $ConfigStoreType['id'],
+            'name'    => $ConfigStoreType['name'],
+        ];
+    }
+}

+ 18 - 0
app/Transformers/PickupGroupTransformer.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Transformers;
+
+use App\Models\ConfigPickupGroup;
+use League\Fractal\TransformerAbstract;
+
+class PickupGroupTransformer extends TransformerAbstract
+{
+
+    public function transform(ConfigPickupGroup $ConfigPickupGroup)
+    {
+        return [
+            'id'  => $ConfigPickupGroup['id'],
+            'name'    => $ConfigPickupGroup['name'],
+        ];
+    }
+}

+ 34 - 0
app/Transformers/PickupNodeTransformer.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace App\Transformers;
+
+use App\Models\ConfigPickupNode;
+use League\Fractal\TransformerAbstract;
+
+class PickupNodeTransformer extends TransformerAbstract
+{
+
+    public function transform(ConfigPickupNode $ConfigPickupNode)
+    {
+        return [
+            'id' => $ConfigPickupNode['id'],
+            'city_id' => $ConfigPickupNode['city_id'],
+            'city_name' => $ConfigPickupNode['city_name'],
+            'name'=> $ConfigPickupNode['name'],
+            'address' => $ConfigPickupNode['address'],
+            'work_time' => $ConfigPickupNode['work_time'],
+            'manager_name' => $ConfigPickupNode['manager_name'],
+            'manager_mobile' => $ConfigPickupNode['manager_mobile'],
+            'receive_type' => $ConfigPickupNode['receive_type'],
+            'longitude' => $ConfigPickupNode['longitude'],
+            'latitude' => $ConfigPickupNode['latitude'],
+            'store_ids' => $ConfigPickupNode['store_ids'],
+            'pickup_group_id' => $ConfigPickupNode['pickup_group_id'],
+            'pickup_group_name' => $ConfigPickupNode['pickup_group_name'],
+            'status' => $ConfigPickupNode['status'],
+            'pickup_code' => $ConfigPickupNode['pickup_code'],
+            'created_at' => date($ConfigPickupNode['created_at']),
+        ];
+
+    }
+}

+ 24 - 0
app/Transformers/ProvinceTransformer.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Transformers;
+
+use App\Models\ConfigProvince;
+use League\Fractal\TransformerAbstract;
+
+class ProvinceTransformer extends TransformerAbstract
+{
+
+    public function transform(ConfigProvince $province)
+    {
+        return [
+            'bjcity_id'  => $province['bjcity_id'],
+            'parent_id'  => $province['parent_id'],
+            'area_name'    => $province['area_name'],
+            'level'    => $province['level'],
+            'sort'    => $province['sort'],
+            'area_code'    => $province['area_code'],
+            'city_code'    => $province['city_code'],
+            'center'    => $province['center'],
+        ];
+    }
+}

+ 1 - 1
bin/fswatch

@@ -9,7 +9,7 @@ echo "Restarting LaravelS..."
 
 
 echo "Starting fswatch..."
 echo "Starting fswatch..."
 LOCKING=0
 LOCKING=0
-fswatch -r -e ".*" -i "\\.php$" ${WORK_DIR} | while read file
+fswatch -e ".*" -i "\\.php$" -m poll_monitor -r ${WORK_DIR} | while read file
 do
 do
     if [[ ! ${file} =~ .php$ ]] ;then
     if [[ ! ${file} =~ .php$ ]] ;then
         continue
         continue

+ 4 - 1
bootstrap/app.php

@@ -26,6 +26,7 @@ $app = new Laravel\Lumen\Application(
  $app->withEloquent();
  $app->withEloquent();
 
 
  $app->configure('api');
  $app->configure('api');
+ $app->configure('apollo');
  $app->configure('auth');
  $app->configure('auth');
  $app->configure('jwt');
  $app->configure('jwt');
 /*
 /*
@@ -62,7 +63,7 @@ $app->singleton(
 
 
  $app->routeMiddleware([
  $app->routeMiddleware([
      'auth' => App\Http\Middleware\Authenticate::class,
      'auth' => App\Http\Middleware\Authenticate::class,
-     'jwt.chxq_auth' => App\Http\Middleware\SignMiddleware::class,
+     'jwt.chxq_auth' => App\Http\Middleware\JwtAuthMiddleware::class,
  ]);
  ]);
 
 
 /*
 /*
@@ -81,6 +82,8 @@ $app->register(App\Providers\AuthServiceProvider::class);
 
 
 $app->register(Dingo\Api\Provider\LumenServiceProvider::class);
 $app->register(Dingo\Api\Provider\LumenServiceProvider::class);
 $app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class);
 $app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class);
+$app->register(\Junliuxian\AliOSS\AliOssServiceProvider::class);
+
 /*
 /*
 |--------------------------------------------------------------------------
 |--------------------------------------------------------------------------
 | Load The Application Routes
 | Load The Application Routes

+ 11 - 3
composer.json

@@ -7,10 +7,15 @@
     "require": {
     "require": {
         "php": ">=7.1.3",
         "php": ">=7.1.3",
         "dingo/api": "^2.2",
         "dingo/api": "^2.2",
+        "doctrine/dbal": "^2.9",
         "hhxsv5/laravel-s": "~3.4.0",
         "hhxsv5/laravel-s": "~3.4.0",
+        "jeroendesloovere/distance": "1.0.2.1",
+        "junliuxian/ali-oss-storage": "~2.0",
+        "intervention/image": "^2.4",
         "laravel/lumen-framework": "5.8.*",
         "laravel/lumen-framework": "5.8.*",
-        "vlucas/phpdotenv": "^3.3",
-        "tymon/jwt-auth": "1.0.0-rc.4.1"
+        "tymon/jwt-auth": "1.0.0-rc.4.1",
+        "multilinguals/apollo-client": "^0.1.2",
+        "vlucas/phpdotenv": "^3.3"
     },
     },
     "require-dev": {
     "require-dev": {
         "fzaninotto/faker": "^1.4",
         "fzaninotto/faker": "^1.4",
@@ -24,7 +29,10 @@
         ],
         ],
         "psr-4": {
         "psr-4": {
             "App\\": "app/"
             "App\\": "app/"
-        }
+        },
+        "files": [
+            "app/Helper/helper.php"
+        ]
     },
     },
     "autoload-dev": {
     "autoload-dev": {
         "classmap": [
         "classmap": [

+ 1 - 1
config/api.php

@@ -57,7 +57,7 @@ return [
     |
     |
     */
     */
 
 
-    'prefix' => env('API_PREFIX', 'api'),
+    'prefix' => env('API_PREFIX', '/'),
 
 
     /*
     /*
     |--------------------------------------------------------------------------
     |--------------------------------------------------------------------------

+ 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}',
+];

+ 82 - 0
config/filesystems.php

@@ -0,0 +1,82 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Default Filesystem Disk
+    |--------------------------------------------------------------------------
+    |
+    | Here you may specify the default filesystem disk that should be used
+    | by the framework. The "local" disk, as well as a variety of cloud
+    | based disks are available to your application. Just store away!
+    |
+    */
+
+    'default' => env('FILESYSTEM_DRIVER', 'oss'),
+
+    /*
+    |--------------------------------------------------------------------------
+    | Default Cloud Filesystem Disk
+    |--------------------------------------------------------------------------
+    |
+    | Many applications store files both locally and in the cloud. For this
+    | reason, you may specify a default "cloud" driver here. This driver
+    | will be bound as the Cloud disk implementation in the container.
+    |
+    */
+
+    'cloud' => env('FILESYSTEM_CLOUD', 's3'),
+
+    /*
+    |--------------------------------------------------------------------------
+    | Filesystem Disks
+    |--------------------------------------------------------------------------
+    |
+    | Here you may configure as many filesystem "disks" as you wish, and you
+    | may even configure multiple disks of the same driver. Defaults have
+    | been setup for each driver as an example of the required options.
+    |
+    | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
+    |
+    */
+
+    'disks' => [
+
+        'local' => [
+            'driver' => 'local',
+            'root' => storage_path('app'),
+        ],
+
+        'public' => [
+            'driver' => 'local',
+            'root' => storage_path('app/public'),
+            'url' => env('APP_URL') . '/storage',
+            'visibility' => 'public',
+        ],
+
+        's3' => [
+            'driver' => 's3',
+            'key' => env('AWS_ACCESS_KEY_ID'),
+            'secret' => env('AWS_SECRET_ACCESS_KEY'),
+            'region' => env('AWS_DEFAULT_REGION'),
+            'bucket' => env('AWS_BUCKET'),
+            'url' => env('AWS_URL'),
+        ],
+
+        'oss' => [
+            'driver' => 'oss',
+            'access_id' => 'LTAIGTDKUOVQf2Ln',
+            'access_key' => 'HzY9r2gDPbURQ0Vp69A7THV0RmxMkb',
+            'bucket' => 'rainbowstar',
+            'endpoint' => 'oss-cn-zhangjiakou.aliyuncs.com', // OSS 外网节点或自定义外部域名
+//            'endpoint_internal' => '<internal endpoint [OSS内网节点] 如:oss-cn-shenzhen-internal.aliyuncs.com>', // v2.0.4 新增配置属性,如果为空,则默认使用 endpoint 配置(由于内网上传有点小问题未解决,请大家暂时不要使用内网节点上传,正在与阿里技术沟通中)
+            'cdnDomain' => '', // 如果isCName为true, getUrl会判断cdnDomain是否设定来决定返回的url,如果cdnDomain未设置,则使用endpoint来生成url,否则使用cdn
+            'ssl' => false, // true to use 'https://' and false to use 'http://'. default is false,
+            'isCName' => false, // 是否使用自定义域名,true: 则Storage.url()会使用自定义的cdn或域名生成文件url, false: 则使用外部节点生成url
+            'debug' => true,
+        ],
+
+    ],
+
+];

+ 1 - 1
config/jwt.php

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

+ 1 - 1
config/laravels.php

@@ -8,7 +8,7 @@ return [
     'listen_port'              => env('LARAVELS_LISTEN_PORT', 18207),
     'listen_port'              => env('LARAVELS_LISTEN_PORT', 18207),
     'socket_type'              => defined('SWOOLE_SOCK_TCP') ? SWOOLE_SOCK_TCP : 1,
     'socket_type'              => defined('SWOOLE_SOCK_TCP') ? SWOOLE_SOCK_TCP : 1,
     'enable_coroutine_runtime' => false,
     'enable_coroutine_runtime' => false,
-    'server'                   => env('LARAVELS_SERVER', 'admin-manage'),
+    'server'                   => env('LARAVELS_SERVER', 'config-manage'),
     'handle_static'            => env('LARAVELS_HANDLE_STATIC', false),
     'handle_static'            => env('LARAVELS_HANDLE_STATIC', false),
     'laravel_base_path'        => env('LARAVEL_BASE_PATH', base_path()),
     'laravel_base_path'        => env('LARAVEL_BASE_PATH', base_path()),
     'inotify_reload'           => [
     'inotify_reload'           => [

+ 32 - 0
database/migrations/2019_04_23_064937_create_table_config_store_type.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTableConfigStoreType extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('config_store_type', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name',20)->nullable();  //储存方式:常温/冷冻/冷藏
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('config_store_type');
+    }
+}

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

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTableConfigProvince extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('config_province', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name',30);  //名称
+            $table->integer('parent_id');//父级ID
+            $table->integer('level');//级别
+            $table->tinyInteger('sort');//排序
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('config_province');
+    }
+}

+ 38 - 0
database/migrations/2019_04_23_072002_create_table_config_city_management.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTableConfigCityManagement extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('config_city_management', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('province_id');//省份ID
+            $table->integer('city_id');//城市ID
+            $table->string('province_name',20);//省份名称
+            $table->string('city_name',30);//城市名称
+            $table->tinyInteger('express_type')->default(0);//快递方式:0.全部;1.自提;2.快递
+            $table->tinyInteger('status')->default(1);        //状态: 0.禁用 1.启用
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('config_city_management');
+    }
+}

+ 45 - 0
database/migrations/2019_04_23_072817_create_table_config_pickup_node.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTableConfigPickupNode extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('config_pickup_node', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('city_id');     //城市ID
+            $table->integer('pickup_group_id');     //分组ID
+            $table->integer('store_ids');     //储存方式ID
+            $table->string('city_name',20);   //城市名称
+            $table->string('name',20);   //名称
+            $table->string('address',200);  //自提点地址
+            $table->string('longitude',100);  //经度
+            $table->string('latitude',100);  //纬度
+            $table->string('pickup_code',50);    //自提点编码
+            $table->dateTime('work_time');                 //自提时间
+            $table->string('manager_name',50)->nullable();   //负责人
+            $table->string('manager_mobile',20);  //负责人电话
+            $table->tinyInteger('receive_type')->default(1);  // 接货方式:0.信任交付;1.手动确认接货
+            $table->tinyInteger('status')->default(1);        //状态: 0.禁用;1.启用
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('config_pickup_node');
+    }
+}

+ 32 - 0
database/migrations/2019_04_23_074545_create_table_config_pickup_group.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTableConfigPickupGroup extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('config_pickup_group', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->string('name',20)->nullable();   //名称
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('config_pickup_group');
+    }
+}

+ 32 - 0
database/migrations/2019_04_25_103653_update_config_pickup_node_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class UpdateConfigPickupNodeTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_pickup_node', function (Blueprint $table) {
+            $table->integer('distance')->comment('距离');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_pickup_node', function (Blueprint $table) {
+            $table->dropColumn(['distance']);
+        });
+    }
+}

+ 36 - 0
database/migrations/2019_04_25_143536_add_bjcity_id_config_province_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddBjcityIdConfigProvinceTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->renameColumn('name', 'area_name');
+            $table->renameColumn('id', 'bjcity_id',20)->comment('百度城市id');
+            $table->string('area_code',50)->nullable()->comment('地区编码');
+            $table->string('city_code',50)->comment('城市编码');
+            $table->string('center',50)->comment('城市中心点(即:经纬度坐标)');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->dropColumn('bjcity_id','area_name','area_code','city_code','center');
+        });
+    }
+}

+ 32 - 0
database/migrations/2019_04_26_035256_update_express_type_config_city_management_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class UpdateExpressTypeConfigCityManagementTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_city_management', function (Blueprint $table) {
+            $table->string('express_type',50)->comment('快递方式:0.全选;1.快递;2.自提')->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_city_management', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 32 - 0
database/migrations/2019_04_26_085923_update_area_id_config_province_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class UpdateAreaIdConfigProvinceTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->renameColumn('bjcity_id', 'area_id');
+
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+        });
+    }
+}

+ 32 - 0
database/migrations/2019_04_26_090540_add_bjcity_id_config_province_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddBjcityIdConfigProvinceCityIdTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->integer('bjcity_id')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 32 - 0
database/migrations/2019_04_30_095318_delete_city_code_to_config_province_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class DeleteCityCodeToConfigProvinceTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->dropColumn('city_code');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            //
+        });
+    }
+}

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

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class UpdateWorkTimeToConfigPickupNodeTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_pickup_node', function (Blueprint $table) {
+            $table->string('work_time')->comment('自提时间')->change();
+
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_pickup_node', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 32 - 0
database/migrations/2019_05_13_105659_update_store_ids_to_config_pickup_node_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class UpdateStoreIdsToConfigPickupNodeTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_pickup_node', function (Blueprint $table) {
+            $table->string('store_ids')->comment('存储方式ID')->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_pickup_node', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 20 - 0
deploy/nginx/conf.d/app.beta.conf

@@ -0,0 +1,20 @@
+server {
+    listen 80;
+    index index.php index.html;
+    error_log  /var/log/nginx/error.log;
+    access_log /var/log/nginx/access.log;
+    root /var/www/public;
+    location ~ \.php$ {
+        try_files $uri =404;
+        fastcgi_split_path_info ^(.+\.php)(/.+)$;
+        fastcgi_pass app_config_manage_beta:9000;
+        fastcgi_index index.php;
+        include fastcgi_params;
+        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+        fastcgi_param PATH_INFO $fastcgi_path_info;
+    }
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        gzip_static on;
+    }
+}

+ 20 - 0
deploy/nginx/conf.d/app.dev.conf

@@ -0,0 +1,20 @@
+server {
+    listen 80;
+    index index.php index.html;
+    error_log  /var/log/nginx/error.log;
+    access_log /var/log/nginx/access.log;
+    root /var/www/public;
+    location ~ \.php$ {
+        try_files $uri =404;
+        fastcgi_split_path_info ^(.+\.php)(/.+)$;
+        fastcgi_pass app_config_manage_dev:9000;
+        fastcgi_index index.php;
+        include fastcgi_params;
+        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+        fastcgi_param PATH_INFO $fastcgi_path_info;
+    }
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        gzip_static on;
+    }
+}

+ 2 - 0
deploy/php/local.ini

@@ -0,0 +1,2 @@
+upload_max_filesize=40M
+post_max_size=40M

+ 32 - 0
docker-compose-beta.yml

@@ -0,0 +1,32 @@
+version: '3'
+
+services:
+  app_config_manage_beta:
+    image: harbor.caihongxingqiu.com:9401/library/php:latest
+    tty: true
+    working_dir: /var/www
+    volumes:
+      - ./:/var/www
+      - ./deploy/php/local.ini:/usr/local/etc/php/conf.d/local.ini
+      - /data/wwwroot/beta/config-manage:/data/wwwroot/beta/config-manage
+    networks:
+      - chxq
+
+  server_config_manage_beta:
+    image: harbor.caihongxingqiu.com:9401/library/nginx:latest
+    tty: true
+    depends_on:
+      - app_config_manage_beta
+    ports:
+      - "28207:80"
+    volumes:
+      - ./:/var/www
+      - ./deploy/nginx/conf.d/app.beta.conf:/etc/nginx/conf.d/app.beta.conf
+    networks:
+      - chxq
+
+#docker networks
+#docker network create --driver overlay chxq
+networks:
+  chxq:
+    external: true

+ 31 - 0
docker-compose-dev.yml

@@ -0,0 +1,31 @@
+version: '3'
+
+services:
+  app_config_manage_dev:
+    image: harbor.caihongxingqiu.com:9401/library/php:latest
+    tty: true
+    working_dir: /var/www
+    volumes:
+      - ./:/var/www
+      - ./deploy/php/local.ini:/usr/local/etc/php/conf.d/local.ini
+    networks:
+      - chxq
+
+  server_config_manage_dev:
+    image: harbor.caihongxingqiu.com:9401/library/nginx:latest
+    tty: true
+    depends_on:
+      - app_config_manage_dev
+    ports:
+      - "18207:80"
+    volumes:
+      - ./:/var/www
+      - ./deploy/nginx/conf.d/app.dev.conf:/etc/nginx/conf.d/app.dev.conf
+    networks:
+      - chxq
+
+#docker networks
+#docker network create --driver overlay chxq
+networks:
+  chxq:
+    external: true

+ 38 - 12
routes/api.php

@@ -16,19 +16,45 @@ $api = app('Dingo\Api\Routing\Router');
 $api->version('v1', [
 $api->version('v1', [
     'namespace' => 'App\Http\Controllers',
     'namespace' => 'App\Http\Controllers',
 ], function ($api) {
 ], function ($api) {
-    //登录
-    $api->post('login', 'AuthController@authenticate');
-    $api->group(['middleware' => 'auth:api'], function ($api) {
-
-        //注册
-        $api->post('reg', 'AuthController@register');
-        //登出
-        $api->post('logout', 'AuthController@logout');
-        //刷新身份令牌
-        $api->post('refresh', 'AuthController@refresh');
-    });
-
+    //百度编辑器
+    $api->get('ueupload', 'UeditorController@index');
+    $api->post('ueupload', 'UeditorController@index');
+    //上传
+    $api->post('upload', 'UploadController@uploadImage');
+    $api->post('multi_upload', 'UploadController@uploadImages');
     $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
     $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
         $api->get('user', 'UserController@index');
         $api->get('user', 'UserController@index');
+
+        //自提点列表
+        $api->get('/pickupNode/index', 'ConfigPickupNodeController@index');
+        //自提点新建
+        $api->post('/pickupNode/create', 'ConfigPickupNodeController@create');
+        //自提点编辑
+        $api->put('/pickupNode/edit', 'ConfigPickupNodeController@edit');
+        //查看自提点
+        $api->get('/pickupNode/view', 'ConfigPickupNodeController@view');
+
+        //自提点分组列表
+        $api->get('/pickupGroup/index', 'ConfigPickupGroupController@index');
+        //自提点分组新增
+        $api->post('/pickupGroup/create', 'ConfigPickupGroupController@create');
+
+        // 储存方式列表
+        $api->get('/storeType/index', 'StoreTypeController@index');
+
+        //获取省市区
+        $api->get('/configProvince/province', 'ConfigProvinceController@province');
+
+        //城市列表
+        $api->get('/cityManagement/lists', 'ConfigCityManagementController@lists');
+        //编辑城市
+        $api->put('/cityManagement/edit', 'ConfigCityManagementController@edit');
+        //删除城市
+        $api->delete('/cityManagement/delete', 'ConfigCityManagementController@delete');
+        //新增城市
+        $api->post('/cityManagement/create', 'ConfigCityManagementController@create');
+
     });
     });
+    //配置文件
+    $api->get('/config', 'ConfigController@index');
 });
 });