浏览代码

Merge remote-tracking branch 'origin/durong' into develop

vagrant 6 年之前
父节点
当前提交
c344421929

+ 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
+{
+
+}

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

@@ -0,0 +1,95 @@
+<?php
+namespace App\Http\Controllers;
+use App\Models\ConfigCityManagement;
+use App\Transformers\CityTransformer;
+use Illuminate\Http\Request;
+
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/23
+ * Time: 下午3:56
+ */
+
+class ConfigCityManagementController extends Controller
+{
+    /**
+     * @api {get} /city/lists 城市管理列表
+     * @apiVersion 0.1
+     * @apiName ConfigCityManagement lists
+     * @apiGroup ConfigCityManagement
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+    {
+    "data": [],
+    "extra": {
+    "filters": [
+    "筛选字段1",
+    "筛选字段2"
+    ],
+    "columns": [
+    "列表显示数据字段1",
+    "列表显示数据字段2"
+    ]
+    },
+    "meta": {
+    "pagination": {}
+    }
+    }
+     */
+
+    public function lists()
+    {
+        $cityList = ConfigCityManagement::orderBy('id', 'desc')
+            ->paginate();
+        if (count($cityList)>0){
+            foreach ($cityList as $k=>$v){
+                $cityList[$k]->express_type = $v->getExpressTypeAttribute();
+                if ($v->status == 0){
+                    $cityList[$k]->status = '启用';
+                }else{
+                    $cityList[$k]->status = '禁用';
+                }
+            }
+        }
+        return $this->response->paginator($cityList, new CityTransformer());
+    }
+
+    /**
+     * @api {post} /city/edit 编辑城市
+     * @apiVersion 0.1
+     * @apiName ConfigCityManagement edit
+     * @apiGroup ConfigCityManagement
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+    {
+    "data": [],
+    "extra": {
+    "filters": [
+    "筛选字段1",
+    "筛选字段2"
+    ],
+    "columns": [
+    "列表显示数据字段1",
+    "列表显示数据字段2"
+    ]
+    },
+    "meta": {
+    "pagination": {}
+    }
+    }
+     */
+
+    public function edit(Request $request)
+    {
+
+    }
+
+
+
+
+
+
+
+
+}

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

@@ -0,0 +1,102 @@
+<?php
+namespace App\Http\Controllers;
+use App\Models\ConfigPickupGroup;
+use Illuminate\Http\Request;
+use App\Http\ApiHelper;
+use Illuminate\Support\Facades\Validator;
+use App\Transformers\PickupGroupTransformer;
+
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/24
+ * Time: 下午4:16
+ */
+
+ class ConfigPickupGroupController extends BaseController
+ {
+     /**
+      * @api {get} /pickupGroup/index 自提点分组列表
+      * @apiVersion 0.1
+      * @apiName ConfigPickupGroup index
+      * @apiGroup ConfigPickupGroup
+      * @apiPermission none
+      * @apiSuccessExample 成功响应:
+
+     {
+     "data": [],
+     "extra": {
+     "filters": [
+     "筛选字段1",
+     "筛选字段2"
+     ],
+     "columns": [
+     "id",
+     "name"
+     ]
+     },
+     "meta": {
+     "pagination": {
+     "total": 2,
+     "count": 2,
+     "per_page": 15,
+     "current_page": 1,
+     "total_pages": 1,
+     "links": []
+     }
+     }
+      */
+     public function index()
+     {
+         $ConfigPickupGroup = ConfigPickupGroup::orderBy('id', 'desc')
+             ->paginate();
+
+         return $this->response->paginator($ConfigPickupGroup, new PickupGroupTransformer());
+     }
+
+     /**
+      * @api {post} /pickupGroup/add 新建自提点分组
+      * @apiVersion 0.1
+      * @apiName ConfigPickupGroup add
+      * @apiGroup ConfigPickupGroup
+      * @apiPermission none
+      * @apiSuccessExample 成功响应:
+
+     {
+     "meta": {
+     "message": "Success.",
+     "status_code": 200
+     }
+     }
+      */
+
+     public function add(Request $request)
+     {
+         $name = $request->input('name') ? $request->input('name') : '';
+         $all = [
+             'name' => $name,
+         ];
+         $rules = [
+             'name' => 'required|max:20',
+             ];
+         $massage = [
+             'name.required' => '自提点分组名称不能为空',
+             'name.max' => '自提点分组名称不能超过20个字符',
+             ];
+         $validator = Validator::make($all, $rules, $massage);
+
+         if ($validator->fails()) {
+
+             return $this->response->array(ApiHelper::error('请求参数格式不正确!', 412));
+         }
+         $pickup_group = ConfigPickupGroup::create($all);
+         if(!$pickup_group) {
+
+             return $this->response->array(ApiHelper::error('新建自提点分组失败!', 500));
+         }
+
+         return $this->response->array(ApiHelper::success());
+     }
+
+ }
+

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

