| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mojo::Weixin::User; |
|
2
|
1
|
|
|
1
|
|
7
|
use Mojo::Weixin::Base 'Mojo::Weixin::Model::Base'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
|
|
has [qw( |
|
4
|
|
|
|
|
|
|
name |
|
5
|
|
|
|
|
|
|
account |
|
6
|
|
|
|
|
|
|
province |
|
7
|
|
|
|
|
|
|
city |
|
8
|
|
|
|
|
|
|
sex |
|
9
|
|
|
|
|
|
|
id |
|
10
|
|
|
|
|
|
|
uid |
|
11
|
|
|
|
|
|
|
signature |
|
12
|
|
|
|
|
|
|
display |
|
13
|
|
|
|
|
|
|
markname |
|
14
|
|
|
|
|
|
|
_avatar |
|
15
|
|
|
|
|
|
|
)]; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
|
18
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
19
|
0
|
|
|
|
|
|
$self = $self->Mojo::Weixin::Base::new(@_); |
|
20
|
0
|
|
|
|
|
|
$self->client->emoji_convert(\$self->{name},$self->client->emoji_to_text); |
|
21
|
0
|
|
|
|
|
|
$self->client->emoji_convert(\$self->{display},$self->client->emoji_to_text); |
|
22
|
0
|
|
|
|
|
|
$self->client->emoji_convert(\$self->{markname},$self->client->emoji_to_text); |
|
23
|
0
|
0
|
|
|
|
|
$self->uid("") if not $self->uid; |
|
24
|
0
|
|
|
|
|
|
$self; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
sub get_avatar{ |
|
27
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
28
|
0
|
|
|
|
|
|
$self->client->get_avatar($self,@_); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub displayname { |
|
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
33
|
0
|
|
0
|
|
|
|
return $self->display || $self->markname || $self->name; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub update{ |
|
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
38
|
0
|
|
|
|
|
|
my $hash = shift; |
|
39
|
0
|
|
|
|
|
|
for(grep {substr($_,0,1) ne "_"} keys %$self){ |
|
|
0
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
if(exists $hash->{$_}){ |
|
41
|
0
|
0
|
|
|
|
|
$self->client->emoji_convert(\$hash->{$_},$self->client->emoji_to_text) if $_ eq "name"; |
|
42
|
0
|
0
|
|
|
|
|
$self->client->emoji_convert(\$hash->{$_},$self->client->emoji_to_text) if $_ eq "display"; |
|
43
|
0
|
0
|
|
|
|
|
$self->client->emoji_convert(\$hash->{$_},$self->client->emoji_to_text) if $_ eq "markname"; |
|
44
|
0
|
0
|
0
|
|
|
|
if(defined $hash->{$_} and defined $self->{$_}){ |
|
|
|
0
|
0
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
if($hash->{$_} ne $self->{$_}){ |
|
46
|
0
|
|
|
|
|
|
my $old_property = $self->{$_}; |
|
47
|
0
|
|
|
|
|
|
my $new_property = $hash->{$_}; |
|
48
|
0
|
|
|
|
|
|
$self->{$_} = $hash->{$_}; |
|
49
|
0
|
0
|
|
|
|
|
$self->client->emit("user_property_change"=>$self,$_,$old_property,$new_property) if defined $self->client; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
elsif( ! (!defined $hash->{$_} and !defined $self->{$_}) ){ |
|
53
|
0
|
|
|
|
|
|
my $old_property = $self->{$_}; |
|
54
|
0
|
|
|
|
|
|
my $new_property = $hash->{$_}; |
|
55
|
0
|
|
|
|
|
|
$self->{$_} = $hash->{$_}; |
|
56
|
0
|
0
|
|
|
|
|
$self->client->emit("user_property_change"=>$self,$_,$old_property,$new_property) if defined $self->client; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
0
|
|
|
|
|
|
$self; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
1; |