id)->where('type','<>','5')->orderByDesc('created_at')->paginate(15); $all_money=IncomExpenses::where('user_id',$user->id)->where('type','<>','5')->sum('totalprice'); $total=$income->toArray(); $data=[]; if ($income){ foreach ($income as $k=>$v){ $data[$k]['type']=$v->type; $data[$k]['created_at']=Carbon::parse($v->created_at)->toDateTimeString(); $data[$k]['money']=$v->totalprice; } } // $data['all_money']=$all_money; // $re['list']=$data; return $this->success_list($data,'',$total['total'],$all_money,'all_money'); } /** *奖励支出和收入 */ public function detail(Request $request){ $start=$request->time; $end=$start+86400; if ($request->type==1){ $money=IncomExpenses::where('user_id_send',Auth::user()->id)->where('type',2)->whereBetween('created_at',[date('Y-m-d H:i:s',$start),date('Y-m-d H:i:s',$end)])->sum('totalprice'); $all_money=IncomExpenses::where('user_id_send',Auth::user()->id)->where('type',2)->sum('totalprice'); }else{ $money=IncomExpenses::where('user_id',Auth::user()->id)->whereIn('type',[2.3,4])->whereBetween('created_at',[date('Y-m-d H:i:s',$start),date('Y-m-d H:i:s',$end)])->sum('totalprice'); $all_money=IncomExpenses::where('user_id',Auth::user()->id)->whereIn('type',[2.3,4])->sum('totalprice'); } $data=['money'=>$money,'all_money'=>$all_money]; return $this->success($data); } }