where('groupbuy_bill_user_id', '=', $groupbuy_bill_user_id)->find(); } /** * 根据团购订单ID获取参与用户 */ public static function getUsersByBillId($groupbuy_bill_id) { return (new static()) ->where('groupbuy_bill_id', '=', $groupbuy_bill_id) ->with(['user']) ->select(); } /** * 关联用户表 */ public function user() { return $this->belongsTo('app\\common\\model\\user\\User', 'user_id', 'user_id') ->bind('nickName,avatarUrl'); } /** * 检查用户是否已参与某个团购 */ public static function checkUserJoined($user_id, $groupbuy_bill_id) { return (new static()) ->where('user_id', '=', $user_id) ->where('groupbuy_bill_id', '=', $groupbuy_bill_id) ->find(); } }