$baseGoodIds_arr = [1,2,3,4,5,6,7,8,9];
$relate_gimgs = D('GoodsImages')->where(['good_id' => ['in',$baseGoodIds_arr]])->limit($gimgs_limit)->group('weight')->select();
dump($relate_gimgs);
weight 字段去重复
array(4) {
[0] => array(5) {
["id"] => string(2) "12"
["good_id"] => string(1) "7"
["resource_name"] => string(23) "1536291421397879873.png"
["weight"] => string(1) "0"
["create_time"] => string(10) "1536291421"
}
[1] => array(5) {
["id"] => string(1) "1"
["good_id"] => string(1) "1"
["resource_name"] => string(22) "153628483559948187.png"
["weight"] => string(1) "1"
["create_time"] => string(10) "1536284870"
}
[2] => array(5) {
["id"] => string(2) "13"
["good_id"] => string(1) "8"
["resource_name"] => string(24) "15362918002142249103.png"
["weight"] => string(7) "136155
"
["create_time"] => string(10) "1536291800"
}
[3] => array(5) {
["id"] => string(1) "8"
["good_id"] => string(1) "6"
["resource_name"] => string(24) "15362922181586297198.png"
["weight"] => string(7) "194794
"
["create_time"] => string(10) "1536292218"
}
}