() translation by (you can also view the original English article)



Panimula
Welcome sa bagong kabanata ng ating Twitter API series. Sa ating bagong kabanata, gumawa ako ng Twixxr.com kung saan madidiskubre mo ang mga makapangyarihang babae sa Twitter na maaari mong sundan. Ngayon, bibigyan ko ng pansin ang sarili kong mga tagasunod.
Habang hindi ako gumagamit ng Facebook simula pa noong 2013, nanatili naman akong aktibo saTwitter kahit inuulan nila ang aking feed ng ads at nagiging dahilan ng aking pagkairita dahil sa pananamantala ng gamit nito.
Kamakailan, nagsimula akong umani ng tagasunod ng medyo mabilis.Inaasahan ko na makakakita ako ng maraming sagot sa aking mga tweets.Sa totoo lang, nasorpresa ako sa kaunting sagot sa Twitter para sa pangkaraniwang tao.



Mayroon akong halos 1,900 na tagasunod,
subalit malimit na may mag-comment o retweet sa mga bagay na sa tingin ko ay
importante at interes ng pangkalahatan. Halimbawa, wala ni isa na nagbahagi ng
aking piece tungkol sa hindi nailathala na balita sa panggagahasa sa Seattle o
komentaryo kay Bill Gates tungkol sa kanyang nakakagulantang na pagkaipokrito.
Sa mahabang panahon nais kong tingnan ng maigi ang aking mga tagasunod sa Twitter at sagutin ang ilang katanungan: Sino talaga ang sumusunod sa akin? At bakit hindi sila aktibo? Posible kaya na 10% ng aking tagasunod ay hindi totoong tao?
Ang Twitter ay may isyu sa paghahanap ng bibili, at maaaring may kinalaman ito dito.
Ang Twitter API ay magandang instrumento para imbestigahan ito. Tama marami itong rate limits na mas nagpapakumplikado sa kahit na simpleng pagsusuri ng iyong tagasunod. Sa kabanata ngayon, ipapakita ko kung paano ko trinabaho ang rate limits para tantyahin at gumawa ng scoreboard ng aking mga tagasunod.
Kung mayroon kayong mga tanong o feedback,
paki-post ang mga ito sa baba sa comment o kontakin ako Twitter @reifman.
Suriin ang Iyong Tagasunod sa Twitter



