This commit is contained in:
2022-01-19 16:13:18 +08:00
parent de87c20c06
commit 6c68519b4c

View File

@@ -4,12 +4,11 @@ namespace App\Models;
use App\Models\Traits\BelongsToOutlet;
use App\Models\Traits\BelongsToUser;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
class Coupon extends Model
{
use BelongsToUser, BelongsToOutlet,Cachable;
use BelongsToUser, BelongsToOutlet;
protected $dates = [
'paid_at',
@@ -64,8 +63,9 @@ class Coupon extends Model
/**
* 是否可以分润
* @author 玄尘 2020-03-13
*
* @return bool [type] [description]
* @author 玄尘 2020-03-13
*/
public function canProfit()
{
@@ -74,13 +74,14 @@ class Coupon extends Model
/**
* 分润
* @author 玄尘 2020-03-13
*
* @return bool|string [type] [description]
* @author 玄尘 2020-03-13
*/
public function profit()
{
$log = AccountLog::where('source->coupon_id', $this->id)->first();
if (!$log && $this->user && $this->profit) {
if (! $log && $this->user && $this->profit) {
return $this->user->account->rule('freeze', $this->profit, false, [
'coupon_id' => $this->id,
'redemptionCode' => $this->redemptionCode,
@@ -94,6 +95,7 @@ class Coupon extends Model
/**
* Notes: 撤销
*
* @Author: 玄尘
* @Date : 2020/10/12 13:56
*/
@@ -115,6 +117,7 @@ class Coupon extends Model
/**
* Notes: 撤销分润
*
* @Author: 玄尘
* @Date : 2020/10/9 14:07
*/
@@ -133,8 +136,9 @@ class Coupon extends Model
/**
* 打款
* @author 玄尘 2020-03-13
*
* @return bool|string [type] [description]
* @author 玄尘 2020-03-13
*/
public function sendMoney()
{
@@ -161,6 +165,7 @@ class Coupon extends Model
/**
* Notes: 格式化时间 年-月-日
*
* @Author: 玄尘
* @Date : 2020/4/7 16:24
* @return mixed