coupon-admin/app/model/Coupon.php

52 lines
1.2 KiB
PHP
Raw Normal View History

2021-11-18 09:57:04 +00:00
<?php
namespace app\model;
use think\Collection;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
2022-03-31 06:42:56 +00:00
* 签到券
2021-11-18 09:57:04 +00:00
* Class Coupon
* @package app\model
*/
class Coupon extends Base
{
//是否验证
2022-02-08 02:18:44 +00:00
const is_verificated_on = 1;//1已验证
const is_verificated_off = 0;//0未验证
const status_success = 0;//未过期未使用
const status_used = 1;//已使用
2022-02-08 02:27:50 +00:00
const status_be_overdue = 2;//已过期
2021-11-23 09:13:55 +00:00
public function couponBill()
{
return $this->hasOne(CouponBill::class,"coupon_id","id");
}
2021-11-24 08:34:56 +00:00
public function account()
{
return $this->hasOne(Account::class,"user_code","consumer_code");
}
public function business()
{
return $this->hasOne(Business::class,"code","business_code");
}
public function couponMain()
{
return $this->hasOne(CouponMain::class, 'id', 'coupon_id');
}
2021-12-08 10:15:47 +00:00
public function scoreModel()
{
return $this->hasOne(Score::class, 'coupon_id', 'id');
}
2021-12-14 09:34:27 +00:00
public function redpack()
{
return $this->hasOne(Redpack::class, 'coupon_id', 'id');
}
2021-11-18 09:57:04 +00:00
}