|
@@ -23,24 +23,27 @@ class Recharge extends Api
|
|
|
$list = Db::name('recharge_config')->field($field)->where($where)->order('id desc')->select();
|
|
|
|
|
|
|
|
|
-
|
|
|
+ if(!empty($list)){
|
|
|
$config_ids = array_column($list,'id');
|
|
|
- $gift = Db::name('recharge_gift')->alias('gift')
|
|
|
- ->field('gift.*,coupons.name,coupons.info,coupons.days')
|
|
|
- ->join('coupons','gift.coupon_id = coupons.id','LEFT')
|
|
|
- ->where('gift.config_id','IN',$config_ids)
|
|
|
- ->where('coupons.status',1)
|
|
|
+ $g = 'gift';
|
|
|
+ $c = 'coupons';
|
|
|
+ $gift = Db::name('recharge_gift')->alias($g)
|
|
|
+ ->field($g.'.config_id,'.$g.'.coupon_id,'.$g.'.number,coupons.name,coupons.info,coupons.days')
|
|
|
+ ->join($c,$c.'.id = '.$g.'.coupon_id' ,'LEFT')
|
|
|
+ ->where($g.'.config_id','IN',$config_ids)
|
|
|
+ ->where($c.'.status',1)
|
|
|
->select();
|
|
|
|
|
|
foreach($list as $key => &$val){
|
|
|
$val['gift'] = [];
|
|
|
foreach($gift as $k => $v){
|
|
|
if($val['id'] == $v['config_id']){
|
|
|
+ unset($v['config_id']);
|
|
|
$val['gift'][] = $v;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
$this->success(1,$list);
|
|
|
}
|
|
|
|