34 lines
736 B
PHP
34 lines
736 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");
|
|
}
|
|
|
|
/**
|
|
* 用户红包获取总额
|
|
* @param $userCode
|
|
* @return float
|
|
*/
|
|
public function getUserRedPrice($userCode)
|
|
{
|
|
return CouponBill::where("user_code",$userCode)
|
|
->sum("consumer_money");
|
|
}
|
|
|
|
} |