Sa itaas, makikita mo ang aking pangunahing scoreboard na ginawa. Ang kabanata ngayon ay mas pagtutuunan ng pansin ang infrastructure at approach na ginawa ko. Sana magkaroon ako ng pagkakataon na mas mapaganda ang scoring mechanism.
At oo, makikita mo sa taas, mga kilalang
gay rights leader at sex advice columnist Dan Savage na sumusunod sa akin
subalit hindi nagri-retweets sa kahit na anong aking ibahagi. Kung may oras pa
ngayon, susuriin natin ito para sagutin ang importanteng tanong: totoo ba siya,
isang robot, o kaya sinusunod lamang ako para sa personal na sex advice? Ano ang matututunan natin sa account
niya kung makikisalamuha ba siya sa akin sa Twitter o, sa bagay na iyan, sa
ibang mga sumusunod sa akin?
Ang scoreboard ay kadalasan prototype na ginawa ko maliban sa Twixxr code sa huling kabanata, subalit hindi ito live demo para magamit ng tao. Ibinabahagi ko para may matutunan kayo dito at gumawa kayo ng sarili niyo.
Narito ang mga pangunahing element ng code:
- Paggawa ng database para ilagay ang aking mga tagasunod at katulad na data.
- Pag download ng tagasunod sa pahina ng 20 ng bawat tagasunod.
- Pag-track ng cursors para sa mga pahina habang nagda-download ako ng 15 pahina kada rate limited window.
- Pagtago ng data na nakuha tungkol sa aking mga tagasunod sa database.
- Paggawa ng prototype scoring algorithm para itala lahat ng tagasunod.
- Paggawa ng view para makita ang scoreboard.
Pagpunta sa Code
Paggawa ng Database Table Migrations
Gumawa ako ng tatlong magkakaibang tables para itago lahat ng data at para makatulong ito sa akin sa paggawa ng Twitter API rate limiting. Kung hindi niyo kabisado ang Yii database migrations, tingnan ang Paano Gumawa ng Program gamit ang Yii2: Paggawa ng Database at Aktibo na Talaan.
Una, pinahaba ko ang SocialProfile table para ilathala ang maraming data mula sa accounts ng mga tagasunod katulad ng kung ito ay nasuri, ang kanilang lokasyon, at ilang items na kanilang naging paborito:
1 |
<?php
|
2 |
use yii\db\Schema; |
3 |
use yii\db\Migration; |
4 |
|
5 |
class m161026_221130_extend_social_profile_table extends Migration |
6 |
{
|
7 |
public function up() |
8 |
{
|
9 |
$tableOptions = null; |
10 |
if ($this->db->driverName === 'mysql') { |
11 |
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
12 |
}
|
13 |
$this->addColumn('{{%social_profile}}','social_id',Schema::TYPE_STRING.' NOT NULL'); |
14 |
$this->addColumn('{{%social_profile}}','name','string NOT NULL'); |
15 |
$this->addColumn('{{%social_profile}}','screen_name',Schema::TYPE_STRING.' NOT NULL'); |
16 |
$this->addColumn('{{%social_profile}}','description',Schema::TYPE_TEXT.' NOT NULL'); |
17 |
$this->addColumn('{{%social_profile}}','url',Schema::TYPE_STRING.' NOT NULL'); |
18 |
$this->addColumn('{{%social_profile}}','protected',Schema::TYPE_SMALLINT. ' NOT NULL DEFAULT 0'); |
19 |
$this->addColumn('{{%social_profile}}','favourites_count',Schema::TYPE_BIGINT. ' NOT NULL DEFAULT 0'); |
20 |
$this->addColumn('{{%social_profile}}','verified',Schema::TYPE_SMALLINT. ' NOT NULL DEFAULT 0'); |
21 |
$this->addColumn('{{%social_profile}}','location',Schema::TYPE_STRING.' NOT NULL'); |
22 |
$this->addColumn('{{%social_profile}}','profile_location',Schema::TYPE_STRING.' NOT NULL'); |
23 |
$this->addColumn('{{%social_profile}}','score',Schema::TYPE_BIGINT. ' NOT NULL DEFAULT 0'); |
24 |
}
|
Sumunod, gumawa ako ng indexing table na
tinawag na SocialFriend
para makita ang mga tagasunod para sa natatanging
accounts. Kung mapagdesisyunan ko na gawin itong serbisyo ng pormal sa publiko,
kakailanganin koi to. Nili-link nito ang User table sa tagasunod ng gumagamit
sa SocialProfile table.
1 |
<?php
|
2 |
use yii\db\Schema; |
3 |
use yii\db\Migration; |
4 |
class m161026_233916_create_social_friend_table extends Migration |
5 |
{
|
6 |
public function up() |
7 |
{
|
8 |
$tableOptions = null; |
9 |
if ($this->db->driverName === 'mysql') { |
10 |
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
11 |
}
|
12 |
|
13 |
$this->createTable('{{%social_friend}}', [ |
14 |
'id' => Schema::TYPE_PK, |
15 |
'user_id' => Schema::TYPE_BIGINT.' NOT NULL', |
16 |
'social_profile_id' => Schema::TYPE_BIGINT.' NOT NULL', |
17 |
], $tableOptions); |
18 |
}
|
Sunod, ng Twitter API kailangan na titingnan mo ang requests ng 20 na tagasunod ng paisa isa.Para malaman ang susunod na pahina, kailangan mong hanapin ang cursors, essentially tags, na magmamarka ng susunod na pahina na gagawin.
Dahil hanggang 15 requests lang para sa
tagasunod bawat 15 minuto ang ina-allow, kailangan mong itago ang cursors sa
database. Ang table ay tinatawag na SocialCursor
:
1 |
<?php
|
2 |
use yii\db\Schema; |
3 |
use yii\db\Migration; |
4 |
class m161027_001026_social_cursor_table extends Migration |
5 |
{
|
6 |
public function up() |
7 |
{
|
8 |
$tableOptions = null; |
9 |
if ($this->db->driverName === 'mysql') { |
10 |
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
11 |
}
|
12 |
|
13 |
$this->createTable('{{%social_cursor}}', [ |
14 |
'id' => Schema::TYPE_PK, |
15 |
'user_id' => Schema::TYPE_BIGINT.' NOT NULL', |
16 |
'next_cursor' => Schema::TYPE_STRING.' NOT NULL', |
17 |
], $tableOptions); |
18 |
}
|
Sa kalaunan, gagawa ako ng background cron tasks para gawin lahat anglahat ng ito, subalit para sa prototype sa araw na ito, ginagawa ko ito ng mano mano.
Paglikom ng Tagasunod at Ang Kanilang Account Data
Sumunod, gumawa ako ng method Twitter::getFollowers()
para
makagawa ng request. Narito ang basics ng code:
1 |
public function getFollowers($user_id) { |
2 |
$sp = new SocialProfile(); |
3 |
$next_cursor = SocialCursor::getCursor($user_id); |
4 |
... |
5 |
while ($next_cursor>0) { |
6 |
$followers = $this->connection->get("followers/list",['cursor'=>$next_cursor]); |
7 |
if ($this->connection->getLastHttpCode() != 200) { |
8 |
var_dump($this->connection); |
9 |
exit; |
10 |
} |
11 |
if (isset($followers->users)) { |
12 |
foreach ($followers->users as $u) { |
13 |
$n+=1; |
14 |
$users[]=$u; |
15 |
$sp->add($user_id,$u); |
16 |
} |
17 |
$next_cursor= $followers->next_cursor; |
18 |
SocialCursor::refreshCursor($user_id,$next_cursor); |
19 |
echo $next_cursor.'<br />'; |
20 |
echo '======================================================<br />'; |
21 |
} else { |
22 |
exit; |
23 |
} |
24 |
} |
Kumukuha ito next_cursor
at paulit ulit na
magtatanong ng tagasunod, $followers = $this->connection->get("followers/list",['cursor'=>$next_cursor]
), hanggang sa maabot nito ang rate limits.
Ang resulta ay magmumukhang katulad nito habang gumagawa ito sa bawat pahina ng 20 resulta:
1 |
refresh cursor: 1489380833827620370 |
2 |
====================================================== |
3 |
refresh cursor: 1488086367811119559 |
4 |
====================================================== |
5 |
refresh cursor: 1486452899268510188 |
6 |
====================================================== |
7 |
refresh cursor: 1485593015909209633 |
8 |
====================================================== |
9 |
refresh cursor: 1485330282069552137 |
10 |
====================================================== |
11 |
refresh cursor: 1485256983607000799 |
12 |
====================================================== |
13 |
refresh cursor: 1484594012550322889 |
14 |
====================================================== |
15 |
refresh cursor: 1483359799854574028 |
16 |
====================================================== |
17 |
refresh cursor: 1481615590678791493 |
18 |
====================================================== |
19 |
refresh cursor: 1478424827838161031 |
20 |
====================================================== |
21 |
refresh cursor: 1477449626282716582 |
22 |
====================================================== |
23 |
refresh cursor: 1475751176809638917 |
24 |
====================================================== |
25 |
refresh cursor: 1473539961706830585 |
26 |
====================================================== |
27 |
refresh cursor: 1471375035531579849 |
28 |
====================================================== |
Ang data ay nakatago ng $sp->add($user_id,$u);
na
pamamaraan. Ang SocialProfile::add()
ay ibang bersyon ng fill()
na pamamaraan na galing sa
Twixxr na pagtuturo. Itinatago nito ang maraming data at mina-manage ang
SocialFriend index:
1 |
public static function add($user_id,$profileObject=null) { |
2 |
$sp = SocialProfile::find() |
3 |
->where(['social_id'=>$profileObject->id_str]) |
4 |
->one(); |
5 |
if (!isset($profileObject->name) || empty($profileObject->name)) { |
6 |
$profileObject->name='Nameless'; |
7 |
}
|
8 |
if (!isset($profileObject->url) || empty($profileObject->url)) { |
9 |
$profileObject->url=''; |
10 |
}
|
11 |
if (!isset($profileObject->screen_name) || empty($profileObject->screen_name)) { |
12 |
$profileObject->screen_name='error_sn'; |
13 |
}
|
14 |
if (!isset($profileObject->description) || empty($profileObject->description)) { |
15 |
$profileObject->description='(empty)'; |
16 |
}
|
17 |
if (!isset($profileObject->profile_location) || empty($profileObject->profile_location)) { |
18 |
$profileObject->profile_location=''; |
19 |
}
|
20 |
if (!isset($profileObject->profile_image_url_https) || empty($profileObject->profile_image_url_https)) { |
21 |
$profileObject->profile_image_url_https=''; |
22 |
}
|
23 |
if (!is_null($sp)) { |
24 |
$sp->social_id = $profileObject->id; |
25 |
$sp->image_url = $profileObject->profile_image_url_https; |
26 |
$sp->follower_count= $profileObject->followers_count; |
27 |
$sp->status_count = $profileObject->statuses_count; |
28 |
$sp->friend_count = $profileObject->friends_count; |
29 |
$sp->listed_in = $profileObject->listed_count; |
30 |
$sp->url=$profileObject->url; |
31 |
if ($profileObject->protected) { |
32 |
$sp->protected=1; |
33 |
} else { |
34 |
$sp->protected=0; |
35 |
}
|
36 |
if ($profileObject->verified) { |
37 |
$sp->verified=1; |
38 |
} else { |
39 |
$sp->verified=0; |
40 |
}
|
41 |
$sp->favourites_count=$profileObject->favourites_count; |
42 |
$sp->location=$profileObject->location; |
43 |
$sp->profile_location=$profileObject->profile_location; |
44 |
$sp->name = $profileObject->name; |
45 |
$sp->description = $profileObject->description; |
46 |
$sp->image_url = $profileObject->profile_image_url_https; |
47 |
if ($sp->validate()) { |
48 |
$sp->update(); |
49 |
} else { |
50 |
var_dump($sp->getErrors()); |
51 |
}
|
52 |
} else { |
53 |
$sp = new SocialProfile(); |
54 |
$sp->social_id = $profileObject->id; |
55 |
$sp->score = 0; |
56 |
$sp->header_url=''; |
57 |
$sp->url=$profileObject->url; |
58 |
$sp->favourites_count=$profileObject->favourites_count; |
59 |
if ($profileObject->protected) { |
60 |
$sp->protected=1; |
61 |
} else { |
62 |
$sp->protected=0; |
63 |
}
|
64 |
if ($profileObject->verified) { |
65 |
$sp->verified=1; |
66 |
} else { |
67 |
$sp->verified=0; |
68 |
} $sp->location=$profileObject->location; |
69 |
$sp->profile_location=$profileObject->profile_location; |
70 |
$sp->name = $profileObject->name; |
71 |
$sp->description = $profileObject->description; |
72 |
$sp->screen_name = $profileObject->screen_name; |
73 |
$sp->image_url = $profileObject->profile_image_url_https; |
74 |
$sp->follower_count= $profileObject->followers_count; |
75 |
$sp->status_count = $profileObject->statuses_count; |
76 |
$sp->friend_count = $profileObject->friends_count; |
77 |
$sp->listed_in = $profileObject->listed_count; |
78 |
if ($sp->validate()) { |
79 |
$sp->save(); |
80 |
} else { |
81 |
var_dump($sp->getErrors()); |
82 |
}
|
83 |
}
|
84 |
$sf = SocialFriend::find() |
85 |
->where(['social_profile_id'=>$sp->id]) |
86 |
->andWhere(['user_id'=>$user_id]) |
87 |
->one(); |
88 |
if (is_null($sf)) { |
89 |
$sf = new SocialFriend(); |
90 |
$sf->user_id = $user_id; |
91 |
$sf->social_profile_id = $sp->id; |
92 |
$sf->save(); |
93 |
}
|
94 |
return $sp->id; |
95 |
}
|
Nakasulat ito para ma-save ang bagong records o i-update ang lumang records para sa mga susunod na pahanon maaari mong makita ang data ng iyong mga tagasunod at i-update ito ng madalas, matatakpan na ang lumang data.
Ang huling kabanatang nito sa dulo ay sisiguraduhin na mayroong SocialFriend index sa pagitan ng User table at SocialProfile table.
1 |
$sf = SocialFriend::find() |
2 |
->where(['social_profile_id'=>$sp->id]) |
3 |
->andWhere(['user_id'=>$user_id]) |
4 |
->one(); |
5 |
if (is_null($sf)) { |
6 |
$sf = new SocialFriend(); |
7 |
$sf->user_id = $user_id; |
8 |
$sf->social_profile_id = $sp->id; |
9 |
$sf->save(); |
10 |
}
|
Pagtatala ng Tagasunod sa Twitter



Marami akong layunin para sa pagtatala ng aking Twitter:
- Tanggalin ang accounts ng mga sumusunod
sa sumusunod sa kanila: Halimbawa, mayroon silang 12,548 na tagasunod at may
sinusundan na 12,392 na tao(tingnan ang nasa itaas).
- Tanggalin ang accounts na may sinusundan na mahigit 1,500 accounts na imposibleng titingnan man lamang ang aking ibinabahagi. Halimbawa, si Dan Savage ay may sinusundan na 1,536 na tao.
- Tanggalin ang accounts na may kakaunting posts o kaya kakaunti lang ang accounts na sinusundan, na parang hindi na aktibong accounts.
- Tanggalin ang accounts na may kaunting favorites-maaaring sila ay robots, hindi talaga gumagamit ng app.
Ganoon din, gusto kong i-highlight ang ibang mga positibong aspeto:
- Accounts na nasuri
- Accounts na maraming tagasunod
- Accounts na may hindi bababa sa 1,000 na tao na sinusundan-mas epektibo para sa akin
Narito ang ilang pangunahing code galing
sa SocialProfile::score()
na pinagtuunan ng pansin ang ilan sa
mga positibio:
1 |
foreach ($all as $sp) { |
2 |
// score sp
|
3 |
$score =0; |
4 |
// RULE IN
|
5 |
if ($sp->verified==1) { |
6 |
$score+=1000; |
7 |
}
|
8 |
// POSITIVE
|
9 |
if ($sp->protected==1) { |
10 |
$score+=500; |
11 |
}
|
12 |
if ($sp->follower_count > 10000) { |
13 |
$score+=500; |
14 |
} else if ($sp->follower_count > 3500) { |
15 |
$score+=750; |
16 |
} else if ($sp->follower_count > 1100) { |
17 |
$score+=1000; |
18 |
} else if ($sp->follower_count > 1000) { |
19 |
$score+=250; |
20 |
} else if ($sp->follower_count> 500) { |
21 |
$score+=250; |
22 |
}
|
Narito ang ilang code na magtatanggal ng ilan sa mga pangit na accounts:
1 |
// RULE OUT
|
2 |
// make this a percentage of magnitude
|
3 |
$magnitude = $sp->follower_count/1000; |
4 |
if ($sp->follower_count> 1000 and abs($sp->follower_count-$sp->friend_count)<$magnitude) { |
5 |
$score-=2500; |
6 |
}
|
7 |
if ($sp->friend_count > 7500) { |
8 |
$score-=10000; |
9 |
} else |
10 |
if ($sp->friend_count > 5000) { |
11 |
$score-=5000; |
12 |
}
|
13 |
else if ($sp->friend_count > 2500) { |
14 |
$score-=2500; |
15 |
}else if ($sp->friend_count > 2000) { |
16 |
$score-=2000; |
17 |
} else if ($sp->friend_count > 1000) { |
18 |
$score-=250; |
19 |
} else if ($sp->friend_count > 750) { |
20 |
$score-=100; |
21 |
}
|
22 |
if ($sp->follower_count<100) { |
23 |
$score-=1000; |
24 |
}
|
25 |
if ($sp->status_count < 35) { |
26 |
$score-=5000; |
27 |
}
|
Malinaw naman na maraming pwedeng laruin dito at iba’t ibang paraan para mas mapaganda ito. Sana mas marami akong panahon para bigyan ng oras ito.
Habang gumagana ang pamamaraan na ginamit, ganito ang itsura nito, subalit ina-update nito ang SocialProfile table na may scores habang tumatakbo ito:
1 |
DJMany -6300 |
2 |
gai_ltau -7850 |
3 |
Michal92B -900 |
4 |
InvestmentAdvsr -2900 |
5 |
TSSStweets -7500 |
6 |
sandcageapp -1750 |
7 |
dominicpouzin 1950 |
8 |
daletdykaaolch1 -7850 |
9 |
suzamack -8250 |
10 |
writingthrulife -7500 |
11 |
ryvr -1550 |
12 |
RichardAngwin -8300 |
13 |
DanielleMorrill -7300 |
14 |
ReversaCreates 2750 |
15 |
BoKnowsMarkting -7500 |
16 |
TheHMProA -8500 |
17 |
HouseMgmt101 750 |
18 |
itsmeKennethG -1250 |
19 |
drbobbiwegner -8500 |
20 |
Mizzfit_Bianca -7300 |
21 |
wilsonmar 700 |
22 |
CoachVibeke -7300 |
23 |
jhurwitz 0 |
24 |
PiedPiperComms 500 |
25 |
Prana2thePeople -1100 |
26 |
singlemomspower -2250 |
27 |
mouselink -7300 |
28 |
MotivatedGenY -7300 |
29 |
brett7three -7300 |
30 |
JovanWalker 2950 |
31 |
ITSPmagazine 450 |
32 |
RL_Miller -2250 |
Pagpapakita ng Scoreboard
Ang dati ng Yii’s grid ay mas nagpapadali na ipakita ang SocialProfile table at gawin ang scoreboard columns ayon sa iyong kagustuhan.
Narito ang SocialProfileController::actionIndex():
1 |
/**
|
2 |
* Lists all SocialProfile models.
|
3 |
* @return mixed
|
4 |
*/
|
5 |
public function actionIndex() |
6 |
{
|
7 |
$searchModel = new SocialProfileSearch(); |
8 |
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
9 |
|
10 |
return $this->render('index', [ |
11 |
'searchModel' => $searchModel, |
12 |
'dataProvider' => $dataProvider, |
13 |
]);
|
14 |
}
|
At narito ang grid view customized:
1 |
<?php
|
2 |
use yii\helpers\Html; |
3 |
use yii\grid\GridView; |
4 |
use yii\widgets\Pjax; |
5 |
/* @var $this yii\web\View */
|
6 |
/* @var $searchModel frontend\models\SocialProfileSearch */
|
7 |
/* @var $dataProvider yii\data\ActiveDataProvider */
|
8 |
$this->title = Yii::t('frontend', 'Social Profiles'); |
9 |
$this->params['breadcrumbs'][] = $this->title; |
10 |
?>
|
11 |
<div class="social-profile-index"> |
12 |
<h1><?= Html::encode($this->title) ?></h1> |
13 |
<?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
14 |
<?php Pjax::begin(); ?> <?= GridView::widget([ |
15 |
'dataProvider' => $dataProvider, |
16 |
'filterModel' => $searchModel, |
17 |
'columns' => [ |
18 |
['class' => 'yii\grid\SerialColumn'], |
19 |
[
|
20 |
'label'=>'Name', |
21 |
'format' => 'raw', |
22 |
'value' => function ($model) { |
23 |
return '<div><span><strong><a href="http://twitter.com/'.$model->screen_name.'">'.$model->name.'</a></strong><br />'.$model->screen_name.'</span></div>'; |
24 |
},
|
25 |
],
|
26 |
'score', |
27 |
[
|
28 |
'label'=>'Follows', |
29 |
'format' => 'raw', |
30 |
'attribute'=>'friend_count', |
31 |
],
|
32 |
[
|
33 |
'label'=>'Followers', |
34 |
'format' => 'raw', |
35 |
'attribute'=>'follower_count', |
36 |
],
|
37 |
[
|
38 |
'label'=>'Tweets', |
39 |
'format' => 'raw', |
40 |
'attribute'=>'status_count', |
41 |
],
|
42 |
[
|
43 |
'label'=>'Favs', |
44 |
'format' => 'raw', |
45 |
'attribute'=>'favourites_count', |
46 |
],
|
47 |
[
|
48 |
'label'=>'Listed', |
49 |
'format' => 'raw', |
50 |
'attribute'=>'listed_in', |
51 |
],
|
52 |
[
|
53 |
'label'=>'P', |
54 |
'format' => 'raw', |
55 |
'attribute'=>'protected', |
56 |
],
|
57 |
[
|
58 |
'label'=>'V', |
59 |
'format' => 'raw', |
60 |
'attribute'=>'verified', |
61 |
],
|
62 |
|
63 |
// 'location',
|
64 |
// 'profile_location',
|
65 |
[
|
66 |
//'contentOptions' => ['class' => 'col-lg-11 col-xs-10'],
|
67 |
'label'=>'Pic', |
68 |
'format' => 'raw', |
69 |
'value' => function ($model) { |
70 |
return '<div><span><img src="'.$model->image_url.'"></span></div>'; |
71 |
},
|
72 |
],
|
73 |
],
|
74 |
]); ?> |
75 |
<?php Pjax::end(); ?></div> |
Narito kung ano ang itsura ng top scores
gamit ang aking inisyal na paraan:



Maraming paraan para mas mapaganda at i-tune ang scoring. Inaabangan ko iyong panahon na mas malalaro ko ito.
At mas marami akong gustong isulat na code para sa at mas palawakin ang gamit ko ng API, halimbawa:
- Gamitin ang PHP gender para tanggalin ang kumpanya sa tao(ang kumpanya ay wala namang masyadong interaksyon).
- Tingnan ang dalas ng pag-post na ginagawa ng tao at huling oras na gumamit sila ng Twitter.
- Gamitin ang Twitter’s search API para makita sinong tagasunod ang totoong nagkaroon ng interaksyon sa aking content.
- Magbigay ng feedback sa scoring para simulant ito.
Pagsasaalang-alang ng Susunod na Hakbang
Sana ay pumukaw sa inyo ang scoring approach. Ang dami pang paraan para mas mapaganda ito. Malaya itong paglaruan at i-post ang iyong ideas sa baba.
Kung mayroon kayong katanungan o
suhestyon, maaari lamang na i-post ang mga ito sa comments. Kung nais niyong masundan ang aking
susunod na Envato Tuts+ tutorials at iba pang serye, bisitahin lamang ang pahina ng aking guro o
sundan @reifman. Siguraduhing tingnan ang aking startup na kabanata at Meeting
Planner.
Related Links
- Twixxr (bagong sample na Twitter API na app para tuklasin ang mga makapangyarihang babae na susundan)
- Dokumentasyon sa Gumawa ng Twitter
- Paano Gumawa ng Program Gamit ang Yii2 na Serye (Envato Tuts+)