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; }打印结果:
原文地址:https://www.cnblogs.com/sgm4231/p/10059753.html
时间: 2024-10-14 08:46:12