78 lines
2.6 KiB
PHP
78 lines
2.6 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\common\model;
|
||
|
||
|
||
use app\common\model\BaseModel;
|
||
use app\common\model\dict\DictData;
|
||
|
||
|
||
/**
|
||
* ShopContract模型
|
||
* Class ShopContract
|
||
* @package app\common\model
|
||
*/
|
||
class ShopContract extends BaseModel
|
||
{
|
||
|
||
protected $name = 'shop_contract';
|
||
|
||
|
||
|
||
/**
|
||
* @notes 关联company_name
|
||
* @return \think\model\relation\HasOne
|
||
* @author likeadmin
|
||
* @date 2023/07/18 14:28
|
||
*/
|
||
public function companyName()
|
||
{
|
||
return $this->hasOne(ShopMerchant::class, 'id', 'company_id')->bind(['company_name']);
|
||
}
|
||
public function company()
|
||
{
|
||
return $this->hasOne(ShopMerchant::class, 'id', 'company_id');
|
||
}
|
||
public function partyAInfo()
|
||
{
|
||
return $this->hasOne(ShopMerchant::class, 'id', 'party_a')->field('id,company_name,organization_code,master_name,master_phone,master_email,area_manager');
|
||
}
|
||
public function partyBInfo()
|
||
{
|
||
// halt($this->type);
|
||
// if($this->type==1){
|
||
return $this->hasOne(ShopMerchant::class, 'id', 'party_b')->field('id,company_name,organization_code,master_name,master_phone,master_email,area_manager');
|
||
// }else{
|
||
// return $this->hasOne(User::class, 'id', 'party_b')->field('id,nickname company_name');
|
||
// }
|
||
}
|
||
public function partyA()
|
||
{
|
||
return $this->hasOne(ShopMerchant::class, 'id', 'party_a')->bind(['party_a_name' => 'company_name']);
|
||
}
|
||
public function partyB()
|
||
{
|
||
return $this->hasOne(ShopMerchant::class, 'id', 'party_b')->bind(['party_b_name' => 'company_name']);
|
||
}
|
||
public function contractType()
|
||
{
|
||
return $this->hasOne(DictData::class, 'id', 'contract_type')->bind(['contract_type_name' => 'name']);
|
||
}
|
||
|
||
public function getContractTypeNameAttr($value)
|
||
{
|
||
return DictData::where(['id' => $this->contract_type])->value('name');
|
||
}
|
||
} |