alias($alias); $alias .= '.'; } return $model->where(["{$alias}is_del" => 0, "{$alias}is_show" => 1, "{$alias}status" => 1]); } /**练习试卷列表 * @param int $page * @param int $limit * @param $tid * @return array */ public static function getTestPaperExercisesList($type, $page, $limit, $pid, $tid, $search) { $model = self::PreExercisesWhere(); if ($tid) { $model = $model->where(['tid' => $tid]); } else if ($pid && !$tid) { $tids = TestPaperCategory::where('pid', $pid)->column('id'); $model = $model->where('tid', 'in', $tids); } if ($search) $model = $model->where('title', 'LIKE', "%$search%"); $list = $model->where('type', $type)->order('sort desc,id desc')->page($page, $limit)->select(); $list = count($list) ? $list->toArray() : []; foreach($list as &$item){ $item['answer'] = $item['fake_sales'] + $item['answer']; } return $list; } /**练习试卷列表 * @param int $page * @param int $limit * @param $tid * @return array */ public static function getMerTestPaperList($mer_id,$type, $page, $limit,$institution = 0) { $list = []; if (!$mer_id) return $list; $model = self::PreExercisesWhere(); $list = $model->where(['type'=>$type])->where('mer_id','in',$mer_id)->where('institution_id',$institution)->order('sort desc,id desc')->page($page, $limit)->select(); $list = count($list) ? $list->toArray() : []; return $list; } }