tp3.2 and or的复合查询
$where['user_id'] = $user_id;
$where['buy_id'] = $user_id;
$where['_logic'] = 'or';
$map['_complex'] = $where;
$map['trade_type'] ='1';
$map['status'] = array('gt',0);
$marketdata = M('Market')->where($map)->select();
echo M()->_sql();
原生语句就是
SELECT * FROM `erj_market` WHERE ( `user_id` = '13' OR `buy_id` = '13' ) AND `trade_type` = 1 AND `status` > 0
世界上最美的风景,是自己努力的模样