public function getCurrencyOrder($user_id=70,$pid=252,$register=['register:first'])
{
DB::connection()->enableQueryLog(); // 开启查询日志
$data=CurrencyOrder::selectRaw("sum(amount) AS total")
->where('owner_id',$user_id)
->where('target_id',$pid)
->where('type',1)
->whereIn('target_type',$register)
->value('total');
// dd(DB::table('question')); // 要查看的sql
$queries = DB::getQueryLog(); // 获取查询日志
dd($queries);
if(!$data){
$data=0;
}
return $data;
}
打印结果: