| 
									
										
										
										
											2021-12-13 19:09:16 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace app\model; | 
					
						
							|  |  |  | //红包记录
 | 
					
						
							|  |  |  | class Redpack extends Base | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-15 15:10:41 +08:00
										 |  |  |     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(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-12-13 19:09:16 +08:00
										 |  |  | } |