HaniBlindBox/server/php/app/common/model/Collect.php
2026-01-01 20:46:07 +08:00

51 lines
1.2 KiB
PHP

<?php
namespace app\common\model;
use app\common\model\Base;
use think\Model;
class Collect extends Base
{
// 设置当前模型对应的完整数据表名称
protected $table = 'collect';
/**
* 获取列表
*/
public static function getList($where = [], $field = '*', $order = '', $pageSize = "15")
{
$list = self::where($where)
->field($field)
->order($order)
->paginate(['list_rows' => $pageSize, 'query' => request()->param()]);
$page = $list->render();
$data['list'] = $list->toArray()['data'];
$data['count'] = $list->total();
$data['last_page'] = $list->toArray()['last_page'];
$data['page'] = $page;
return $data;
}
/**
* 获取单条数据
*/
public static function getInfo($where = [], $field = '*')
{
$data = self::where($where)
->field($field)
->find();
return $data;
}
public function getGoodsInfoAttr($value, $data)
{
if (isset($data['goods_id'])) {
$info = Goods::field('title,imgurl,price,type')->where(['id' => $data['goods_id']])->find();
return $info;
} else {
return '';
}
}
}