예제 #1
0
 public function actionDelete()
 {
     $request = Yii::app()->getRequest();
     $id = trim($request->getParam("id"));
     if ($id) {
         try {
             $res = new Domain();
             $row = $res->findByPk($id);
             $row->delete();
             $this->redirect(array('list'));
         } catch (CDbException $e) {
             throw CDbException($e);
         }
     }
 }
예제 #2
0
파일: Goods.php 프로젝트: zwq/unpei
 /**
  * 商品编号接口
  */
 public static function GetGoodsByGoodsNo($goodsno, $manufacturer_ID)
 {
     try {
         //$userID=Yii::app()->user->id;
         //$dealerID=Dealer::model()->find('userID=:userID',array(':userID'=>$userID));
         //$grade=MakeEmpowerDealer::model()->find('up_userID=:up_userID and dealer_id=:dealer_id',array(':up_userID'=>$manufacturer_ID,':dealer_id'=>$dealerID->id));
         //	  $sql=" select distinct a.id as goodsID,a.oe as OE, a.brand as brand ,a.NewVersion as verion_name,b.goodsno as goodsno,b.name as goodsname,b.price as makretprice,"
         //		."b.price".$grade->grade." as goodsprice,"
         //		." (select f.code  from tbl_parts_level f where b.parts_level=f.id) as parts_level,"
         //		." (select e.cp_name from tbl_goods_standard e where e.id=d.standard_id) as cp_name,"
         //		." (select c.name from tbl_goods_category c where c.id=a.category_id and a.manufacturer_id=c.manufacturer_id) as category"
         //		//." (select n.car from tbl_goods_vehicle m,tbl_vehicle n where m.Goods_ID='$goodsID' and n.VehicleID in (m.VehicleID)) as car"
         //		."  from tbl_goods a ,tbl_goods_version b,tbl_goods_template d,tbl_vehicle n"
         //		.'  where a.id=b.goods_id and a.NewVersion=b.version_name'
         //		."  and b.templet_id=d.id"
         //		."  and a.manufacturer_id=b.manufacturer_id"
         //		."  and a.ISdelete='N' and a.IsSale='Y'  "
         //		."  and a.manufacturer_id=$manufacturer_ID "
         //		."  and a.id=$goodsID"
         //		."  group by a.id order by a.id desc";
         //$sql=" select distinct a.id as goodsID ,a.oe as OE,a.brand as brand,a.NewVersion as verion_name,b.goodsno as goodsno,b.name as goodsname,b.price as marketprice,"
         //		."b.price".$grade->grade." as goodsprice,"
         //		." (select distinct f.code  from tbl_parts_level f where b.parts_level=f.id) as parts_level,"
         //		." (select distinct e.cp_name from tbl_goods_standard e where e.id=d.standard_id) as cp_name,"
         //		." (select distinct c.name from tbl_goods_category c where c.id=a.category_id and a.manufacturer_id=c.manufacturer_id) as category"
         //		."  from tbl_goods a ,tbl_goods_version b,tbl_goods_category c,tbl_goods_template d,tbl_goods_standard e,tbl_parts_level f,tbl_goods_values g"
         //		.'  where a.id=b.goods_id and a.NewVersion=b.version_name'
         //		."  and b.parts_level=f.id"
         //		."  and b.templet_id=d.id"
         //		."  and e.id=d.standard_id"
         //		."  and a.category_id=c.id"
         //		."  and b.values_id = g.id"
         //		."  and a.manufacturer_id=b.manufacturer_id"
         //		."  and a.ISdelete='N' and a.IsSale='Y'"
         //		."  and a.manufacturer_id='$manufacturer_ID' ";
         //		$sql.="  and b.goodsno='{$goodsno}'";
         //		$sql.="  group by a.id order by a.id desc";
         //授权品牌
         $organID = Commonmodel::getOrganID();
         $brands = MakePromitBrand::model()->find('DealerID=' . $organID . ' and OrganID=' . $manufacturer_ID);
         $sql2 = "select distinct a.id as goodsID ,b.goods_category as category_id,b.goods_oe as OE,b.goods_brand as brand,b.organID,\n                \t\t \t    a.NewVersion as verion_name,b.goods_no as goodsno,b.goods_name as goodsname,\n                                b.benchmarking_brand,b.benchmarking_sn,a.create_time,d.Price," . " b.inventory as inventory,b.senddays,b.description,a.IsSale,b.standard_id" . " from  tbl_make_goods a ,tbl_make_goods_version b ,tbl_make_goods_vehicle c,tbl_make_price_relation d" . '  where a.id=b.goods_id and a.NewVersion=b.version_name' . "  and a.ISdelete='0' and b.ISdelete=0" . "  and a.organID='{$manufacturer_ID}' and b.goods_no='{$goodsno}'";
         $identity = Commonmodel::getIdentity(Yii::app()->user->id);
         if ($identity['identity'] == 2 && $brands['CustomerType']) {
             $sql2 .= " and d.TypeID= {$brands['CustomerType']} and d.GoodsID=a.id and d.Price is not null and a.IsSale=0";
         }
         $result = Yii::app()->db->createCommand($sql2)->queryRow();
         if ($result) {
             //查询品牌名称
             $brandmodel = MakeGoodsBrand::model()->findByPK($result['brand']);
             $result['brand'] = $brandmodel['BrandName'];
             //商品销售价
             if ($result['Price']) {
                 $result['goodsprice'] = $result['Price'];
             }
             //$result['goodsprice']=sprintf("%.2f", $result['salesprice'] * $ratio / 100);
         }
         return $result;
     } catch (CDbException $e) {
         throw CDbException($e);
     }
 }
예제 #3
0
 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);
         }
     }
 }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
 public function actionDelete()
 {
     $request = Yii::app()->getRequest();
     $id = trim($request->getParam("id"));
     if ($id) {
         try {
             $rs = new Role();
             $rrow = $rs->find('rid=:rid', array(':rid' => $id));
             $rrow->delete();
             $pm = new Permission();
             $prow = $pm->find('rid=:rid', array(':rid' => $id));
             $prow->delete();
             $this->redirect(array('list'));
         } catch (CDbException $e) {
             throw CDbException($e);
         }
     }
 }