coupon-admin/app/model/CouponBill.php

46 lines
1.3 KiB
PHP
Raw Normal View History

2021-11-23 09:13:55 +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-23 09:13:55 +00:00
* Class Coupon
* @package app\model
*/
class CouponBill extends Base
{
2022-03-16 06:50:01 +00:00
public const agency_money = "agency_money";//渠道商的流水字段
public const admin_money = "admin_money";//平台的流水字段
public const consumer_money = "consumer_money";//消费者的流水字段
public const distribution_money_money = "distribution_money";//分销者的流水字段
2021-11-29 05:56:26 +00:00
public function couponMain()
{
return $this->hasOne(CouponMain::class, 'id',"coupon_main_id");
}
2021-11-23 09:13:55 +00:00
2021-11-29 05:56:26 +00:00
public function business()
{
return $this->hasOne(Business::class, 'code',"business_code");
}
public function account()
{
return $this->hasOne(Account::class, 'user_code',"user_code");
}
2022-03-16 06:50:01 +00:00
public static function getUserOne($userCode,$couponMainId,$couponId)
{
return self::where(
[
["user_code","=",$userCode],
["coupon_main_id","=",$couponMainId],
["coupon_id","=",$couponId],
]
)->find();
}
2021-11-23 09:13:55 +00:00
}