public function updatealbumAction() { $id = reqnum('id', 0); $ispost = reqnum('ispost', 0); $model = new Psys_ResModel(); if ($ispost == 1) { $aname = reqstr('aname'); $smallpic = reqstr('smallpic'); $bigpic = reqstr('bigpic'); $hits = reqstr('hits'); $flag = reqnum('flag', 0); $parternid = reqstr('parternid'); $partner = reqstr('partner'); $sortid = reqstr('sortid'); $data = array('aname' => $aname, 'smallpic' => $smallpic, 'bigpic' => $bigpic, 'hits' => $hits, 'flag' => $flag, 'parternid' => $parternid, 'partner' => $partner); $result = array('result' => 'ERROR'); if ($id == 0) { if ($aname == '') { MsgInfoConst::GetMsg(1050, $result); return $result; } } else { if ($aname == '') { MsgInfoConst::GetMsg(1050, $result); return $result; } } if ($id == 0) { $data['ctime'] = time(); $model->AddAlbum($data); //$id = $model->AddOne($data,'rhi_album'); //$model->Record($data,$id,'db-rht_sync','album','rhs_downsync'); //start 写操作日志 $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[添加]音乐专辑" . $aname; $model->admin_syslog($log); //end 日志 $result['result'] = 'SUCCESS'; } else { $data['utime'] = time(); $w = array('id' => $id); //在更新前删除原始图片物理文件 $oldData = $model->GetOne($w, 'smallpic,bigpic', 'rhi_album'); //取得专辑信息 //判断是否更新 $smallpic = $oldData['smallpic']; $bigpic = $oldData['bigpic']; //该专辑物理文件存放地址 $smallDir = ALBUM_PATH . '/' . 'small_pic' . '/' . $smallpic; $bigDir = ALBUM_PATH . '/' . 'big_pic' . '/' . $bigpic; if (file_exists($smallDir) && $smallpic != $data['smallpic']) { unlink($smallDir); } if (file_exists($bigDir) && $bigpic != $data['bigpic']) { unlink($bigDir); } //-------------原始物理文件删除结束 $model->UpdateAlbum($data, $w); //$id = $model->UpdateOne($data,$w,'rhi_album'); //$model->Record($data,$id,'db-rht_sync','album','rhs_downsync'); //start 写操作日志 $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[编辑]音乐专辑" . $aname; $model->admin_syslog($log); //end 日志 $result['result'] = 'SUCCESS'; } return $result; } }