'timestamp' ]; /** * 设置优惠券绑定商品 * @param $couponId 优惠券 * @param $goods 商品列表 * @return bool */ public function setGoods($couponId,$goods){ self::where([ 'coupon_id'=>$couponId ])->delete(); if(!$goods){ return true; } $data = []; foreach ($goods as $item){ $temp = []; $temp['uniacid'] = UNIACID; $temp['coupon_id'] = $couponId; $temp['goods_id'] = $item['id']; $temp['goods_type'] = $item['type']; $data[] = $temp; } self::insertAll($data); return true; } }