第一个没问题,通过D方法实例化后的对象里是有_li
然而D方法实例化第二个表对象的时候,里面就没有_li
然后我尝试新建了一个Model,第二个表对象放进去关联查询,是可以的。。。
请问一下有没有多次查询的方法呢,百度谷歌好久没找到解决方法。。relationGet也不行
<?php
namespace Home\Model;
use Think\Model\RelationModel;
class ClientModel extends RelationModel {
// 映射字段
// protected $_map = array (
// 'signup-email' => 'email',
// 'signup-name' => 'name',
// 'signup-tel' => 'tel',
// 'signup-id' => 'idCard'
// );
protected $_link = array (
'CardType' => array (
'mapping_type' => self::HAS_ONE,
'class_name' => 'card_type',
'mapping_name' => 'card_type_id',
'foreign_key' => 'id'
),
'CardDate' => array (
'mapping_type' => self::HAS_ONE,
'class_name' => 'card_time',
'mapping_name' => 'card_date_id',
'foreign_key' => 'id'
),
'PointInfo' => array (
'mapping_type' => self::HAS_MANY,
'class_name' => 'point_type',
'mappint_name' => 'point_type_id',
'foreign_key' => 'id'
)
);
function login($client, $data) {
$where = array ();
$where ['username'] = $data ['username'];
$result = $client->relation ( true )->where ( $where )->find ();
return $result;
}
function queryCurrentUserPoint($point, $data) {
// echo var_dump ( $point );
// die ();
$where = array ();
$where ['client_id'] = $data ['client_id'];
$result = $point->where ( $where )->find (1);
$result = $point->relationGet ( 'PointInfo' );
echo var_dump ( $result );
die ();
return $result;
}
}
?>
最佳答案
