44 lines
		
	
	
		
			903 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			903 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace app\model;
 | |
| 
 | |
| use think\Model;
 | |
| 
 | |
| 
 | |
| class AssetRelation extends Model
 | |
| {
 | |
|     // 设置表名
 | |
|     protected $table = 'bps.bps_google_ads_asset_relations';
 | |
| 
 | |
|     // 设置主键
 | |
|     protected $pk = 'asset_relation_id';
 | |
| 
 | |
|     // 设置时间戳字段
 | |
|     protected $createTime = 'create_at';
 | |
|     protected $updateTime = 'update_at';
 | |
| 
 | |
|     // 关联到广告
 | |
|     public function ad()
 | |
|     {
 | |
|         return $this->belongsTo(Ad::class, 'ad_id', 'ad_id');
 | |
|     }
 | |
| 
 | |
|     // 关联到广告组
 | |
|     public function adGroup()
 | |
|     {
 | |
|         return $this->belongsTo(AdGroup::class, 'ad_group_id', 'ad_group_id');
 | |
|     }
 | |
| 
 | |
|     // 关联到广告活动
 | |
|     public function campaign()
 | |
|     {
 | |
|         return $this->belongsTo(Campaign::class, 'campaign_id', 'campaign_id');
 | |
|     }
 | |
| 
 | |
|     // 素材关联关系
 | |
|     public function asset()
 | |
|     {
 | |
|         return $this->belongsTo(Asset::class, 'asset_id', 'asset_id');
 | |
|     }
 | |
| }
 |