settter
parent
868df6b698
commit
facc41cc92
|
@ -182,7 +182,8 @@ class User extends Base
|
||||||
'balance' => $account['business']['balance'],
|
'balance' => $account['business']['balance'],
|
||||||
'enable' => $account['business']['enable'],
|
'enable' => $account['business']['enable'],
|
||||||
],
|
],
|
||||||
"alertMoney"=>config("wechat.balance")
|
"alertMoney"=>config("wechat.balance"),
|
||||||
|
"redPrice"=>CouponRepository::getInstance()->getUserRedPrice( $account['user_code']),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->json(0, 'success', $businessRes);
|
return $this->json(0, 'success', $businessRes);
|
||||||
|
@ -195,7 +196,9 @@ class User extends Base
|
||||||
'userType' => $account['type'],
|
'userType' => $account['type'],
|
||||||
'userTypeDes' => Account::accountTypeDescList()[$account['type']] ?? '游客',
|
'userTypeDes' => Account::accountTypeDescList()[$account['type']] ?? '游客',
|
||||||
'couponCount' => $couponCount,
|
'couponCount' => $couponCount,
|
||||||
"alertMoney"=>config("wechat.balance")
|
"alertMoney"=>config("wechat.balance"),
|
||||||
|
"redPrice"=>CouponRepository::getInstance()->getUserRedPrice( $account['user_code']),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use app\model\CouponMain;
|
||||||
use app\model\CouponType;
|
use app\model\CouponType;
|
||||||
use app\model\UsingRule;
|
use app\model\UsingRule;
|
||||||
use app\service\Repository;
|
use app\service\Repository;
|
||||||
|
use app\traits\CouponBillTrait;
|
||||||
use app\traits\CouponMainTrait;
|
use app\traits\CouponMainTrait;
|
||||||
use Exception;
|
use Exception;
|
||||||
use think\Collection;
|
use think\Collection;
|
||||||
|
@ -25,6 +26,7 @@ use think\Model;
|
||||||
class CouponRepository extends Repository
|
class CouponRepository extends Repository
|
||||||
{
|
{
|
||||||
use CouponMainTrait;
|
use CouponMainTrait;
|
||||||
|
use CouponBillTrait;
|
||||||
/**
|
/**
|
||||||
* 优惠券持有信息列表
|
* 优惠券持有信息列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,4 +20,15 @@ trait CouponBillTrait
|
||||||
return CouponBill::where("business_code",$businessCode)->sum("admin_money");
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue