Exemplo n.º 1
0
 public function get_all($condition, $next_id, $count)
 {
     if ($next_id === NULL || $count === NULL) {
         $next_id = 0;
         $count = 10;
     }
     $score_record_list = $this->scoremod->get_all($condition, $next_id, $count);
     foreach ($score_record_list as $score_record) {
         // 人物名称
         $user_id = $score_record->user->uuid;
         $userMod = new UserModule($user_id);
         $user_info = $userMod->get_by_id($user_id);
         $score_record->user = $user_info[0];
         // 规则名称
         $rule_id = $score_record->rule->id;
         $rule_info = $this->scoremod->get_by_id($rule_id);
         $score_record->rule = $rule_info;
     }
     return $score_record_list;
 }
Exemplo n.º 2
0
 /**
  * 根据视频直播的id  查询出对应的评论列表
  * @param unknown $vid
  */
 public function get_comment_by_vid($vid)
 {
     $table = new CommentTable();
     $comm_list = $table->get_comments_by_vid($vid);
     $userModule = new UserModule(@$user_id);
     date_default_timezone_set("Asia/Shanghai");
     foreach ($comm_list as $comment) {
         $user_info = $userModule->get_by_id($comment->user->uuid);
         $now_time = date("Y-m-d H:i:s");
         $comm_sub_time = $comment->subtime;
         $timestamp = strtotime($now_time) - strtotime($comm_sub_time);
         $str_time = "";
         if ($timestamp < 0) {
             $str_time = $timestamp;
         } else {
             if ($timestamp < 60) {
                 //
                 $str_time = $timestamp . "秒前";
             } else {
                 if ($timestamp < 3600) {
                     $str_time = floor($timestamp / 60) . "分钟前";
                 } else {
                     if ($timestamp < 86400) {
                         $str_time = floor($timestamp / 3600) . "小时前";
                     } else {
                         if ($timestamp < 259200) {
                             // 3天
                             $str_time = floor($timestamp / 86400) . "天前";
                         } else {
                             $str_time = "3天以前";
                         }
                     }
                 }
             }
         }
         $comment->subtime = $str_time;
         // 距离现在过了多久
         $comment->user = $user_info[0];
     }
     return $comm_list;
 }
Exemplo n.º 3
0
$video_id = $json_param->video_id;
$detail = $json_param->detail;
$comment = new CommentModel();
$comment->user->uuid = $user_id;
$comment->video_live->id = $video_id;
$comment->detail = $detail;
$table = new CommentTable();
$rcode = $table->insert_comment($comment);
$message = "";
if (!$rcode) {
    $message = "评论失败";
} else {
    $comm = $table->get_by_id($rcode);
    $userModule = new UserModule(@$user_id);
    date_default_timezone_set("Asia/Shanghai");
    $user_info = $userModule->get_by_id($comm->user->uuid);
    $scoreSer = new ScoreService();
    $rule_list = $scoreSer->apply_rule($user_info, GET_SCORE, ScoreModule::point_comment);
    file_put_contents("/tmp/yike.log", "rule_liist --->" . $rule_list, FILE_APPEND);
    if ($rule_list) {
        $message = "";
        foreach ($rule_list as $rule) {
            $msg = $rule->title . " + " . $rule->amount;
            $message[] = $msg;
        }
        $user_info = $userModule->get_by_id($comm->user->uuid);
    }
    $now_time = date("Y-m-d H:i:s");
    $comm_sub_time = $comm->subtime;
    $timestamp = strtotime($now_time) - strtotime($comm_sub_time);
    $str_time = "";
Exemplo n.º 4
0
 /**
  * 修改用户的昵称
  * @param $name 用户的唯一昵称
  * @param $uuid 用户的唯一标识符
  * return 返回的是用户的基本信息
  */
 public function update_profile($uuid, $name)
 {
     $userModule = new UserModule($uuid);
     // 检查昵称是否被占用
     $is_nick_name = $userModule->check_name($name);
     if ($is_nick_name == 1) {
         $user = $userModule->update_profile($uuid, $name);
         if ($user) {
             return $userModule->get_by_id($uuid);
         } else {
             return DB_ERR_NO_DATA;
         }
     } else {
         return NICK_NAME_IS_ALREADY;
     }
 }