@@ -0,0 +1,284 @@
+<?php
+namespace App\Http\Controllers;
+use App\Http\ApiHelper;
+use Illuminate\Http\Request;
+use App\Models\ConfigPickupNode;
+use App\Transformers\PickupNodeTransformer;
+use Illuminate\Support\Facades\Validator;
+
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/24
+ * Time: 上午10:51
+ */
+
+class ConfigPickupNodeController extends BaseController
+{
+    /**
+     * @api {get} /pickupNode/index 自提点列表
+     * @apiVersion 0.1
+     * @apiName ConfigPickupNode index
+     * @apiGroup ConfigPickupNode
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+
+    {
+    "data": [],
+    "extra": {
+    "filters": [
+    "筛选字段1",
+    "筛选字段2"
+    ],
+    "columns": [
+    "id",
+    "name"
+    ]
+    },
+    "meta": {
+    "pagination": {
+    "total": 2,
+    "count": 2,
+    "per_page": 15,
+    "current_page": 1,
+    "total_pages": 1,
+    "links": []
+    }
+    }
+     */
+    public function index()
+    {
+        $ConfigPickupNode = ConfigPickupNode::orderBy('id', 'desc')
+            ->paginate();
+
+        if (count($ConfigPickupNode)>0) {
+
+            foreach ($ConfigPickupNode as $k => $v) {
+                $ConfigPickupNode[$k]->receive_type = $v->receive_type == 0 ? '信任交付' : '手动确认接货';
+
+                $ConfigPickupNode[$k]->status = $v->status == 0 ? '启用' : '禁用';
+
+                $ConfigPickupNode[$k]->store_ids = $v->getStoreNameAttribute();//储存方式名称
+                $ConfigPickupNode[$k]->pickup_group_id = $v->getGroupNameAttribute();//自提点分组名称
+            }
+
+        }
+
+        return $this->response->paginator($ConfigPickupNode, new PickupNodeTransformer());
+    }
+
+
+    /**
+     * @api {get} /pickupNode/add 新建自提点
+     * @apiVersion 0.1
+     * @apiName ConfigPickupNode add
+     * @apiGroup ConfigPickupNode
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+
+    {
+    "meta": {
+    "message": "Success.",
+    "status_code": 200
+    }
+    }
+     */
+
+    public function add(Request $request)
+    {
+        $name = $request->input('name') ? $request->input('name') : '';
+        $pickup_group_id = $request->input('pickup_group_id') ? $request->input('pickup_group_id') : 0;
+        $city_id = $request->input('city_id') ? $request->input('city_id') : 0;
+        $city_name = $request->input('city_name') ? $request->input('city_name') : '';
+        $address = $request->input('address') ? $request->input('address') : '';
+        $longitude = $request->input('longitude') ? $request->input('longitude') : '';
+        $latitude = $request->input('latitude') ? $request->input('latitude') : '';
+        $pickup_code = $request->input('pickup_code') ? $request->input('pickup_code') : '';
+        $work_time = $request->input('work_time') ? $request->input('work_time') : '';
+        $manager_name = $request->input('manager_name') ? $request->input('manager_name') : '';
+        $manager_mobile = $request->input('manager_mobile') ? $request->input('manager_mobile') : '';
+        $store_ids = $request->input('store_ids') ? $request->input('store_ids') : 0;
+        $receive_type = $request->input('receive_type') ? $request->input('receive_type') : '';
+
+        $data = array(
+            'name' => $name,
+            'pickup_group_id' => $pickup_group_id,
+            'city_id' => $city_id,
+            'city_name' => $city_name,
+            'address' => $address,
+            'longitude' => $longitude,
+            'latitude' => $latitude,
+            'pickup_code' => $pickup_code,
+            'work_time' => $work_time,
+            'manager_name' => $manager_name,
+            'manager_mobile' => $manager_mobile,
+            'store_ids' => $store_ids,
+            'receive_type' => $receive_type,
+        );
+
+        $rules = [
+            'name' => 'required|max:20',
+            '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}$/'],
+            'address' => 'required|max:200',
+            'pickup_group_id' => 'required',
+            'city_id' => 'required',
+            'city_name' => 'required',
+            'longitude' => 'required',
+            'latitude' => 'required',
+            'pickup_code' => 'required',
+            'work_time' => 'required',
+        ];
+
+        $massage = [
+            'name.required' => '自提点名称不能为空',
+            'name.max' => '自提点名称不能超过20个字符',
+            'manager_mobile.required' => '负责人电话不能为空',
+            'manager_mobile.regex' => '负责人手机号格式不正确',
+            'address.required' => '自提点详细地址不能为空',
+            'address.max' => '自提点详细地址不能超过200个字符',
+            'pickup_group_id.required' => '自提点分组ID不能为空',
+            'city_id.required' => '城市不能为空',
+            'city_name.required' => '城市名称不能为空',
+            'longitude.required' => '经度不能为空',
+            'latitude.required' => '纬度不能为空',
+            'pickup_code.required' => '自提点编码不能为空',
+            'work_time.required' => '自提时间不能为空',
+        ];
+        $validator = Validator::make($data, $rules, $massage);
+
+        if ($validator->fails()) {
+
+            return $this->response->array(ApiHelper::error('请求参数格式不正确!', 412));
+        }
+
+        $pickup_node = ConfigPickupNode::create($data);
+        if(!$pickup_node) {
+
+            return $this->response->array(ApiHelper::error('新建自提点失败!', 500));
+        }
+
+        return $this->response->array(ApiHelper::success());
+
+    }
+
+    /**
+     * @api {get} /pickupNode/edit 编辑自提点
+     * @apiVersion 0.1
+     * @apiName ConfigPickupNode edit
+     * @apiGroup ConfigPickupNode
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+    {
+    "data": [],
+    "extra": {
+    "filters": [
+    "筛选字段1",
+    "筛选字段2"
+    ],
+    "columns": [
+    "id",
+    "name"
+    ]
+    },
+    "meta": {
+    "pagination": {
+    "total": 2,
+    "count": 2,
+    "per_page": 15,
+    "current_page": 1,
+    "total_pages": 1,
+    "links": []
+    }
+    }
+     */
+
+    public function edit(Request $request)
+    {
+        $id = $request->input('id');
+        $pickup_node = ConfigPickupNode::where('id',$id)->first();
+
+        if (!$pickup_node) {
+
+            return $this->response->array(ApiHelper::error('该自提点不存在!', 402));
+        }
+
+        $data = $request->all();
+        $data['id'] = $request->input('id');
+
+        $rules = [
+            'name' => 'required|max:20',
+            '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}$/'],
+            'address' => 'required|max:200',
+            'pickup_group_id' => 'required',
+            'city_id' => 'required',
+            'city_name' => 'required',
+            'longitude' => 'required',
+            'latitude' => 'required',
+            'pickup_code' => 'required',
+            'work_time' => 'required',
+        ];
+        $validator = Validator::make($data, $rules);
+        if ($validator->fails()) {
+
+            return $this->response->array(ApiHelper::error('请求参数格式不正确!', 412));
+        }
+        $pickup_node_update = $pickup_node->update($data);
+        if (!$pickup_node_update){
+
+            return $this->response->array(ApiHelper::error('修改失败,请重试!', 412));
+        }
+
+        return $this->response->array(ApiHelper::success());
+
+    }
+
+    /**
+     * @api {get} /pickupNode/view 查看自提点
+     * @apiVersion 0.1
+     * @apiName ConfigPickupNode view
+     * @apiGroup ConfigPickupNode
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+
+    {
+    "data": {
+    "id": 2,
+    "city_id": 1,
+    "city_name": "dd",
+    "name": "ff",
+    "address": "dd",
+    "work_time": "2019-04-24 11:35:00",
+    "manager_name": "4ed",
+    "manager_mobile": "555",
+    "receive_type": "信任交付",
+    "longitude": "2",
+    "latitude": "2",
+    "store_ids": "冷冻",
+    "status": "启用"
+    },
+    "meta": {
+    "message": "Success.",
+    "status_code": 200
+    }
+    }
+     */
+
+    public function view(Request $request)
+    {
+        $id = $request->input('id');
+        $pickup_node = ConfigPickupNode::where('id',$id)->first();
+        if (!$pickup_node) {
+
+            return $this->response->array(ApiHelper::error('没有找到该自提点!', 402));
+        }
+        $pickup_node->receive_type = $pickup_node->receive_type == 0 ? '信任交付':'手动确认接货';
+        $pickup_node->status = $pickup_node->status == 0 ? '启用':'禁用';
+        $pickup_node->store_ids = $pickup_node->getStoreNameAttribute();
+        $pickup_node->pickup_group_id = $pickup_node->getGroupNameAttribute();
+
+        return $this->response->item($pickup_node, new PickupNodeTransformer)->setMeta(ApiHelper::meta());
+
+    }
+
+
+}

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

