You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/api/service/bargain/order/PaySuccess.php

51 lines
1.7 KiB

<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\api\service\bargain\order;
use app\api\model\bargain\Task as TaskModel;
use app\api\model\bargain\Active as ActiveModel;
use app\common\service\BaseService;
/**
* 砍价订单支付成功后的回调
* Class PaySuccess
* @package app\api\service\bargain\order
*/
class PaySuccess extends BaseService
{
/**
* 回调方法
* @param $order
* @return bool
*/
public function onPaySuccess($order): bool
{
// 砍价任务详情
$task = TaskModel::detail($order['order_source_id']);
if (empty($task)) {
$this->error = '未找到砍价任务信息';
return false;
}
// 标记为已购买
$task->setIsBuy();
// 砍价活动详情
$active = ActiveModel::detail($task['active_id']);
if (empty($active)) {
$this->error = '未找到砍价活动信息';
return false;
}
// 累计活动销量
$active->setIncSales();
return true;
}
}