| 
									
										
										
										
											2021-11-23 17:13:55 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace app\traits; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use think\Model; | 
					
						
							|  |  |  | use app\model\CouponBill; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | trait CouponBillTrait | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     //消费者  验证优惠券获得的红包总数
 | 
					
						
							|  |  |  |     public function consumerCouponBillTotal($userCode) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return CouponBill::where("user_code",$userCode)->sum("consumer_money"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-30 15:26:38 +08:00
										 |  |  |     //商家 提供的总收益数
 | 
					
						
							|  |  |  |     public function businessProfitTotal($businessCode) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return CouponBill::where("business_code",$businessCode)->sum("admin_money"); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-11-23 17:13:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | } |