Merge branch 'dev' of https://gitea.lihaink.cn/mkm/shop-new into dev
This commit is contained in:
commit
2950b863a9
@ -2446,24 +2446,31 @@ class StoreOrderRepository extends BaseRepository
|
||||
$data = StoreOrder::getDB()->alias('o')
|
||||
->leftJoin('Merchant m', 'o.mer_id = m.mer_id');
|
||||
if (isset($where['section_startTime']) && $where['section_startTime'] && isset($where['section_endTime']) && $where['section_endTime']) {
|
||||
// $data->where('o.create_time', '>', $where['section_startTime'])->where('o.create_time', '<', $where['section_endTime']);
|
||||
$data->whereTime('o.create_time', 'between', [$where['section_startTime'], $where['section_endTime']]);
|
||||
}
|
||||
$data->where(function ($query) use ($where,$uid,$merId) {
|
||||
$query->where('o.mer_id', $merId)->whereOr('o.uid', $uid);
|
||||
})->where('o.source', 999);//只要扫码
|
||||
$data->field('o.order_id,o.uid,o.mer_id,o.pay_price,m.mer_name');
|
||||
$data->field('o.order_id,o.uid,o.mer_id,o.pay_price,m.mer_name,o.create_time');
|
||||
$list = $data->order('o.create_time DESC')->page($page, $limit)->select();
|
||||
$income = 0;
|
||||
$outcome = 0;
|
||||
|
||||
foreach ($list as &$value){
|
||||
if($value['mer_id'] == $merId){
|
||||
$value['nickname'] = User::getDB()->where(['uid'=>$value['uid']])->value('nickname');
|
||||
$value['msg'] = "收入";
|
||||
$income +=$value['pay_price'];
|
||||
$value['come_msg'] = "来自".$value['nickname'];
|
||||
}else{
|
||||
$value['msg'] = "支出";
|
||||
$outcome +=$value['pay_price'];
|
||||
$value['come_msg'] = "给".$value['mer_name'];
|
||||
}
|
||||
}
|
||||
$income = sprintf("%.2f", $income);
|
||||
$outcome = sprintf("%.2f", $outcome);
|
||||
|
||||
return compact('income','outcome','list');
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ class StoreOrder extends BaseController
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where['section_startTime'] = $this->request->param('section_startTime');
|
||||
$where['section_endTime'] = $this->request->param('section_endTime');
|
||||
if(empty($where['section_startTime']) && empty($where['section_endTime'])){
|
||||
$where['section_startTime'] = date('Y-m-d',time()).' 00:00:00';
|
||||
$where['section_endTime'] = date('Y-m-d',time()).' 23:59:59';
|
||||
if(!empty($where['section_endTime'])&& $where['section_endTime']){
|
||||
$timestamp = strtotime($where['section_endTime'] . ' +1 day');
|
||||
$where['section_endTime'] = date('Y-m-d', $timestamp);
|
||||
}
|
||||
|
||||
return app('json')->success($repository->revenueExpenditure($where, $page, $limit,$merId));
|
||||
|
Loading…
x
Reference in New Issue
Block a user