70 lines
1.6 KiB
PHP
70 lines
1.6 KiB
PHP
<?php
|
|
namespace app\common\model\marketing;
|
|
|
|
use app\common\model\BaseModel;
|
|
use app\common\model\store\CityArea;
|
|
use app\common\model\store\order\StoreOrder;
|
|
use app\common\model\system\merchant\MerchantCategory;
|
|
use app\common\model\system\merchant\MerchantType;
|
|
use app\common\model\user\User;
|
|
|
|
|
|
class AgentApply extends BaseModel{
|
|
|
|
|
|
public static function tablePk(): string{
|
|
return 'id';
|
|
}
|
|
|
|
public static function tableName(): string{
|
|
return 'agent_apply';
|
|
}
|
|
|
|
|
|
public function setMerImagesAttr($value){
|
|
return implode(',',$value);
|
|
}
|
|
public function getMerImagesAttr($value){
|
|
if(!empty($value)) return explode(',',$value);
|
|
|
|
return [];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function user(){
|
|
return $this->hasOne(User::class, 'uid', 'uid');
|
|
}
|
|
public function parent(){
|
|
return $this->hasOne(Agent::class, 'id', 'pid');
|
|
}
|
|
public function province(){
|
|
return $this->hasOne(CityArea::class, 'id', 'province_id');
|
|
}
|
|
public function city(){
|
|
return $this->hasOne(CityArea::class, 'id', 'city_id');
|
|
}
|
|
public function area(){
|
|
return $this->hasOne(CityArea::class, 'id', 'area_id');
|
|
}
|
|
public function street(){
|
|
return $this->hasOne(CityArea::class, 'id', 'street_id');
|
|
}
|
|
|
|
public function merClass(){
|
|
return $this->hasOne(MerchantCategory::class, 'merchant_category_id', 'mer_class_id');
|
|
}
|
|
public function merType(){
|
|
return $this->hasOne(MerchantType::class, 'mer_type_id', 'mer_type_id');
|
|
}
|
|
public function orderInfo(){
|
|
return $this->hasOne(StoreOrder::class, 'order_id', 'order_id');
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|