Files
hyperf_service/app/Model/UserCoupon.php
2025-02-27 15:32:36 +08:00

52 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property int $coupon_template_id
* @property int $coupon_dispense_id
* @property int $user_id
* @property int $status
* @property string $coupon_name
* @property string $use_time
* @property string $validity_start_time
* @property string $validity_end_time
* @property string $create_time
* @property string $update_time
*/
class UserCoupon extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'user_coupon';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
protected array $guarded = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'coupon_template_id' => 'integer', 'coupon_dispense_id' => 'integer', 'user_id' => 'integer', 'status' => 'integer'];
const string CREATED_AT = 'created_time';
const string UPDATED_AT = 'updated_time';
public function getReceiveCountByUserIds(int $user_id,array $couponIdArr): array
{
return $this
->where('user_id', $user_id)
->whereIn('coupon_id', $couponIdArr)
->pluck('coupon_id')
->toArray();
}
}