From 17789bf706d3011f87297214cae697a897819ca3 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Wed, 13 Sep 2023 18:50:31 +0800 Subject: [PATCH] =?UTF-8?q?update:=E5=95=86=E6=88=B7=E5=90=88=E5=90=8C?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/ShopMerchant.php | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/app/common/model/ShopMerchant.php b/app/common/model/ShopMerchant.php index c588a0cca..e1e971cac 100644 --- a/app/common/model/ShopMerchant.php +++ b/app/common/model/ShopMerchant.php @@ -2,7 +2,60 @@ namespace app\common\model; +use app\common\model\contract\Contract; +use app\common\model\dict\DictData; +use think\facade\Db; + class ShopMerchant extends BaseModel { protected $name = 'shop_merchant'; + + public function getCompanyTypeNameAttr($value) + { + return DictData::where('id', $value)->value('name'); + } + + public function getProvinceNameAttr($value) + { + return Db::name('geo_province')->where(['province_code' => $this->province])->value('province_name'); + } + + public function getCityNameAttr($value) + { + return Db::name('geo_city')->where(['city_code' => $this->city])->value('city_name'); + } + + public function getAreaNameAttr($value) + { + return Db::name('geo_area')->where(['area_code' => $this->area])->value('area_name'); + } + + public function getStreetNameAttr($value) + { + return Db::name('geo_street')->where(['street_code' => $this->street])->value('street_name'); + } + + public function getVillageNameAttr($value) + { + return Db::name('geo_village')->where(['village_code' => $this->village])->value('village_name'); + } + + public function getBrigadeNameAttr($value) + { + return Db::name('geo_brigade')->where(['id' => $this->brigade])->value('brigade_name'); + } + public function getAreaManagerNameAttr($value) + { + return Db::name('admin')->where(['id' => $this->area_manager])->value('name'); + } + + public function getContractAttr() + { + $find=Contract::where('party_a|party_b', $this->id)->field('check_status,status')->find(); + if($find){ + return $find->toArray(); + }else{ + return []; + } + } } \ No newline at end of file