public function update()
 {
     if (!isset($_POST['is_flash'])) {
         $_POST['is_flash'] = 0;
         $_POST['flash_style'] = '';
     }
     $_POST['width'] = intval($_POST['width']);
     $_POST['height'] = intval($_POST['height']);
     // 管理员默认通过审核
     if ($status = getAdVerifyStatus()) {
         $_POST['name'] = $_POST['name'];
         // 直接更新广告内容
     } else {
         $_POST['code'] = $_POST['name'];
         // 存放到待审核字段中
         $status = 3;
         // 编辑未通过审核状态
     }
     $_POST['status'] = $status;
     // 默认广告未通过审核
     parent::update();
 }
Example #2
0
 public function update()
 {
     $id = intval($_REQUEST['id']);
     $urls = $_POST['code'];
     // 删除URl可能多余的空格
     foreach ($urls as &$value) {
         $value = trim($value);
     }
     // 管理员默认通过审核
     if ($status = getAdVerifyStatus()) {
         $_POST['code'] = serialize($urls);
         // 直接更新广告内容
     } else {
         $_POST['desc'] = serialize($urls);
         // 存放到待审核字段中
         $status = 3;
         // 编辑未通过审核状态
     }
     $_POST['status'] = $status;
     // 默认广告未通过审核
     $old_img = D("ProvinceAdv")->where('id = ' . $id . ' AND type IN (1,2)')->getField('code');
     $model = D("ProvinceAdv");
     if (false === ($data = $model->create())) {
         $this->error($model->getError());
     }
     //保存当前数据对象
     $list = $model->save($data);
     if (false !== $list) {
         $this->saveLog(1, $id);
         $this->assign('jumpUrl', Cookie::get('_currentUrl_'));
         $this->success(L('EDIT_SUCCESS'));
     } else {
         //错误提示
         $this->saveLog(0, $id);
         $this->error(L('EDIT_ERROR'));
     }
 }