static function get_count($where = '') { if (strlen($where)) { $where = " where 1 and {$where}"; } $sql = "select count(*) from " . WxConnect::table() . $where; $count = Db::get_num($sql); return $count; }
static function get_no_bind_users($wx_id) { $self_table = self::$table_name; $wx_connect_table = WxConnect::table(); $sql = "select {$self_table}.wx_openid from {$self_table}"; $sql .= " left join {$wx_connect_table}"; $sql .= " on {$self_table}.wx_openid = {$wx_connect_table}.wx_openid"; $sql .= " where {$self_table}.wx_id = '{$wx_id}'"; $sql .= " and {$self_table}.status = " . self::STATUS_YES; $sql .= " and {$wx_connect_table}.wx_openid is null"; return Db::find($sql); }