初始化项目
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user