/* 一般情况 */
public function get(){
return $this->where("id=".(int)I('id'))->find();
}
/* 获取信息后拆分多图 */
public function get(){
$m = M('products');
$rs = $m->where("productId=".(int)I('id'))->find();
if($rs['productImg2']!='')$rs['productImg2'] = explode(',',$rs['productImg2']);
return $rs;
}
/* 获取信息后,需要获取另外一个表的信息 */
public function get(){
$rs = $this->where("productId=".(int)I('id'))->find();
//获取关联的分类
$sql = "select * from __PREFIX__goods_cat_products where productId=".(int)I('id');
$catproducts = $this->query($sql);
if(!empty($catproducts)){
foreach ($catproducts as $key => $v){
$rs['catproducts_'.$v['catId']] = 1;
}
}
return $rs;
}
/* 通过关联表获取信息 */
public function get(){
$id = (int)I('id');
$sql = "select a.*,aa.content,aa.id from __PREFIX__faqs a left join __PREFIX__faq_answers aa on a.faqId=aa.faqId and aa.isMaster=1 where a.faqId=".$id;
return $this->queryRow($sql);
}