~bluet/+junk/lijibo-wallpaper

« back to all changes in this revision

Viewing changes to lib/Conifer/Ads.pm

  • Committer: BlueT - Matthew Lien - 練喆明
  • Date: 2011-10-03 22:20:48 UTC
  • mfrom: (29.1.14 lijibo-mojox-redis)
  • Revision ID: bluet@bluet.org-20111003222048-ar7ur1iobz1c8wdi
switch to MojoX::Redis

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
use Conifer;
5
5
use Mojo::Base 'Mojolicious::Controller';
6
6
use Time::HiRes 'time', 'gettimeofday';
7
 
#~ use Data::Dumper;
 
7
use Data::Dumper::Simple;
8
8
#~ use Digest::SHA1 qw(sha1_hex sha1_base64);
9
9
#~ use Digest::MD5 qw(md5 md5_hex md5_base64);
10
10
use MIME::Base64;
27
27
        #~ ( $ads{'title'}, $ads{'content'} ) = ($self->req->param('title'), $self->req->param('content'));
28
28
        $ads{'title'} = $c->req->param('title');
29
29
        $ads{'content'} = $c->req->param('content');
 
30
        $ads{'author'} = $user;
30
31
        
31
32
        
32
33
        my $date_string = $c->time_and_rand;
69
70
        my $c = shift;
70
71
        #~ my $hash = $self->param('hash');
71
72
        
72
 
        my @post_ids = Conifer->redis->zrange("ads:list", 0, -1);
73
 
        #~ say $c->app->dumper(\@post_ids);
 
73
        #~ my @post_ids = Conifer->redis->zrange("ads:list", 0, -1);
 
74
        my $post_ids = $c->get_list("ads:list", 0, -1);
 
75
        say "Ads: list:\n\tpost_ids: ". Dumper($post_ids);
74
76
        
75
77
        my @all_posts;
76
 
        for (@post_ids) {
 
78
        for (@$post_ids) {
77
79
                #~ my %post;
78
 
                my $hash = encode_base64($_);
 
80
                my $hash = encode_base64($_->[0]);
79
81
                chomp $hash;
80
82
                $hash =~ s/=//g;
81
83