23 lines
490 B
PHP
23 lines
490 B
PHP
<?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");
|
|
}
|
|
|
|
//商家 提供的总收益数
|
|
public function businessProfitTotal($businessCode)
|
|
{
|
|
return CouponBill::where("business_code",$businessCode)->sum("admin_money");
|
|
}
|
|
|
|
} |