@@ -0,0 +1,48 @@
+<?php
+namespace App\Http\Controllers;
+use App\Models\ConfigProvince;
+use App\Transformers\ProvinceTransformer;
+use Illuminate\Http\Request;
+
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/23
+ * Time: 下午3:56
+ */
+
+class ConfigProvinceController extends Controller
+{
+    /**
+     * @api {get} /configProvince/province 获取省市区
+     * @apiVersion 0.1
+     * @apiName configProvince province
+     * @apiGroup configProvince
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+    {
+    "data": [],
+    "extra": {
+    "filters": [
+    "筛选字段1",
+    "筛选字段2"
+    ],
+    "columns": [
+    "列表显示数据字段1",
+    "列表显示数据字段2"
+    ]
+    },
+    "meta": {
+    "pagination": {}
+    }
+    }
+     */
+
+    public function province(Request $request)
+    {
+        $province = ConfigProvince::orderBy('id', 'desc')
+            ->paginate();
+        return $this->response->paginator($province, new ProvinceTransformer());
+
+    }
+}

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

@@ -0,0 +1,53 @@
+<?php
+namespace App\Http\Controllers;
+use App\Models\ConfigStoreType;
+use App\Transformers\ConfigStoreTypeTransformer;
+
+/**
+ * Created by PhpStorm.
+ * User: qinyaer
+ * Date: 2019/4/23
+ * Time: 下午3:56
+ */
+
+class StoreTypeController extends BaseController
+{
+    /**
+     * @api {get} /storeType/index 储存方式列表
+     * @apiVersion 0.1
+     * @apiName StoreType index
+     * @apiGroup StoreType
+     * @apiPermission none
+     * @apiSuccessExample 成功响应:
+
+    {
+    "data": [],
+    "extra": {
+    "filters": [
+    "筛选字段1",
+    "筛选字段2"
+    ],
+    "columns": [
+    "id",
+    "name"
+    ]
+    },
+    "meta": {
+    "pagination": {
+    "total": 2,
+    "count": 2,
+    "per_page": 15,
+    "current_page": 1,
+    "total_pages": 1,
+    "links": []
+    }
+    }
+     */
+    public function index()
+    {
+        $ConfigStoreType = ConfigStoreType::orderBy('id', 'desc')
+            ->paginate();
+
+        return $this->response->paginator($ConfigStoreType, new ConfigStoreTypeTransformer());
+    }
+}

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

