新增双向增值

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(){
$events = app('events');
// 订单支付成功
$events->subscribe(OrderPaidListener::class);
}
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(33,96);
// $set = Setting::get('plugin.cultural_space_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\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());
}
}
}

View File

@ -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;
}

View File

@ -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)

View File

@ -65,11 +65,11 @@
<el-col :span="4">
<div class="grid-content bg-purple">基金总数:[[fundData.fund_money || 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-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-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_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-tab-pane>
<el-tab-pane label="明细" name="show_group">
@ -100,7 +100,7 @@
</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="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>
</el-tab-pane>