Skip to content
关注公众号,获取新课通知

运费模板列表


控制器 app/controller/admin/Express.php

php
public function index()
   {
       $param = request()->param();
       $limit = intval(getValByKey('limit',$param,10));
       $page = intval(getValByKey('page',$param,1));
       $totalCount = $this->M->count();
       $list = $this->M->page($page,$limit)
       		->with(['expressValues'])
       		->order([
				'order'=>'desc',
   				'id'=>'desc'
			])
			->select();
	
	$area = \app\model\SysProvince::with(['citys.districts'])->select();
	
       return showSuccess([
       	'list'=>$list,
       	'totalCount'=>$totalCount,
       	'area'=>$area
       ]);
   }

模型 app/model/Express.php

php
public function expressValues(){
       return $this->hasMany('ExpressValue');
   }

模型 app/model/SysProvince.php

php
public function citys(){
       return $this->hasMany('SysCity');
   }

模型 app/model/SysCity.php

php
public function districts(){
       return $this->hasMany('SysDistrict');
   }

验证器 app/validate/admin/Express.php

php
protected $rule = [
    'page' => 'require|integer|>:0',
];
protected $scene = [
    ...
    'index'=>['page'],
    ...
];

路由 router/admin.php

php
Route::get('express/:page','admin.Express/index');