| 
									
										
										
										
											2021-11-23 17:13:55 +08: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 14:42:56 +08:00
										 |  |  |  * 签到券验证记录  各个角色的提成 | 
					
						
							| 
									
										
										
										
											2021-11-23 17:13:55 +08:00
										 |  |  |  * Class Coupon | 
					
						
							|  |  |  |  * @package app\model | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class CouponBill extends Base | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2022-03-16 14:50:01 +08: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 13:56:26 +08:00
										 |  |  |     public function couponMain() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->hasOne(CouponMain::class, 'id',"coupon_main_id"); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-11-23 17:13:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-29 13:56:26 +08: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 14:50:01 +08: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 17:13:55 +08:00
										 |  |  | } |