public function raceCatalogUpdateAction() { $bind = $this->request->from('RaceCatalogId', 'RaceCatalogName'); if (trim($bind['RaceCatalogName']) == "") { $response = array('errno' => 1); } elseif (intval($bind['RaceCatalogId']) <= 0) { $response = array('errno' => 2); } else { //获取原有数据 $oRaceCatalog = $this->oRaceCatalog->getRaceCatalog($bind['RaceCatalogId'], '*'); $bind['comment'] = json_decode($oRaceCatalog['comment'], true); //文件上传 $oUpload = new Base_Upload('RaceCatalogIcon'); $upload = $oUpload->upload('RaceCatalogIcon'); $res[1] = $upload->resultArr; $path = $res[1][1]; //如果正确上传,就保存文件路径 if (strlen($path['path']) > 2) { $bind['comment']['RaceCatalogIcon'] = $path['path']; $bind['comment']['RaceCatalogIcon_root'] = $path['path_root']; } $bind['comment'] = json_encode($bind['comment']); $res = $this->oRaceCatalog->updateRaceCatalog($bind['RaceCatalogId'], $bind); $response = $res ? array('errno' => 0) : array('errno' => 9); } echo json_encode($response); return true; }
public function raceStageUpdateAction() { //获取 页面参数 $bind = $this->request->from('RaceStageId', 'RaceStageName', 'RaceCatalogId', 'StageStartDate', 'StageEndDate'); //获取已经选定的分组列表 $SelectedRaceGroup = $this->request->from('SelectedRaceGroup'); //赛事列表 $RaceCatalogArr = $this->oRace->getAllRaceCatalogList(); //分站名称不能为空 if (trim($bind['RaceStageName']) == "") { $response = array('errno' => 1); } elseif (intval($bind['RaceStageId']) <= 0) { $response = array('errno' => 2); } elseif (!isset($RaceCatalogArr[$bind['RaceCatalogId']])) { $response = array('errno' => 3); } elseif (count($SelectedRaceGroup['SelectedRaceGroup']) == 0) { $response = array('errno' => 4); } else { //获取原有数据 $oRaceStage = $this->oRace->getRaceStage($bind['RaceStageId']); $bind['comment'] = json_decode($oRaceStage['comment'], true); $bind['comment']['SelectedRaceGroup'] = $SelectedRaceGroup['SelectedRaceGroup']; //文件上传 $oUpload = new Base_Upload('RaceStageIcon'); $upload = $oUpload->upload('RaceStageIcon'); $res = $upload->resultArr; foreach ($upload->resultArr as $iconkey => $iconvalue) { $path = $iconvalue; //如果正确上传,就保存文件路径 if (strlen($path['path']) > 2) { $bind['comment']['RaceStageIconList'][$iconkey]['RaceStageIcon'] = $path['path']; $bind['comment']['RaceStageIconList'][$iconkey]['RaceStageIcon_root'] = $path['path_root']; } } //数据压缩 $bind['comment'] = json_encode($bind['comment']); //更新数据 $res = $this->oRace->updateRaceStage($bind['RaceStageId'], $bind); $response = $res ? array('errno' => 0) : array('errno' => 9); } echo json_encode($response); return true; }
public function insertScheduleAction() { $sign = '?ctl=config/product/pack&ac=asign.schedule'; $this->manager->checkMenuPermission($sign, Widget_Manager::MENU_PURVIEW_UPDATE); //检查当前页面权限 $oUpload = new Base_Upload("user_list"); $upload = $oUpload->upload('asign'); $res[1] = $upload->resultArr; $path = $res[1][1]; $bind = $this->request->from('GenId', 'Date'); $bind['FileName'] = $path['path']; $bind['ManagerId'] = $this->manager->id; if (empty($bind['FileName'])) { echo json_encode(array('errno' => 1)); return false; } $GenInfo = $this->oProductPack->GetGenPackCodeLogById($bind['GenId']); if (!$GenInfo['GenId']) { echo json_encode(array('errno' => 2)); return false; } if ($bind['Date'] < date('Y-m-d', time())) { echo json_encode(array('errno' => 3)); return false; } $res = $this->oProductPack->insertSchedule($bind); $response = $res ? array('errno' => 0) : array('errno' => 9); echo json_encode($response); }