🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 后台:课程讨论管理 # 获取课程讨论内容 - 支持分页 - 支持条件查询:按举报情况、按状态、按关键字(姓名、账号、内容) 查看评论 批量删除 修改举报状态 ## 获取课程评价 CourseCenterService::factory()->countCourseComments($args) ``` public function findCourseComment( $args ) { $criteria = new CDbCriteria(); $with = array(); if ( $args[ "keyWord" ] ) { $with[ ] = "course"; $with[ ] = "user"; $criteria->addSearchCondition( "course.fdName", $args[ "keyWord" ], true ); $criteria->addSearchCondition( "user.fdName", $args[ "keyWord" ], true, "OR" ); } if ( $args['id'] ) $criteria->compare( 't.id', $args['id'] ); if ( $args[ "courseID" ] ) $criteria->compare( "t.fdCourseID", $args[ "courseID" ] ); // 评论对象类型 if (is_numeric($args['type'])) $criteria->compare( "t.fdType", $args[ "type" ] ); // 课程小节 if ( $args['courseCatalogID'] ) $criteria->compare( "t.fdCourseCatalogID", $args[ "courseCatalogID" ] ); // 评论父ID if ( is_numeric($args['parentID']) ) $criteria->compare( "t.fdParentID", $args[ "parentID" ] ); if ( $args[ "courseUserID" ] ) { $with[ ] = "course"; $criteria->compare( "course.fdUserID", $args[ "courseUserID" ] ); } // add is_numeric function to fix zero by wuzhc 2018-12-17 if ( is_numeric( $args[ "status" ] ) ) $criteria->compare( "t.fdStatus", $args[ "status" ] ); if ( $args[ "star" ] ) $criteria->compare( "t.fdStar", $args[ "star" ] ); if ( $args[ "appraiseLevel" ] ) { ( $args[ "appraiseLevel" ] == 3 ) && $criteria->addCondition( "t.fdStar>=1 and t.fdStar<=2" ); ( $args[ "appraiseLevel" ] == 2 ) && $criteria->addCondition( "t.fdStar=3" ); ( $args[ "appraiseLevel" ] == 1 ) && $criteria->addCondition( "t.fdStar>=4 and t.fdStar<=5" ); } if ( $args[ 'select' ] ) { $criteria->select = $args[ 'select' ]; } if ( $args[ 'group' ] ) { $criteria->group = $args[ 'group' ]; } if ($args['order']) { $criteria->order = $args['order']; } else { $criteria->order = "t.fdCreate desc"; } $criteria->offset = $args[ "start" ] ? : 0; $criteria->limit = $args[ "len" ] ? : 10; $criteria->with = is_array( $args[ 'with' ] ) ? array_merge( $with, $args[ 'with' ] ) : $with; return $criteria; } ```