47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
namespace app\common\model\user;
|
|
|
|
use app\common\model\BaseModel;
|
|
use app\common\model\store\service\StoreService;
|
|
use app\common\model\system\groupData\SystemGroupData;
|
|
use app\common\model\system\merchant\Merchant;
|
|
|
|
class UserVipExchangeCode extends BaseModel{
|
|
|
|
public static function tablePk(): string{
|
|
return 'id';
|
|
}
|
|
public static function tableName(): string{
|
|
return 'user_vip_exchange_code';
|
|
}
|
|
|
|
|
|
// 二维码内容
|
|
public function getQrCodeTextAttr(){
|
|
$siteUrl = systemConfig('site_url');
|
|
|
|
return trim($siteUrl,'/'). "?type=exchange&code=" . $this->exchange_code;
|
|
}
|
|
|
|
|
|
|
|
public function mer(){
|
|
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
|
|
}
|
|
public function vipInfo(){
|
|
return $this->hasOne(SystemGroupData::class, 'group_data_id', 'group_data_id');
|
|
}
|
|
public function user(){
|
|
return $this->hasOne(User::class, 'uid', 'use_user_id');
|
|
}
|
|
public function staff(){
|
|
return $this->hasOne(StoreService::class, 'service_id', 'staff_id');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|