2021-11-23 09:13:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\traits;
|
|
|
|
|
|
|
|
use think\Model;
|
|
|
|
use app\model\CouponBill;
|
|
|
|
|
|
|
|
|
|
|
|
trait CouponBillTrait
|
|
|
|
{
|
2022-03-31 06:42:56 +00:00
|
|
|
//消费者 验证签到券获得的红包总数
|
2021-11-23 09:13:55 +00:00
|
|
|
public function consumerCouponBillTotal($userCode)
|
|
|
|
{
|
|
|
|
return CouponBill::where("user_code",$userCode)->sum("consumer_money");
|
|
|
|
}
|
|
|
|
|
2021-11-30 07:26:38 +00:00
|
|
|
//商家 提供的总收益数
|
|
|
|
public function businessProfitTotal($businessCode)
|
|
|
|
{
|
|
|
|
return CouponBill::where("business_code",$businessCode)->sum("admin_money");
|
|
|
|
}
|
2021-11-23 09:13:55 +00:00
|
|
|
|
2021-12-17 06:44:05 +00:00
|
|
|
/**
|
|
|
|
* 用户红包获取总额
|
|
|
|
* @param $userCode
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public function getUserRedPrice($userCode)
|
|
|
|
{
|
|
|
|
return CouponBill::where("user_code",$userCode)
|
|
|
|
->sum("consumer_money");
|
|
|
|
}
|
|
|
|
|
2021-11-23 09:13:55 +00:00
|
|
|
}
|