This repository has been archived on 2024-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
yoshop/source/application/common/model/sharing/ActiveUsers.php
2020-04-25 22:20:29 +08:00

47 lines
924 B
PHP

<?php
namespace app\common\model\sharing;
use app\common\model\BaseModel;
/**
* 拼团拼单成员模型
* Class ActiveUsers
* @package app\common\model\sharing
*/
class ActiveUsers extends BaseModel
{
protected $name = 'sharing_active_users';
protected $updateTime = false;
/**
* 关联用户表
* @return \think\model\relation\BelongsTo
*/
public function user()
{
$module = self::getCalledModule() ?: 'common';
return $this->belongsTo("app\\{$module}\\model\\User");
}
/**
* 关联拼团订单表
* @return \think\model\relation\BelongsTo
*/
public function sharingOrder()
{
return $this->belongsTo('Order', 'order_id');
}
/**
* 新增拼团拼单成员记录
* @param $data
* @return false|int
*/
public static function add($data)
{
return (new static)->save($data);
}
}