关联模型无法查出数据

浏览:438 发布日期:2015/03/05 分类:求助交流
<?php
namespace Admin\Model;
// use Think\Model\RelationModel;
use Think\Model\ViewModel;
class GoodsModel extends ViewModel{
    Protected $tableName ='Goods';
    public $viewFields=array(
        'Goods'=>array('gid','shopid','cid','lid','main_title','sub_title','price','old_price','buy','goods_img','_type'=>'LEFT'),

        'category' => array(
            // 'type' => 'inner', 
            'title'=>'category',
            '_on' => 'category.cid=goods.cid',
        ),

        'locality' => array(
            // 'type' =>'inner',
            'title'=>'locality',
            '_on' =>'locality.lid=goods.lid'
        ),

        'shop' => array(
            // 'type' =>'inner',
            'title'=>'shop',
            '_on' =>'shop.shopid=goods.shopid'
        ),

    );

    /**
        获取全部商品
    **/
    Public function getgoodsAll(){
        echo $this->fetchSql(true)->select();
    }
}
创建了一个视图模型,无法进行关联 ,表结构如下





最佳答案
评论( 相关
后面还有条评论,点击查看>>