28 lines
		
	
	
		
			912 B
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			912 B
		
	
	
	
		
			PHP
		
	
	
| <?php
 | |
| 
 | |
| namespace app\model;
 | |
| //红包记录
 | |
| class Redpack extends Base
 | |
| {
 | |
| 
 | |
|     const userTypeDistribution = "distribution";//分销者
 | |
|     const userTypeDistributed   = "distributed";//被分销者
 | |
|     /**
 | |
|      * 获取分销红包记录
 | |
|      * @param $distributionUserCode 分销人user_code
 | |
|      * @param $couponMainId 分销的couponMain 优惠券id
 | |
|      * @param $distributedUserCode 被分销人user_code
 | |
|      * 以上三个参数就可以确定 分销数据的唯一性
 | |
|      * */
 | |
|     public static function getDistributionRedpack($distributionUserCode,$couponMainId,$distributedUserCode)
 | |
|     {
 | |
|         return self::where([
 | |
|             ["user_type","=",self::userTypeDistribution],
 | |
|             ["user_code","=",$distributionUserCode],
 | |
|             ["distributed_user_code","=",$distributedUserCode],
 | |
|             ["distributed_coupon_main_id","=",$distributedUserCode],
 | |
|         ])
 | |
|             ->find();
 | |
|     }
 | |
| }
 |