erp/app/api/controller/financial/FinancialRecordController.php
2024-05-28 18:36:51 +08:00

81 lines
2.4 KiB
PHP

<?php
namespace app\api\controller\financial;
use app\api\controller\BaseApiController;
use app\api\lists\financial\FinancialRecordLists;
/**
* 商品分类控制器
* Class GoodsclassController
* @package app\admin\controller\goods
*/
class FinancialRecordController extends BaseApiController
{
/**
* @notes 获取商户流水统计
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function lists()
{
$start_time = $this->request->get('start_time');
// $end_time = $this->request->get('end_time');
if(!isset($start_time)){
$start_time=date('Y-m-d',time());
$end_time=date('Y-m-d',strtotime('-7 days'));
}else{
//start_time设置时间减7天
$end_time=date('Y-m-d',strtotime('-7 days',strtotime($start_time)));
}
$start_time = strtotime($start_time); // 开始时间
$end_time = strtotime($end_time); // 结束时间
// 计算时间差
$time_diff = $end_time - $start_time;
// 7天内的秒数
$seven_days_in_seconds = 7 * 24 * 60 * 60;
// 验证时间差是否在7天内
if ($time_diff > $seven_days_in_seconds) {
return $this->fail('时间差不能超过7天');
}
return $this->dataLists((new FinancialRecordLists));
}
/**
* @notes 获取商户流水统计
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 10:27
*/
public function api_lists()
{
$mer_id=$this->request->userInfo['merchant']['mer_id']??0;
if($mer_id!=0){
// $this->request->__set('is_detail',1);
// $this->request->__set('class_value',['mer_id'=>$mer_id,'type'=>1]);
// $this->request->__set('class_key',['='=>['mer_id','type']]);
return $this->dataLists((new FinancialRecordLists));
}
return $this->success();
}
/**
* 余额明细
*/
public function supplier_list(){
$id=$this->request->userInfo['supplier']['id']??0;
if($id!=0){
// $this->request->__set('is_detail',1);
// $this->request->__set('class_value',['mer_id'=>$id,'type'=>3]);
// $this->request->__set('class_key',['='=>['mer_id','type']]);
return $this->dataLists((new FinancialRecordLists));
}
return $this->success();
}
}