You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
<?php
|
|
|
|
namespace app\mall\model;
|
|
|
|
use think\model\concern\SoftDelete;
|
|
|
|
class MallSpikeProductTime extends Base
|
|
{
|
|
use SoftDelete;
|
|
|
|
/**
|
|
* 获取商品列表
|
|
* @date 2021-03-01
|
|
*/
|
|
public function getProductList($where, $page, $field = '*', $order = '', $per_page_number = 10)
|
|
{
|
|
$primary_key_name = $this->getPk();
|
|
|
|
if (empty($order)) {
|
|
$order = (empty($data[$primary_key_name]) ? 'id' : $data[$primary_key_name]) . ' desc';
|
|
}
|
|
|
|
$dataList = $this->with(['mallProduct'])->field($field)->where($where)->order($order)
|
|
->paginate(['list_rows' => $per_page_number, 'page' => $page], false);
|
|
|
|
return $dataList;
|
|
}
|
|
|
|
/**
|
|
* 一对多关联SKU
|
|
* @date 2021-05-01
|
|
*/
|
|
public function mallSpikeProductSku()
|
|
{
|
|
return $this->hasMany('MallSpikeProductSku', 'product_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* 一对一关联产品
|
|
* @date 2021-05-01
|
|
*/
|
|
public function mallProduct()
|
|
{
|
|
return $this->hasOne('MallProduct', 'id', 'product_id');
|
|
}
|
|
} |