61 lines
1.2 KiB
PHP
61 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace app\common\model;
|
|
|
|
use cores\BaseModel;
|
|
/**
|
|
* 物流公司模型
|
|
* Class Express
|
|
* @package app\common\model
|
|
*/
|
|
class Deduct extends BaseModel
|
|
{
|
|
protected $name = 'deduct';
|
|
|
|
/**
|
|
* 获取全部
|
|
* @return mixed
|
|
*/
|
|
public static function getAll()
|
|
{
|
|
$model = new static;
|
|
return $model->order(['create_time' => 'asc'])->select();
|
|
}
|
|
|
|
/**
|
|
* 获取列表
|
|
* @return \think\Paginator
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function getList()
|
|
{
|
|
return $this->order(['create_time' => 'asc'])
|
|
->paginate(15, false, [
|
|
'query' => Request::instance()->request()
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 扣减记录详情
|
|
* @param $deduct_id
|
|
* @return null|static
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public static function detail($deduct_id)
|
|
{
|
|
return self::get($deduct_id);
|
|
}
|
|
|
|
/**
|
|
* 获取抵扣总金额
|
|
* @param array $filter
|
|
* @return int|string
|
|
*/
|
|
public function getDeductTotalMoneyCustom($filter = [])
|
|
{
|
|
return $this->where($filter)
|
|
->sum('money');
|
|
}
|
|
}
|