alias('user') ->join('groupbuy_bill bill', 'bill.groupbuy_bill_id = user.groupbuy_bill_id', 'left') ->where('user.user_id', '=', $user_id) ->where('bill.groupbuy_product_id', '=', $groupbuy_product_id) ->where('bill.groupbuy_active_id', '=', $groupbuy_active_id) ->where('bill.status', 'in', [10, 20]) ->count(); } /** * 检查用户是否已参与团购 */ public static function checkUserJoined($user_id, $groupbuy_bill_id) { return self::where('user_id', '=', $user_id) ->where('groupbuy_bill_id', '=', $groupbuy_bill_id) ->find(); } }