private function transferDynamic($dynamics) { $temp = array(); foreach ($dynamics as $dynamic) { $user = CacheManager::getUserByID($dynamic['author_id']); if (isset($user) && !is_null($user)) { switch ($dynamic['dynamic_type']) { case Constants::DYNAMIC_TYPE_WATCH: $temp[] = array('type' => 'watch', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id']); break; case Constants::DYNAMIC_TYPE_SHARE: $temp[] = array('type' => 'share', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id'], 'share_where_type' => $dynamic['content_desc']); break; case Constants::DYNAMIC_TYPE_COMMENTS: $temp[] = array('type' => 'comment', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id'], 'content' => $dynamic['content_desc']); break; case Constants::DYNAMIC_TYPE_FAVORITY: $temp[] = array('type' => 'favority', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id']); break; case Constants::DYNAMIC_TYPE_LIKE: $temp[] = array('type' => 'like', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id']); break; case Constants::DYNAMIC_TYPE_PUBLISH_PROGRAM: $temp[] = array('type' => 'publish', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id']); break; case Constants::DYNAMIC_TYPE_UN_FAVORITY: $temp[] = array('type' => 'unfavority', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id']); break; case Constants::DYNAMIC_TYPE_COMMENT_REPLI: $prod = CacheManager::getCommentProgram($dynamic['content_id']); $temp[] = array('type' => 'reply', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $prod['type'], 'prod_id' => $prod['id'], 'prod_name' => $prod['name'], 'prod_poster' => $prod['poster'], 'thread_id' => $dynamic['content_id'], 'thread_comment' => CacheManager::getCommentContent($dynamic['content_id']), 'content' => $dynamic['content_desc']); break; case Constants::DYNAMIC_TYPE_FOLLOW: $temp[] = array('type' => 'follow', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'friend_name' => $dynamic['content_name'], 'friend_pic_url' => $dynamic['content_pic_url'], 'friend_id' => $dynamic['content_id']); break; // case Constants::DYNAMIC_TYPE_LIKE_FRIEND: // $temp[] = array( // 'type'=>'like_person', // 'user_id'=>$user->id, // 'user_name'=>$user->nickname, // 'user_pic_url'=>$user->user_pic_url, // 'create_date'=>$dynamic['create_date'], // 'friend_name'=>$dynamic['content_name'], // 'friend_pic_url'=>$dynamic['content_pic_url'], // 'friend_id'=>$dynamic['content_id'], // ); // break; // case Constants::DYNAMIC_TYPE_LIKE_FRIEND: // $temp[] = array( // 'type'=>'like_person', // 'user_id'=>$user->id, // 'user_name'=>$user->nickname, // 'user_pic_url'=>$user->user_pic_url, // 'create_date'=>$dynamic['create_date'], // 'friend_name'=>$dynamic['content_name'], // 'friend_pic_url'=>$dynamic['content_pic_url'], // 'friend_id'=>$dynamic['content_id'], // ); // break; case Constants::DYNAMIC_TYPE_UN_FOLLOW: $temp[] = array('type' => 'destory', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'friend_name' => $dynamic['content_name'], 'friend_pic_url' => $dynamic['content_pic_url'], 'friend_id' => $dynamic['content_id']); break; case Constants::DYNAMIC_TYPE_RECOMMEND: $temp[] = array('type' => 'recommend', 'user_id' => $user->id, 'user_name' => $user->nickname, 'user_pic_url' => $user->user_pic_url, 'create_date' => $dynamic['create_date'], 'prod_type' => $dynamic['content_type'], 'prod_name' => $dynamic['content_name'], 'prod_poster' => $dynamic['content_pic_url'], 'prod_id' => $dynamic['content_id'], 'reason' => $dynamic['content_desc']); break; } } } return $temp; }