getList($this->schoolId,$page,$pageLimit); if(!empty($result['dataList'])) { $packStatus = ProductDownload::$pack_status; foreach ($result['dataList'] as &$item){ $item['status'] = isset($packStatus[$item['pack_status']]) ? $packStatus[$item['pack_status']] : '状态异常'; } } return $this->render('index', array( 'dataList' => $result['dataList'], 'pages' => $result['pages'], 'page'=>$page, )); } /** * 清除已复制下载任务 */ public function actionClear() { $schoolId = $this->schoolId; $rs = $this->conn->createCommand("delete from pack_product_task where school_id={$schoolId} and pack_status in (2,3)")->execute(); if($rs){ echo json_encode(array('success' => 0, 'message' => '清除失败')); exit; }else{ echo json_encode(array('success'=>1,'message'=>'清除成功')); exit; } } /** * 复制链接 */ public function actionAjaxCopy() { $id = Req::get('id') ? Req::get('id') : 0; if(!$id) { echo json_encode(array('success' => 0, 'message' => '参数错误')); exit; } $model = BusinessPackProductTask::model()->findByPk($id); if($model) { $model-> pack_status = 3; //已复制 $model->save(); }else{ echo json_encode(array('success' => 0, 'message' => '数据异常')); exit; } echo json_encode(array('success'=>1,'message'=>'复制成功')); } }