Ejemplo n.º 1
0
 /**
  * 获取演员列表
  * @param int $index
  * @param int $count
  * @param null $company
  * @return $this|array|\yii\db\ActiveRecord[]
  */
 public function videoList($index = self::PAGE_INDEX_DEFAULT, $count = self::PAGE_COUNT_DEFAULT)
 {
     $index = is_numeric($index) ? $index : self::PAGE_INDEX_DEFAULT;
     $count = is_numeric($count) ? $count : self::PAGE_COUNT_DEFAULT;
     $offset = ($index - 1) * $count;
     $_actorList = ActorModel::find()->where(['status' => ActorModel::ACTOR_STATUS_OK]);
     if ($company !== null) {
         $_actorList = $_actorList->andWhere(['company_id' => $company]);
     }
     $_actorList = $_actorList->offset($offset)->limit($count)->asArray()->all();
     return $_actorList;
 }
Ejemplo n.º 2
0
 public function comment($actor_id, $user_id, $content, $target_id = null, $target_user = null)
 {
     if (!is_numeric($actor_id) || !is_numeric($user_id)) {
         return ErrorConstant::PARAM_ERROR;
     }
     //判断演员是否存在
     $actor = ActorModel::find(['id' => $actor_id])->asArray()->one();
     if ($actor === []) {
         return ErrorConstant::ACTOR_NOT_EXISTS;
     }
     $target_id = $target_id ?: -1;
     $target_user = $target_user ?: -1;
     $comment = ['actor_id' => (int) $actor_id, 'user_id' => (int) $user_id, 'content' => $content, 'target_user_id' => (int) $target_user, 'target_comment_id' => (int) $target_id];
     $commentActor = new ActorCommentModel();
     if ($commentActor->addComment($comment)) {
         $this->onAfterComment($comment);
         return true;
     }
     return ErrorConstant::ACTOR_COMMENT_FAILED;
 }