diff --git a/plugins/cultural-space/src/PluginApplication.php b/plugins/cultural-space/src/PluginApplication.php index 948a086d..3fbecf60 100644 --- a/plugins/cultural-space/src/PluginApplication.php +++ b/plugins/cultural-space/src/PluginApplication.php @@ -163,12 +163,8 @@ class PluginApplication extends \app\common\services\PluginApplication{ public function boot(){ $events = app('events'); - // 订单支付成功 $events->subscribe(OrderPaidListener::class); - - - } public function cronConfig(){ diff --git a/plugins/cultural-space/src/admin/FundController.php b/plugins/cultural-space/src/admin/FundController.php index 7add904d..2c7bfcfc 100644 --- a/plugins/cultural-space/src/admin/FundController.php +++ b/plugins/cultural-space/src/admin/FundController.php @@ -15,7 +15,7 @@ class FundController extends BaseController // $result =(new CulturalSpace())->GiveGoodsFundMoney(22,93); // } - $result =(new CulturalSpace())->GiveGoodsFundMoney(22,93); + $result =(new CulturalSpace())->GiveGoodsFundMoney(33,96); // $set = Setting::get('plugin.cultural_space_set'); // $result =(new CulturalSpace())->capitalIncrease($set); diff --git a/plugins/cultural-space/src/listener/OrderPaidListener.php b/plugins/cultural-space/src/listener/OrderPaidListener.php index b8e90ce7..9534edb1 100644 --- a/plugins/cultural-space/src/listener/OrderPaidListener.php +++ b/plugins/cultural-space/src/listener/OrderPaidListener.php @@ -7,7 +7,6 @@ use app\common\events\order\AfterOrderPaidEvent; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Foundation\Bus\DispatchesJobs; use Yunshop\CulturalSpace\models\CulturalSpace; -use Yunshop\CulturalSpace\models\CulturalFund; class OrderPaidListener{ use DispatchesJobs; @@ -15,10 +14,14 @@ class OrderPaidListener{ $events->listen(AfterOrderPaidEvent::class, self::class . '@handle'); } public function handle(AfterOrderPaidEvent $event){ - date_default_timezone_set("PRC"); - $model = $event->getOrderModel(); - // 订单支付成功奖励贡献值 - (new CulturalSpace())->buyGoodsGiveContribution($model->uid,$model->id); - (new CulturalSpace())->GiveGoodsFundMoney($model->uid,$model->id); + try { + $model = $event->getOrderModel(); + // 订单支付成功奖励贡献值 + $CulturalSpace=new CulturalSpace(); + $CulturalSpace->buyGoodsGiveContribution($model->uid,$model->id); + $CulturalSpace->GiveGoodsFundMoney($model->uid,$model->id); + }catch (\Exception $e){ + \Log::debug('--- 文创空间 - 错误订阅事件---'.$e->getMessage()); + } } } diff --git a/plugins/cultural-space/src/models/CulturalFund.php b/plugins/cultural-space/src/models/CulturalFund.php index 6484f4b3..33005ae1 100644 --- a/plugins/cultural-space/src/models/CulturalFund.php +++ b/plugins/cultural-space/src/models/CulturalFund.php @@ -19,15 +19,17 @@ class CulturalFund extends BaseModel $set = Setting::get('plugin.cultural_space_set'); $result=[ 'uniacid'=>\YunShop::app()->uniacid, - 'last_fee'=>$set['fund_start_price'], - 'current_fee'=>$set['fund_start_price'], + 'last_fee'=>$set['fund_start_price']??0, + 'current_fee'=>$set['fund_start_price']??0, 'fund_money'=>0, 'voucher_number'=>0, 'history_number'=>0, 'created_at'=>time(), 'updated_at'=>time() ]; - self::insert($result); + if($result['last_fee']!=0){ + self::insert($result); + } } return $result; } diff --git a/plugins/cultural-space/src/models/CulturalSpace.php b/plugins/cultural-space/src/models/CulturalSpace.php index e0c15358..b9898a24 100644 --- a/plugins/cultural-space/src/models/CulturalSpace.php +++ b/plugins/cultural-space/src/models/CulturalSpace.php @@ -132,7 +132,7 @@ class CulturalSpace extends BaseModel DB::beginTransaction(); try { $set = Setting::get('plugin.cultural_space_set'); - if ($set['is_fund_open'] == 1) { + if (isset($set['is_fund_open'])&&$set['is_fund_open'] == 1) { // 获取直推上级id && 获取订单商品信息 $orderGoodsList = $this->getGoodsModel($orderId) ->where('yz_goods_cultural_space.is_fund_open', 1) diff --git a/plugins/cultural-space/views/fund/index.blade.php b/plugins/cultural-space/views/fund/index.blade.php index 4619a6e6..ab55c40c 100644 --- a/plugins/cultural-space/views/fund/index.blade.php +++ b/plugins/cultural-space/views/fund/index.blade.php @@ -65,11 +65,11 @@
基金总数:[[fundData.fund_money || 0]]
-
凭证总数:[[fundData.voucher_number || 0]]
+
文创豆总数:[[fundData.voucher_number || 0]]
当前价值:[[fundData.current_fee || 0]]
上次价值:[[fundData.last_fee || 0]]
历史基金:[[fundData.history_fund_money || 0]]
-
历史凭证:[[fundData.history_number || 0]]
+
历史文创豆:[[fundData.history_number || 0]]
@@ -100,7 +100,7 @@ - +