新增双向增值

This commit is contained in:
sunday 2023-11-20 09:22:46 +08:00
parent 54b3180612
commit ae21b0eb42
6 changed files with 19 additions and 18 deletions

View File

@ -163,12 +163,8 @@ class PluginApplication extends \app\common\services\PluginApplication{
public function boot(){ public function boot(){
$events = app('events'); $events = app('events');
// 订单支付成功 // 订单支付成功
$events->subscribe(OrderPaidListener::class); $events->subscribe(OrderPaidListener::class);
} }
public function cronConfig(){ public function cronConfig(){

View File

@ -15,7 +15,7 @@ class FundController extends BaseController
// $result =(new CulturalSpace())->GiveGoodsFundMoney(22,93); // $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'); // $set = Setting::get('plugin.cultural_space_set');
// $result =(new CulturalSpace())->capitalIncrease($set); // $result =(new CulturalSpace())->capitalIncrease($set);

View File

@ -7,7 +7,6 @@ use app\common\events\order\AfterOrderPaidEvent;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Yunshop\CulturalSpace\models\CulturalSpace; use Yunshop\CulturalSpace\models\CulturalSpace;
use Yunshop\CulturalSpace\models\CulturalFund;
class OrderPaidListener{ class OrderPaidListener{
use DispatchesJobs; use DispatchesJobs;
@ -15,10 +14,14 @@ class OrderPaidListener{
$events->listen(AfterOrderPaidEvent::class, self::class . '@handle'); $events->listen(AfterOrderPaidEvent::class, self::class . '@handle');
} }
public function handle(AfterOrderPaidEvent $event){ public function handle(AfterOrderPaidEvent $event){
date_default_timezone_set("PRC"); try {
$model = $event->getOrderModel(); $model = $event->getOrderModel();
// 订单支付成功奖励贡献值 // 订单支付成功奖励贡献值
(new CulturalSpace())->buyGoodsGiveContribution($model->uid,$model->id); $CulturalSpace=new CulturalSpace();
(new CulturalSpace())->GiveGoodsFundMoney($model->uid,$model->id); $CulturalSpace->buyGoodsGiveContribution($model->uid,$model->id);
$CulturalSpace->GiveGoodsFundMoney($model->uid,$model->id);
}catch (\Exception $e){
\Log::debug('--- 文创空间 - 错误订阅事件---'.$e->getMessage());
}
} }
} }

View File

@ -19,15 +19,17 @@ class CulturalFund extends BaseModel
$set = Setting::get('plugin.cultural_space_set'); $set = Setting::get('plugin.cultural_space_set');
$result=[ $result=[
'uniacid'=>\YunShop::app()->uniacid, 'uniacid'=>\YunShop::app()->uniacid,
'last_fee'=>$set['fund_start_price'], 'last_fee'=>$set['fund_start_price']??0,
'current_fee'=>$set['fund_start_price'], 'current_fee'=>$set['fund_start_price']??0,
'fund_money'=>0, 'fund_money'=>0,
'voucher_number'=>0, 'voucher_number'=>0,
'history_number'=>0, 'history_number'=>0,
'created_at'=>time(), 'created_at'=>time(),
'updated_at'=>time() 'updated_at'=>time()
]; ];
self::insert($result); if($result['last_fee']!=0){
self::insert($result);
}
} }
return $result; return $result;
} }

View File

@ -132,7 +132,7 @@ class CulturalSpace extends BaseModel
DB::beginTransaction(); DB::beginTransaction();
try { try {
$set = Setting::get('plugin.cultural_space_set'); $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 && 获取订单商品信息 // 获取直推上级id && 获取订单商品信息
$orderGoodsList = $this->getGoodsModel($orderId) $orderGoodsList = $this->getGoodsModel($orderId)
->where('yz_goods_cultural_space.is_fund_open', 1) ->where('yz_goods_cultural_space.is_fund_open', 1)

View File

@ -65,11 +65,11 @@
<el-col :span="4"> <el-col :span="4">
<div class="grid-content bg-purple">基金总数:[[fundData.fund_money || 0]]</div> <div class="grid-content bg-purple">基金总数:[[fundData.fund_money || 0]]</div>
</el-col> </el-col>
<el-col :span="4"><div class="grid-content bg-purple-light">凭证总数:[[fundData.voucher_number || 0]]</div></el-col> <el-col :span="4"><div class="grid-content bg-purple-light">文创豆总数:[[fundData.voucher_number || 0]]</div></el-col>
<el-col :span="4"><div class="grid-content bg-purple">当前价值:[[fundData.current_fee || 0]]</div></el-col> <el-col :span="4"><div class="grid-content bg-purple">当前价值:[[fundData.current_fee || 0]]</div></el-col>
<el-col :span="4"><div class="grid-content bg-purple-light">上次价值:[[fundData.last_fee || 0]]</div></el-col> <el-col :span="4"><div class="grid-content bg-purple-light">上次价值:[[fundData.last_fee || 0]]</div></el-col>
<el-col :span="4"><div class="grid-content bg-purple-light">历史基金:[[fundData.history_fund_money || 0]]</div></el-col> <el-col :span="4"><div class="grid-content bg-purple-light">历史基金:[[fundData.history_fund_money || 0]]</div></el-col>
<el-col :span="4"><div class="grid-content bg-purple-light">历史凭证[[fundData.history_number || 0]]</div></el-col> <el-col :span="4"><div class="grid-content bg-purple-light">历史文创豆[[fundData.history_number || 0]]</div></el-col>
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="明细" name="show_group"> <el-tab-pane label="明细" name="show_group">
@ -100,7 +100,7 @@
</el-table-column> </el-table-column>
<el-table-column align="center" prop="pay_money" label="订单金额"></el-table-column> <el-table-column align="center" prop="pay_money" label="订单金额"></el-table-column>
<el-table-column align="center" prop="fund_money" label="入账基金"></el-table-column> <el-table-column align="center" prop="fund_money" label="入账基金"></el-table-column>
<el-table-column align="center" prop="voucher_number" label="用户凭证"> </el-table-column> <el-table-column align="center" prop="voucher_number" label="用户文创豆"> </el-table-column>
<el-table-column align="center" prop="created_at" label="创建时间"> </el-table-column> <el-table-column align="center" prop="created_at" label="创建时间"> </el-table-column>
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>