Commit e65fe2f9 by 朱继来

Merge branch 'zjl_new_order_20210926' into development

parents 9f603b53 f33397ac
Showing with 28 additions and 27 deletions
<?php <?php
namespace App\Model; namespace App\Model;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class RegionModel extends Model class RegionModel extends Model
{ {
protected $connection = 'order'; protected $connection = 'web';
protected $table = 'lie_region'; protected $table = 'lie_region';
protected $primaryKey = 'region_id'; protected $primaryKey = 'region_id';
public $timestamps = false; public $timestamps = false;
// 获取指定类型地址 // 获取指定类型地址
public function getRegion($region_type=1) public function getRegion($region_type=1)
{ {
$map['region_type'] = $region_type; $map['region_type'] = $region_type;
return $this->where($map)->select('region_id', 'parent_id', 'region_name')->get()->toArray(); return $this->where($map)->select('region_id', 'parent_id', 'region_name')->get()->toArray();
} }
// 获取地址名称 // 获取地址名称
public function getRegionName($region_id) public function getRegionName($region_id)
{ {
if (!$region_id) return null; if (!$region_id) return null;
return $this->where('region_id', $region_id)->value('region_name'); return $this->where('region_id', $region_id)->value('region_name');
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment