优惠券小程序

Goods.php 686B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Goods extends Model
  6. {
  7. use HasFactory;
  8. protected $table = 'goods';
  9. public $timestamps = false;
  10. protected static $unguarded = true;
  11. /**
  12. * 根据商品id获取商品
  13. * */
  14. public static function getGoodsListByItemIds($itemIds)
  15. {
  16. return self::selectRaw("item_id, short_title as item_short_title, coupon_amount as coupon_money, coupon_end_time, reserve_price, zk_final_price, pict_url as item_pic, title as item_title")
  17. ->where('enable', 1)->whereIn('item_id', $itemIds)
  18. ->get();
  19. }
  20. }