51 lines
1.1 KiB
PHP
Executable File
51 lines
1.1 KiB
PHP
Executable File
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 宏驰云科技开发团队 版权所有 拥有最终解释权
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: HcyShop-竹
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
namespace app\common\model;
|
|
|
|
|
|
use think\Model;
|
|
|
|
/**
|
|
* 砍价活动模型
|
|
* Class Bargain
|
|
* @Author kiki
|
|
* @package app\common\model
|
|
*/
|
|
class Bargain extends Model
|
|
{
|
|
/**
|
|
* Notes: 关联商品模型
|
|
* @author kiki
|
|
*/
|
|
public function goods()
|
|
{
|
|
return $this->hasOne('Goods', 'id', 'goods_id')
|
|
->field(['id', 'name', 'image', 'max_price', 'min_price']);
|
|
}
|
|
|
|
/**
|
|
* Notes: 关联砍价参与人数
|
|
* @author kiki
|
|
*/
|
|
public function launchPeopleNumber()
|
|
{
|
|
return $this->hasMany('BargainLaunch', 'bargain_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* Notes: 关联砍价成功人数
|
|
* @author kiki
|
|
*/
|
|
public function successKnifePeopleNumber()
|
|
{
|
|
return $this->hasMany('BargainLaunch', 'bargain_id', 'id')
|
|
->where(['status'=>1]);
|
|
}
|
|
} |