thinkphp5.1最新版本,withJoin与field共用问题

浏览:97 发布日期:2019/03/15 分类:ThinkPHP5专区
代码:
$videoList = $videoModel->withJoin([$videoModel->hasAttrs=>[$attrModel->size,$attrModel->duration],$videoModel->hasCategory=>[$cateModel->title]],'LEFT')
->field(['title','play_url'])

sql对应是:SELECT `video`.`id`,`video`.`title`,`video`.`desc`,`video`.`file_url`,`video`.`local_img`,`video`.`cover_img`,`video`.`category_id`,`video`.`play_url`,`video`.`feature_id`,`video`.`status`,`video`.`create_time`,`video`.`admin_id`,`video`.`task_count`,`attrs`.`size` AS `attrs__size`,`attrs`.`duration` AS `attrs__duration`,`category`.`name` AS `category__name`,`title`,`play_url` FROM `w_video` `video` LEFT JOIN `video_attr` `attrs` ON `video`.`id`=`attrs`.`video_id` LEFT JOIN `video_category` `category` ON `video`.`category_id`=`category`.`id`

请问,我这个field已经添加了。为什么还是出的所有主表字段呢?
最佳答案
评论( 相关
后面还有条评论,点击查看>>