<?php
|
|
namespace app\supplier\model\supplier;
|
|
use app\common\model\supplier\Capital as SupplierCapitalModel;
|
/**
|
* 后台管理员登录模型
|
*/
|
class Capital extends SupplierCapitalModel
|
{
|
/**
|
* 获取列表数据
|
*/
|
public function getList($shop_supplier_id, $params)
|
{
|
$model = $this;
|
if(isset($params['flow_type']) && $params['flow_type'] != 0){
|
$model = $model->where('flow_type', '=', $params['flow_type']);
|
}
|
if(isset($params['start_day']) && !empty($params['start_day'])){
|
$model = $model->where('create_time', '>=', strtotime($params['start_day']));
|
}
|
if(isset($params['end_day']) && !empty($params['end_day'])){
|
$end_day = strtotime($params['end_day']) + 86400;
|
$model = $model->where('create_time', '<', $end_day);
|
}
|
// 查询列表数据
|
return $model->where('shop_supplier_id', '=', $shop_supplier_id)
|
->order(['create_time' => 'desc'])
|
->paginate($params);
|
}
|
|
/**
|
* 获取提现的数据
|
*/
|
public function getCapitalMoney($shop_supplier_id, $params)
|
{
|
$model = $this;
|
$end_day = strtotime($params['end_day']) + 86400;
|
// 查询列表数据
|
return $model->where('shop_supplier_id', '=', $shop_supplier_id)
|
->where('create_time', '>=', strtotime($params['start_day']))
|
->where('create_time', '<', $end_day)
|
->where('flow_type', '=', 10)
|
->where('is_settled', '=', 0)
|
->sum("money");
|
}
|
|
/**
|
* 修改状态
|
*/
|
public static function editStatus($shop_supplier_id, $start_day,$end_day,$is_settled=1)
|
{
|
$model = new static();
|
$end_day = $end_day + 86400;
|
// 查询列表数据
|
return $model->where('shop_supplier_id', '=', $shop_supplier_id)
|
->where('create_time', '>=', $start_day)
|
->where('create_time', '<', $end_day)
|
->where('flow_type', '=', 10)
|
->where('is_settled', '=', 0)
|
->update(["is_settled"=>$is_settled]);
|
}
|
}
|