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