2021-12-13 11:09:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\model;
|
|
|
|
//红包记录
|
|
|
|
class Redpack extends Base
|
|
|
|
{
|
|
|
|
|
2022-03-28 11:34:35 +00:00
|
|
|
public const userTypeDistribution = "distribution";//分销者
|
|
|
|
public const userTypeDistributed = "distributed";//被分销者
|
|
|
|
public const userTypeAgency = "agency"; // 渠道商
|
2022-03-15 07:10:41 +00:00
|
|
|
/**
|
|
|
|
* 获取分销红包记录
|
2022-03-28 11:34:35 +00:00
|
|
|
* @param string $userType 红包获取人的角色
|
|
|
|
* @param string $distributionUserCode 分销人/渠道商/被分销者 user_code
|
2022-03-31 06:42:56 +00:00
|
|
|
* @param mixed $couponMainId 分销的couponMain 签到券id
|
2022-03-15 07:10:41 +00:00
|
|
|
* 以上三个参数就可以确定 分销数据的唯一性
|
|
|
|
* */
|
2022-03-28 11:34:35 +00:00
|
|
|
public static function getDistributionRedpack($userType,$distributionUserCode,$couponMainId)
|
2022-03-15 07:10:41 +00:00
|
|
|
{
|
|
|
|
return self::where([
|
2022-03-28 11:34:35 +00:00
|
|
|
["user_type","=",$userType],
|
2022-03-15 07:10:41 +00:00
|
|
|
["user_code","=",$distributionUserCode],
|
2022-03-28 11:34:35 +00:00
|
|
|
["coupon_id","=",$couponMainId],
|
2022-03-15 07:10:41 +00:00
|
|
|
])
|
|
|
|
->find();
|
|
|
|
}
|
2021-12-13 11:09:16 +00:00
|
|
|
}
|