+ 39 - 0
app/Models/ConfigCityManagement.php

@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Models;
+
+
+class ConfigCityManagement extends BaseModel
+{
+    protected  $table = 'config_city_management';
+
+    /**
+     * 可被批量赋值的字段
+     * @var array
+     */
+    protected $fillable = ['province_id','city_id','province_name','city_name','express_type'];
+
+
+    /**
+     *
+     * 快递方式:0.快递;1. 自提
+     *
+     * @return string
+     */
+    public function getExpressTypeAttribute()
+    {
+        $express_type = '';
+        switch ($this->express_type) {
+            case 0:
+                $express_type = '快递';
+                break;
+            case 1:
+                $express_type = '自提';
+                break;
+            default:
+        }
+
+        return $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','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');
+    }
+
+}

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

+ 31 - 0
app/Transformers/PickupNodeTransformer.php

@@ -0,0 +1,31 @@
+<?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'],
+            'status' => $ConfigPickupNode['status'],
+        ];
+
+    }
+}

+ 21 - 0
app/Transformers/ProvinceTransformer.php

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

+ 1 - 1
bin/fswatch

@@ -9,7 +9,7 @@ echo "Restarting LaravelS..."
 
 echo "Starting fswatch..."
 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
     if [[ ! ${file} =~ .php$ ]] ;then
         continue

文件差异内容过多而无法显示
+ 5679 - 0
composer.lock


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

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

@@ -0,0 +1,37 @@
+<?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.自提
+            $table->tinyInteger('status')->default(0);        //状态: 0.启用 1.停用
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * 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(0);  // 接货方式:0.信任交付;1.手动确认接货
+            $table->tinyInteger('status')->default(0);        //状态: 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');
+    }
+}