admin/addon/futures/event/OrderPay.php

37 lines
1.5 KiB
PHP

<?php
/**
* ThinkShop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 成都云之牛科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.cdcloudshop.com
* =========================================================
*/
namespace addon\futures\event;
use addon\futures\model\Futures;
use addon\futures\model\Forder;
use app\model\member\MemberAccount;
class OrderPay
{
// 订单完成
public function handle($param){
if($param['promotion_type'] == 'futures'){
$futures_model = new Futures();
$result = $futures_model->orderComplete($param['promotion_id'],$param['order_id']);
(new Forder())->calculate($param); //计算订单佣金
}else{
$goods_ids = model("order_goods")->getList([[ 'order_id', '=', $param[ 'order_id' ] ] ], 'goods_id');
$diamond = model("goods")->getSum([['goods_id', 'in', array_column($goods_ids,'goods_id')]], 'give_diamond');
if($diamond){
$site_id=$param['site_id'];
$member_id=$param['member_id'];
$member_account = new MemberAccount();
$member_account->addMemberAccount($site_id, $member_id, 'diamond', $diamond, 'diamond', '赠送猕猴桃', '会员购物赠送猕猴桃',$param[ 'order_id' ]);
}
}
return success();
}
}