public function update($id) { $seo = Seo::find($id); $itemID = Input::get('id'); $seo->updateFromInput(); return Redirect::to('admin/seo/' . $id . '/edit?type=' . $this->type . '&id=' . $itemID)->with('seo_updated', true); }
public function actionRefresh() { $request = Yii::app()->getRequest(); $sid = trim($request->getParam("sid")); if ($sid) { try { //获取url $site = new Site(); $row = $site->find('sid=:sid', array(':sid' => $sid)); $domain = new Domain(); $row = $domain->find('id=:id', array(':id' => $row['dmid'])); $url = 'www.' . $row['name']; //获取seo信息 $seo = new Seotool($url); $info['alexa'] = (int) $seo->getAlexaRank(); $info['google'] = (int) $seo->getIndexedGoogle(); $info['baidu'] = (int) $seo->getIndexedBaidu(); $info['pr'] = (int) $seo->getPagerank(); $info['sid'] = $sid; //更新数据 $res = new Seo(); $row = $res->find('sid=:sid', array(':sid' => $sid)); if ($row) { $res = new Seo(); $res->_pk = $row['id']; $res->_attributes = $info; $res->setIsNewRecord(false); $res->update(); } else { $res = new Seo(); $res->_attributes = $info; $res->insert(); } $this->redirect(array('list')); } catch (CDbException $e) { throw CDbException($e); } } }
public function saveseo() { $seoid = Input::get('seoid'); $seo = Seo::find($seoid); $seo->updateFromInput(); $seo->save(); return Redirect::to('backend/seo')->withMessage($this->notifyView(Lang::get('laracms::messages.seo_edited'), 'success')); }
public function actionDelete() { $request = Yii::app()->getRequest(); $id = trim($request->getParam("id")); if ($id) { try { $res = new Site(); $res2 = new Rnum(); $res3 = new Seo(); $row = $res->findByPk($id); $row2 = $res2->find('sname=:sname', array(':sname' => $row->name)); $row3 = $res3->find('sid=:sid', array(':sid' => $row->sid)); $row->delete(); $row2->delete(); $row3->delete(); $this->redirect(array('list')); } catch (CDbException $e) { throw CDbException($e); } } }