Prechádzať zdrojové kódy

Merge branch 'develop'

caihongxingqiu 6 rokov pred
rodič
commit
859c0fe0da

BIN
.DS_Store


+ 1 - 0
.gitignore

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

+ 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' => 'shop-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/shop-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'),
+        ];
+    },
+
+];

+ 82 - 0
app/Http/Controllers/V1/AuthController.php

@@ -0,0 +1,82 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-29
+ * Time: 9:54
+ */
+
+namespace App\Http\Controllers\V1;
+
+use App\ShopAccount;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Validator;
+use Tymon\JWTAuth\Token;
+use Tymon\JWTAuth\Facades\JWTAuth;
+use App\Transformers\LoginTransformer;
+use League\Fractal\Manager;
+use League\Fractal\Resource\Item;
+use Tymon\JWTAuth\Facades\JWTFactory;
+
+class AuthController extends Controller {
+    public function __construct(JWTAuth $jwt)
+    {
+
+    }
+    public function refresh(Request $request)
+    {
+        $user = Auth::user();
+        $user->token = Auth::refresh();
+        $user->token_ttl = config('jwt.ttl');
+        $user->is_password = !empty($user->password)?1:0;
+        $fractal = new Manager();
+        $res = new Item($user,new LoginTransformer());
+        $array = $fractal->createData($res)->toArray();
+        //同一类型登陆只允许登陆一个
+        return $this->jsonSuccess($array);
+    }
+    /**
+     * 登出
+     * @return mixed
+     */
+    public function logout()
+    {
+        Auth::logout();
+        return $this->jsonSuccess([],'登出成功');
+    }
+    //登陆
+    public function login(Request $request){
+        $data = $request->all();
+        $validator = Validator::make($data, [
+            'account' => 'required|max:50',
+            'password' => 'required|max:32',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        $account = ShopAccount::where(['account'=>$data['account'],'status'=>1])->first();
+        if(!$account){
+            return $this->response->error('登录失败,请重试', 500);
+        }
+        $token = Auth::attempt(['mobile'=>$request->get('mobile'),'password'=>$request->get('password')]);
+        if(!$token){
+            return $this->response->error('登陆失败', 500);
+        }else{
+            $shopAccount = Auth::user();
+            $factory = JWTFactory::customClaims(['shop'=>['uid'=>$shopAccount->id,'username'=>$shopAccount->account,'shop_id'=>$shopAccount->shop_id,'sign'=>md5($shopAccount->id).env('JWT_SECRET')],'type'=>2]);
+            $payload = $factory->make();
+
+            $token = JWTAuth::encode($payload);
+            $shopAccount->token = $token;
+            $shopAccount->token_ttl = config('jwt.ttl');
+            //如果有绑定微信,显示微信open_id
+            $fractal = new Manager();
+            $res = new Item($shopAccount,new LoginTransformer());
+            $array = $fractal->createData($res)->toArray();
+            //日志
+            return $array;
+        }
+    }
+
+}

+ 34 - 0
app/Http/Controllers/V1/ConfigController.php

@@ -0,0 +1,34 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-26
+ * Time: 10:30
+ */
+
+namespace App\Http\Controllers\V1;
+
+
+use App\MemberAttr;
+
+class ConfigController extends Controller {
+
+    public function __construct( )
+    {
+    }
+    //公共参数
+    public function index(){
+        return [
+            //订单状态 0-待付款 1-待发货 2-已发货 3-配送中 4-待自提 5-已自提 6-已完成  7-已关闭
+            'status'=>[
+                '1' =>'正常' ,
+                '0' =>'禁用',
+
+            ],
+            'verify_type'=>[
+                '1' => '不需审核',
+                '0' =>'需要审核',
+            ],
+        ];
+    }
+}

+ 53 - 0
app/Http/Controllers/V1/IndexController.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Http\Controllers\V1;
+
+use App\Repositories\StatisticsRepository;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class IndexController extends Controller
+{
+    public function __construct(StatisticsRepository $statisticsRepository)
+    {
+        $this->statisticsRepository = $statisticsRepository;
+    }
+
+    /**
+     * 获取统计信息
+     * @param Request $request
+     */
+    public function index(Request $request)
+    {
+//        $user = Auth::user();
+//        $shopId = $user->shop_id;
+        $shopId = 1;
+        $request = $request->all();
+        $start = Carbon::parse(isset($request['start']) ? $request['start'] : Carbon::now())->startOfDay()->format('Y-m-d\TH:i:s\Z');
+        $end = Carbon::parse(isset($request['end']) ? $request['end'] : Carbon::now())->endOfDay()->format('Y-m-d\TH:i:s\Z');
+        $data['paid'] = $this->statisticsRepository->getOrderPayInfo($start, $end, $shopId);
+        $data['dfh_order'] = $this->statisticsRepository->getDfhOrder($start, $end, $shopId);
+        $data['finish_order'] = $this->statisticsRepository->getFinishOrder($start, $end, $shopId);
+        $data['total_order'] = $this->statisticsRepository->getOrderNum($start, $end, $shopId);
+        $data['refund_order'] = $this->statisticsRepository->getRefundOrderNum($start, $end, $shopId);
+        $data['feedback_order'] = $this->statisticsRepository->getFeedBackOrderNum($start, $end, $shopId);
+        return $data;
+    }
+
+    /**
+     * 获取销售额
+     * @param Request $request
+     * @return array
+     */
+    public function sales(Request $request)
+    {
+//        $user = Auth::user();
+//        $shopId = $user->shop_id;
+        $shopId = 1;
+        $request = $request->all();
+        $start = Carbon::parse(isset($request['start']) ? $request['start'] : '-6 days')->startOfDay()->format('Y-m-d\TH:i:s\Z');
+        $end = Carbon::parse(isset($request['end']) ? $request['end'] : Carbon::now())->endOfDay()->format('Y-m-d\TH:i:s\Z');
+        return $this->statisticsRepository->getSaleMoney($start, $end, $shopId);
+    }
+}

+ 171 - 0
app/Http/Controllers/V1/ShopController.php

@@ -0,0 +1,171 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-28
+ * Time: 15:31
+ */
+
+namespace App\Http\Controllers\V1;
+
+
+use App\Repositories\ShopRepository;
+use App\Shop;
+use App\ShopAccount;
+use App\Transformers\ShopsTransformer;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Validator;
+use Illuminate\Validation\Rule;
+use League\Fractal\Manager;
+use League\Fractal\Resource\Item;
+use League\Fractal\Resource\Collection;
+use League\Fractal\Pagination\IlluminatePaginatorAdapter;
+use Tymon\JWTAuth\Facades\JWTAuth;
+
+class ShopController extends Controller {
+
+    public function __construct(ShopRepository $shopRepository)
+    {
+        $this->shopRepository = $shopRepository;
+    }
+    //新增商家信息
+    public function addShop(Request $request)
+    {
+        $data = $request->all();
+        $validator = Validator::make($data, [
+            'shop_name' => 'required|max:11',
+            'shop_short_name' => 'required|string|max:100',
+            'mobile' => 'required|max:11',
+            'address' => 'required|string',
+            'province_name' => 'required|string|max:50',
+            'province_id' => 'required|integer|digits_between:1,7',
+            'city_name' => 'required|string:max:50',
+            'city_id' => 'required|integer|digits_between:1,7',
+            'contact_name' => 'string|max:50',
+            'contact_mobile' => 'max:16',
+            'shop_desc' => 'string|max:500',
+            'status' =>['required',Rule::in([0,1])],
+            'logo_img' => 'string',
+            'license_img' => 'required|string',
+            'food_trans_license' => 'required|string',
+            'other_license' => 'string',
+            'proportion'=>'required|digits_between:1,100|integer',
+            'verify_type'=>['required',Rule::in([0,1])],
+            'account'=>'string|max:20',
+            'password'=>'string|min:6|max:18',
+//            'shop_id'=>'integer',
+//            'shop_account_id'=>'integer',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        $shop = Shop::where(['shop_name'=>$data['account']])->first();
+        if($shop){
+            return $this->response->error('该商户已存在,请重新输入', 500);
+        }
+        $shop_account = ShopAccount::where(['account'=>$data['account']])->first();
+        if($shop_account){
+            return $this->response->error('该账号已存在,请重新输入', 500);
+        }
+        $shopRepository = new ShopRepository();
+        $res = $shopRepository->saveShopAccount($data);
+        if($res){
+            return  ['message'  => '成功','status_code'   => 200];
+        }else{
+            return $this->response->error("失败", 500);
+        }
+    }
+
+    public function editShop(Request $request)
+    {
+        $data = $request->all();
+        $validator = Validator::make($data, [
+            'shop_name' => 'required|max:11',
+            'shop_short_name' => 'required|string|max:100',
+            'mobile' => 'required|max:11',
+            'address' => 'required|string',
+            'province_name' => 'required|string|max:50',
+            'province_id' => 'required|integer|digits_between:1,7',
+            'city_name' => 'required|string:max:50',
+            'city_id' => 'required|integer|digits_between:1,7',
+            'contact_name' => 'string|max:50',
+            'contact_mobile' => 'max:16',
+            'shop_desc' => 'string|max:500',
+            'status' =>['required',Rule::in([0,1])],
+            'logo_img' => 'string',
+            'license_img' => 'required|string',
+            'food_trans_license' => 'required|string',
+            'other_license' => 'string',
+            'proportion'=>'required|digits_between:1,100|integer',
+            'verify_type'=>['required',Rule::in([0,1])],
+            'account'=>'string|max:20',
+            'password'=>'string|min:6|max:18',
+            'shop_id'=>'integer|required',
+            'shop_account_id'=>'integer|required',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        $shop = Shop::where('shop_name', '=', $data['shop_name'])->where('shop_id', '<>', $data['shop_id'])->first();
+        if($shop){
+            return $this->response->error('该商户已存在,请重新输入', 500);
+        }
+        $shop_account = ShopAccount::where('account',$data['account'])->where('id', '<>', $data['shop_account_id'])->first();
+        if($shop_account){
+            return $this->response->error('该账号已存在,请重新输入11', 500);
+        }
+        $shopRepository = new ShopRepository();
+        $res = $shopRepository->editShopAccount($data);
+        if($res){
+            return  ['message'  => '成功','status_code'   => 200];
+        }else{
+            return $this->response->error("失败", 500);
+        }
+    }
+    //详情
+    public function view(Request $request)
+    {
+        $data = $request->only('shop_id');
+        $validator = Validator::make($data, [
+            'shop_id' => 'required|integer',
+        ]);
+        if ($validator->fails()) {
+            return $this->response->error($validator->errors()->first(), 500);
+        }
+        $shop = Shop::where(['shop_id'=>$data['shop_id']])->first();
+        $fractal = new Manager();
+        $res = new Item($shop,new ShopsTransformer());
+        return $fractal->createData($res)->toArray();
+    }
+    //列表
+    public function list(Request $request){
+        $shops = $this->shopRepository->shopList($request->all());
+        $fractal = new Manager();
+        $resource = new Collection($shops, new ShopsTransformer());
+        $resource->setPaginator(new IlluminatePaginatorAdapter($shops));
+        $data = $fractal->createData($resource)->toArray();
+        $data['extra']['filters'] = ['shop_name','status'];
+        $data['extra']['columns'] = ['shop_id','shop_name','mobile','province_name','city_name','product_count','proportion','status'];
+        return $data;
+    }
+    /**
+     * @param Request $request
+     * @return mixed
+     * 通过token获取用户
+     */
+    public function getTokenShop(Request $request){
+        $data =  JWTAuth::decode(JWTAuth::getToken())['shop'];
+        if($data->shop_id){
+            $shop = Shop::where(['shop_id'=>$data->shop_id])->first();
+            $fractal = new Manager();
+            $res = new Item($shop,new ShopsTransformer());
+            $data = $fractal->createData($res)->toArray();
+            return $this->jsonSuccess($data);
+        }else{
+            return $this->jsonError('操作失败');
+        }
+    }
+
+
+}

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

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

+ 101 - 0
app/Repositories/ShopRepository.php

@@ -0,0 +1,101 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-28
+ * Time: 15:49
+ */
+namespace App\Repositories;
+
+use App\Shop;
+use App\ShopAccount;
+use Illuminate\Support\Facades\Hash;
+use League\Flysystem\Exception;
+
+class ShopRepository {
+
+    public function __construct() {
+        //$this->shop = $shop;
+    }
+    //新增
+    public function addShopAccount($data = []){
+        $accountData = ['account'=>$data['account'],'password'=>Hash::make($data['password'])];
+        unset($data['account']);
+        unset($data['password']);
+        $shopData = $data;
+        try{
+            $shop = Shop::create($shopData);
+            if($shop){
+                $accountData['shop_id'] = $shop->shop_id;
+                ShopAccount::create($accountData);
+            }
+            return true;
+        }catch (Exception $exception){
+            return false;
+        }
+    }
+    //修改
+    public function saveShopAccount($data = []){
+        $shop_id = isset($data['shop_id'])?$data['shop_id']:0;
+        $shop_account_id = isset($data['shop_account_id'])?$data['shop_account_id']:0;
+        unset($data['shop_id']);
+        unset($data['shop_account_id']);
+        $shopData = $data;
+        try{
+            $shop = Shop::create($shopData);
+            $accountData = [];
+            if($shop){
+                $accountData['shop_id'] = $shop->shop_id;
+            }
+            if(isset($data['account']) && isset($data['password'])){
+                $accountData['account'] = $data['account'];
+                $accountData['password'] = Hash::make($data['password']);
+                ShopAccount::create($accountData);
+            }
+            return true;
+        }catch (Exception $exception){
+            return false;
+        }
+    }
+
+
+    //修改
+    public function editShopAccount($data = []){
+        $shop_id = $data['shop_id'];
+        $shop_account_id = $data['shop_account_id'];
+        $account = $data['account'];
+        $password = $data['password'];
+        unset($data['password']);
+        unset($data['shop_id']);
+        unset($data['shop_account_id']);
+        unset($data['account']);
+        try{
+            $shop = Shop::where(['shop_id'=>$shop_id])->update($data);
+            $accountData = [];
+            if(isset($account) && isset($password)){
+                $accountData['shop_id'] = $shop_id;
+                $accountData['account'] = $account;
+                $accountData['password'] = Hash::make($password);
+                ShopAccount::where(['id'=>$shop_account_id])->update($accountData);
+            }
+            return true;
+        }catch (Exception $exception){
+            return false;
+        }
+    }
+    public function shopList($request)
+    {
+
+        $where = [];
+        if (isset($request['status'])) {
+            $where[] = ['status', '=', $request['status']];
+        }
+        if (isset($request['shop_name'])) {
+            $where[] = ['shop_name', 'like', '%'.$request['shop_name'].'%'];
+        }
+       $perPage = isset($request['per_page']) ? $request['per_page'] : 20;
+        return Shop::where($where)
+            ->orderBy('shop_id', 'desc')
+            ->paginate($perPage);
+    }
+}

+ 453 - 0
app/Repositories/StatisticsRepository.php

@@ -0,0 +1,453 @@
+<?php
+
+namespace App\Repositories;
+
+
+use Carbon\Carbon;
+use Illuminate\Support\Facades\Log;
+
+class StatisticsRepository
+{
+    public function __construct()
+    {
+    }
+
+    /**
+     * 获取付款订单总金额,总支付人数,总订单数
+     * @param string $start
+     * @param string $end
+     * @return array
+     */
+    public function getOrderPayInfo($start = '', $end = '', $shopId = '')
+    {
+        $params = [
+            "index" => "platform_order_statistics",
+            "type" => "_doc",
+            "body" => [
+                "size" => 0,
+                "query" => [
+                    "bool" => [
+                        "must" => [
+                            [
+                                "terms" => [
+                                    "status" => [1, 2, 3, 4, 5, 6]
+                                ]
+                            ],
+                            [
+                                "term" => [
+                                    "shop_id" => $shopId
+                                ]
+                            ],
+                            [
+                                "range" => [
+                                    "created_at" => [
+                                        "from" => $start,
+                                        "to" => $end,
+                                        "include_lower" => true,
+                                        "include_upper" => true,
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                "aggs" => [
+                    "total_fee" => [
+                        "sum" => [
+                            "field" => "real_price"
+                        ]
+                    ],
+                    "pay_user_num" => [
+                        "cardinality" => [
+                            "field" => "uid"
+                        ]
+                    ],
+                    "pay_order_num" => [
+                        "cardinality" => [
+                            "field" => "id"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+
+        $result = \Elasticsearch::search($params);
+        Log::debug('get-order-payinfo:' . json_encode($params));
+        return [
+            'total_fee' => $result['aggregations']['total_fee']['value'],
+            'pay_user_num' => $result['aggregations']['pay_user_num']['value'],
+            'pay_order_num' => $result['aggregations']['pay_order_num']['value'],
+        ];
+    }
+
+    /**
+     * 获取待发货订单数
+     * @param string $start
+     * @param string $end
+     * @return array
+     */
+    public function getDfhOrder($start = '', $end = '', $shopId = '')
+    {
+        $params = [
+            "index" => "platform_order_statistics",
+            "type" => "_doc",
+            "body" => [
+                "size" => 0,
+                "query" => [
+                    "bool" => [
+                        "must" => [
+                            [
+                                "term" => [
+                                    "status" => [
+                                        "value" => 1
+                                    ]
+                                ]
+                            ],
+                            [
+                                "term" => [
+                                    "shop_id" => $shopId
+                                ]
+                            ],
+                            [
+                                "range" => [
+                                    "created_at" => [
+                                        "from" => $start,
+                                        "to" => $end,
+                                        "include_lower" => true,
+                                        "include_upper" => true,
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                "aggs" => [
+                    "dfh_order_num" => [
+                        "cardinality" => [
+                            "field" => "id"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+
+        $result = \Elasticsearch::search($params);
+        Log::debug('get-dfh-order:' . json_encode($params));
+        return [
+            'dfh_order_num' => $result['aggregations']['dfh_order_num']['value']
+        ];
+    }
+
+    /**
+     * 获取完成订单数
+     * @param string $start
+     * @param string $end
+     * @return array
+     */
+    public function getFinishOrder($start = '', $end = '', $shopId = '')
+    {
+        $params = [
+            "index" => "platform_order_statistics",
+            "type" => "_doc",
+            "body" => [
+                "size" => 0,
+                "query" => [
+                    "bool" => [
+                        "must" => [
+                            [
+                                "terms" => [
+                                    "status" => [5, 6]
+                                ]
+                            ],
+                            [
+                                "term" => [
+                                    "shop_id" => $shopId
+                                ]
+                            ],
+                            [
+                                "range" => [
+                                    "created_at" => [
+                                        "from" => $start,
+                                        "to" => $end,
+                                        "include_lower" => true,
+                                        "include_upper" => true,
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                "aggs" => [
+                    "total_fee" => [
+                        "sum" => [
+                            "field" => "real_price"
+                        ]
+                    ],
+                    "finish_order_num" => [
+                        "cardinality" => [
+                            "field" => "id"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+
+        $result = \Elasticsearch::search($params);
+        Log::debug('get-finish-order:' . json_encode($params));
+        return [
+            'finish_total_fee' => $result['aggregations']['total_fee']['value'],
+            'finish_order_num' => $result['aggregations']['finish_order_num']['value']
+        ];
+    }
+
+    /**
+     * 获取总订单数
+     * @param string $start
+     * @param string $end
+     * @return array
+     */
+    public function getOrderNum($start = '', $end = '', $shopId = '')
+    {
+        $params = [
+            "index" => "platform_order_statistics",
+            "type" => "_doc",
+            "body" => [
+                "size" => 0,
+                "query" => [
+                    "bool" => [
+                        "must" => [
+                            [
+                                "term" => [
+                                    "shop_id" => $shopId
+                                ]
+                            ],
+                            [
+                                "range" => [
+                                    "created_at" => [
+                                        "from" => $start,
+                                        "to" => $end,
+                                        "include_lower" => true,
+                                        "include_upper" => true,
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                "aggs" => [
+                    "total_order_num" => [
+                        "cardinality" => [
+                            "field" => "id"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+
+        $result = \Elasticsearch::search($params);
+        Log::debug('get-order-num:' . json_encode($params));
+        return [
+            'total_order_num' => $result['aggregations']['total_order_num']['value']
+        ];
+    }
+
+    /**
+     * 获取总退单数
+     * @param string $start
+     * @param string $end
+     * @return array
+     */
+    public function getRefundOrderNum($start = '', $end = '', $shopId = '')
+    {
+        $params = [
+            "index" => "platform_order_statistics",
+            "type" => "_doc",
+            "body" => [
+                "size" => 0,
+                "query" => [
+                    "bool" => [
+                        "must" => [
+                            [
+                                "terms" => [
+                                    "feedback_status" => [1, 2]
+                                ]
+                            ],
+                            [
+                                "term" => [
+                                    "shop_id" => $shopId
+                                ]
+                            ],
+                            [
+                                "range" => [
+                                    "created_at" => [
+                                        "from" => $start,
+                                        "to" => $end,
+                                        "include_lower" => true,
+                                        "include_upper" => true,
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                "aggs" => [
+                    "refund_order_num" => [
+                        "cardinality" => [
+                            "field" => "id"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+
+        $result = \Elasticsearch::search($params);
+        Log::debug('get-refund-order:' . json_encode($params));
+        return [
+            'refund_order_num' => $result['aggregations']['refund_order_num']['value']
+        ];
+    }
+
+    /**
+     * 获取维权订单数
+     * @param string $start
+     * @param string $end
+     * @return array
+     */
+    public function getFeedBackOrderNum($start = '', $end = '', $shopId = '')
+    {
+        $params = [
+            "index" => "platform_order_statistics",
+            "type" => "_doc",
+            "body" => [
+                "size" => 0,
+                "query" => [
+                    "bool" => [
+                        "must" => [
+                            [
+                                "terms" => [
+                                    "feedback_status" => [1, 2, 3]
+                                ]
+                            ],
+                            [
+                                "term" => [
+                                    "shop_id" => $shopId
+                                ]
+                            ],
+                            [
+                                "range" => [
+                                    "created_at" => [
+                                        "from" => $start,
+                                        "to" => $end,
+                                        "include_lower" => true,
+                                        "include_upper" => true,
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                "aggs" => [
+                    "feedback_order_num" => [
+                        "cardinality" => [
+                            "field" => "id"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+
+        $result = \Elasticsearch::search($params);
+        Log::debug('get-feedback-ordernum:' . json_encode($params));
+        return [
+            'feedback_order_num' => $result['aggregations']['feedback_order_num']['value']
+        ];
+    }
+
+    /**
+     * 获取销售额
+     * @param string $start
+     * @param string $end
+     * @return array
+     */
+    public function getSaleMoney($start = '', $end = '', $shopId = '')
+    {
+        $params = [
+            "index" => "platform_order_statistics",
+            "type" => "_doc",
+            "body" => [
+                "size" => 0,
+                "query" => [
+                    "bool" => [
+                        "must" => [
+                            [
+                                "terms" => [
+                                    "status" => [1, 2, 3, 4, 5, 6]
+                                ]
+                            ],
+                            [
+                                "term" => [
+                                    "shop_id" => $shopId
+                                ]
+                            ],
+                            [
+                                "range" => [
+                                    "created_at" => [
+                                        "from" => $start,
+                                        "to" => $end,
+                                        "include_lower" => true,
+                                        "include_upper" => true,
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                "aggs" => [
+                    "sale_per_day" => [
+                        "date_histogram" => [
+                            "field" => "created_at",
+                            "time_zone" => "Asia/Shanghai",
+                            "interval" => "1d",
+//                            "offset" => 0,
+//                            "order" => [
+//                                "_key" => "asc"
+//                            ],
+//                            "keyed" => false,
+                            "min_doc_count" => 0,
+                            "format" => "yyyy-MM-dd",
+                            "extended_bounds" => [
+                                "min" => Carbon::parse($start)->format('Y-m-d'),
+                                "max" => Carbon::parse($end)->format('Y-m-d'),
+                            ]
+                        ],
+                        "aggs" => [
+                            "total_fee" => [
+                                "sum" => [
+                                    "field" => "real_price"
+                                ]
+                            ],
+                            "pay_user_num" => [
+                                "cardinality" => [
+                                    "field" => "uid"
+                                ]
+                            ]
+                        ]
+                    ]
+
+                ]
+            ]
+        ];
+
+        $result = \Elasticsearch::search($params);
+        Log::debug('get-sale-money:' . json_encode($params));
+        $tmp = [];
+        foreach ($result['aggregations']['sale_per_day']['buckets'] as $row) {
+            $tmpDate = Carbon::parse($row['key_as_string'])->format('m-d');
+            $tmp[$tmpDate] = [
+                'pay_user_num' => $row['pay_user_num']['value'],
+                'total_fee' => $row['total_fee']['value'],
+            ];
+        }
+        return $tmp;
+    }
+}

+ 31 - 0
app/Repositories/UploadFileRepository.php

@@ -0,0 +1,31 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-28
+ * Time: 16:56
+ */
+
+namespace App\Repositories;
+
+
+class UploadFileRepository {
+    //验证短信
+    public function upload($file){
+        //Log::debug($data);
+
+        $client = new \GuzzleHttp\Client();
+        $url = 'https://manage.dev.caihongxingqiu.com/config/upload';
+        $array = [
+            'json' => [
+                'image'=>$file,
+            ],
+            'query' => [],
+            'http_errors' => false
+        ];
+        $response = $client->request('post', $url, $array);
+        //dump($response->getStatusCode());   #打印响应信息
+        // Log::debug($response->getBody()->getContents());
+        return json_decode($response->getBody()->getContents(),true);
+    }
+}

+ 40 - 0
app/Shop.php

@@ -0,0 +1,40 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-28
+ * Time: 15:30
+ */
+
+namespace App;
+
+
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class Shop extends Model
+{
+    use SoftDeletes;
+
+    protected $primaryKey = 'shop_id';
+
+    public $table = 'shop';
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $fillable = ['shop_name','shop_short_name','mobile','address','province_id','province_name','city_id','city_name','contact_mobile','contact_name','shop_desc','status','logo_img','license_img','food_trans_license','other_license','proportion','verify_type','star'];
+
+    /**
+     * The attributes excluded from the model's JSON form.
+     *
+     * @var array
+     */
+    protected $hidden = [];
+    //关联账户
+    public function account()
+    {
+        return $this->hasOne('App\ShopAccount', 'shop_id', 'shop_id');
+    }
+}

+ 32 - 0
app/ShopAccount.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-28
+ * Time: 15:30
+ */
+
+namespace App;
+
+
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class ShopAccount extends Model {
+    use SoftDeletes;
+
+    public $table = 'shop_account';
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $fillable = ['id','account','mobile','password','status','ip','shop_id'];
+
+    /**
+     * The attributes excluded from the model's JSON form.
+     *
+     * @var array
+     */
+    protected $hidden = ['password'];
+}

+ 25 - 0
app/Transformers/LoginTransformer.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Transformers;
+
+use App\ShopAccount;
+use App\User;
+use League\Fractal\TransformerAbstract;
+
+class LoginTransformer extends TransformerAbstract
+{
+
+    public function transform(User $user)
+    {
+        return [
+            'id'    => $user['id'],
+            'account'    => !empty($user['account'])?$user['account']:"",
+            'mobile'    => $user['mobile'],
+            'status' => $user['status'],
+            'shop_id' => $user['shop_id'],
+            'token' => "Bearer{$user['token']}",
+            'token_ttl' => $user['token_ttl'],
+            'shop_account' => $user->shop->toArray(),
+        ];
+    }
+}

+ 45 - 0
app/Transformers/ShopsTransformer.php

@@ -0,0 +1,45 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-04-28
+ * Time: 19:10
+ */
+
+namespace App\Transformers;
+
+use App\Shop;
+use League\Fractal\TransformerAbstract;
+use Carbon\Carbon;
+
+class ShopsTransformer extends  TransformerAbstract{
+
+    public function transform(Shop $shop)
+    {
+        return [
+            'shop_id'    => $shop['shop_id'],
+            'shop_name'    => $shop['shop_name'],
+            'shop_short_name'    => $shop['shop_short_name'],
+            'mobile'    => $shop['mobile'],
+            'address'    => $shop['address'],
+            'province_id'    => $shop['province_id'],
+            'province_name'    => $shop['province_name'],
+            'city_id'    => $shop['city_id'],
+            'city_name'    => $shop['city_name'],
+            'contact_mobile'    => $shop['contact_mobile'],
+            'contact_name'    => $shop['contact_name'],
+            'shop_desc'    => $shop['shop_desc'],
+            'status'    => $shop['status'],
+            'logo_img'    => $shop['logo_img'],
+            'license_img'    => $shop['license_img'],
+            'food_trans_license'    => $shop['food_trans_license'],
+            'other_license'    => $shop['other_license'],
+            'proportion'    => $shop['proportion'],
+            'verify_type'    => $shop['verify_type'],
+            'star'    => $shop['star'],
+            'created_at' => Carbon::parse($shop['created_at'])->format('Y-m-d H:i:s'),
+            'updated_at' => Carbon::parse($shop['updated_at'])->format('Y-m-d H:i:s'),
+            'shop_account' => $shop->account->toArray(),
+        ];
+    }
+}

+ 48 - 0
app/User.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace App;
+
+use Illuminate\Auth\Authenticatable;
+use Laravel\Lumen\Auth\Authorizable;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
+use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
+use Tymon\JWTAuth\Contracts\JWTSubject;
+
+class User extends Model implements JWTSubject,AuthenticatableContract, AuthorizableContract
+{
+    use Authenticatable, Authorizable;
+    public $table='shop_account';
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $fillable = [
+        'id','shop_id','account','password','mobile','status','ip',
+    ];
+
+    public function shop()
+    {
+        return $this->hasOne('App\Shop', 'shop_id', 'shop_id');
+    }
+    /**
+     * The attributes excluded from the model's JSON form.
+     *
+     * @var array
+     */
+    protected $hidden = [
+        'password',
+    ];
+
+    public function getJWTIdentifier()
+    {
+        return $this->getKey();
+    }
+
+    public function getJWTCustomClaims()
+    {
+        return [];
+    }
+
+}

+ 1 - 1
config/jwt.php

@@ -101,7 +101,7 @@ return [
     |
     */
 
-    'ttl' => env('JWT_TTL', 60),
+    'ttl' => env('JWT_TTL', 60 * 24 * 7),
 
     /*
     |--------------------------------------------------------------------------

+ 51 - 0
database/migrations/2019_04_28_172009_create_shops_table.php

@@ -0,0 +1,51 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateShopsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('shop', function (Blueprint $table) {
+            $table->bigIncrements('shop_id');
+            $table->string('shop_name')->comment('商家名称');
+            $table->string('shop_short_name')->nullable()->comment('商家简称');
+            $table->string('mobile',16)->nullable()->comment('商家电话');
+            $table->string('address')->nullable()->comment('商家地址');
+            $table->integer('province_id')->comment('省份id');
+            $table->string('province_name')->nullable()->comment('省份名称');
+            $table->integer('city_id')->comment('城市id');
+            $table->string('city_name')->nullable()->comment('城市名称');
+            $table->string('contact_mobile',16)->nullable()->default('')->comment('联系人电话');
+            $table->string('contact_name')->nullable()->default('')->comment('联系人名称');
+            $table->string('shop_desc')->nullable()->default('')->comment('商家介绍');
+            $table->tinyInteger('status')->default(1)->comment('状态 1启用 0禁用');
+            $table->string('logo_img')->nullable()->default('')->comment('商家logo');
+            $table->string('license_img')->comment('营业执照');
+            $table->string('food_trans_license')->comment('食品流通许可证');
+            $table->string('other_license')->nullable()->default('')->comment('其他证书');
+            $table->tinyInteger('proportion')->comment('利润分成');
+            $table->tinyInteger('verify_type')->default(0)->comment('商品审核方式');
+            $table->integer('star')->nullable()->default(0)->comment('商家评分');
+            $table->softDeletes();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('shops');
+    }
+}

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

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateShopAccountsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('shop_account', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->integer('shop_id')->comment('店铺id');
+            $table->string('account')->nullable()->comment('账号');
+            $table->string('mobile',16)->nullable()->comment('手机号码');
+            $table->string('password')->nullable()->comment('密码');
+            $table->integer('status')->default(1)->comment('状态 1启用 0禁用');
+            $table->string('ip')->default('')->comment('登陆ip');
+            $table->softDeletes();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('shop_accounts');
+    }
+}

+ 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_shop_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_shop_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_shop_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/shop-manage:/data/wwwroot/beta/shop-manage
+    networks:
+      - chxq
+
+  server_shop_manage_beta:
+    image: harbor.caihongxingqiu.com:9401/library/nginx:latest
+    tty: true
+    depends_on:
+      - app_shop_manage_beta
+    ports:
+      - "28210: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_shop_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_shop_manage_dev:
+    image: harbor.caihongxingqiu.com:9401/library/nginx:latest
+    tty: true
+    depends_on:
+      - app_shop_manage_dev
+    ports:
+      - "18210: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

+ 15 - 2
routes/api.php

@@ -16,10 +16,15 @@ $api = app('Dingo\Api\Routing\Router');
 $api->version('v1', [
     'namespace' => 'App\Http\Controllers\V1',
 ], function ($api) {
-    //登录
 
-    $api->post('login', 'AuthController@authenticate');
 
+    //登陆
+    $api->post('login', 'AuthController@login');
+    //获取商户信息
+    $api->post('getShopInfo', 'ShopController@getTokenShop');
+
+    $api->get('statistics', 'IndexController@index');
+    $api->get('statistics/sales', 'IndexController@sales');
 
     $api->group(['middleware' => 'auth:api'], function ($api) {
         //注册
@@ -31,7 +36,15 @@ $api->version('v1', [
     });
 
     $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
+        //新增编辑
+        $api->post('addShop', 'ShopController@addShop');
+        //编辑
+        $api->put('editShop', 'ShopController@editShop');
+        //商户列表
+        $api->get('shopList', 'ShopController@list');
         //用户列表
+        //商户详情
+        $api->get('shopView', 'ShopController@view');
 
         $api->get('user', 'UserController@index');
         //用户列表