初始版本

This commit is contained in:
贾祥聪
2025-08-19 14:16:51 +08:00
commit f937a1f9b9
4373 changed files with 359728 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
<?php
// +----------------------------------------------------------------------
// | LikeShop100%开源免费商用电商系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | 商业版本务必购买商业授权,以免引起法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | Gitee下载https://gitee.com/likeshop_gitee/likeshop
// | 访问官网https://www.likemarket.net
// | 访问社区https://home.likemarket.net
// | 访问手册http://doc.likemarket.net
// | 微信公众号:好象科技
// | 好象科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | Author: LikeShopTeam
// +----------------------------------------------------------------------
namespace app\common\logic;
use app\common\enum\accountLog\ShopAccountLogEnum;
use app\common\enum\PayEnum;
use app\common\model\accountLog\ShopAccountLog;
use app\common\model\deposit\DepositOrder;
use app\common\model\shop\Shop;
use think\facade\Db;
use think\facade\Log;
/**
* 支付成功后处理订单状态
* Class PayNotifyLogic
* @package app\api\logic
*/
class ShopPayNotifyLogic extends BaseLogic
{
public static function handle($action, $orderSn, $extra = [])
{
Db::startTrans();
try {
self::$action($orderSn, $extra);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
Log::write(implode('-', [
__CLASS__,
__FUNCTION__,
$e->getFile(),
$e->getLine(),
$e->getMessage()
]));
self::setError($e->getMessage());
return $e->getMessage();
}
}
private static function deposit($orderSn, $extra = []){
$order = DepositOrder::where('sn', $orderSn)->findOrEmpty()->toArray();
// 增加用户累计充值金额及用户余额
Shop::update([
'deposit' => ['inc',$order['order_amount']],
],['id'=>$order['relation_id']]);
// 记录账户流水
ShopAccountLogLogic::add($order['relation_id'], ShopAccountLogEnum::DEPOSIT,ShopAccountLogEnum::RECHARGE_INC_DEPOSIT,ShopAccountLogEnum::INC, $order['order_amount'], $order['sn']);
// 更新充值订单状态
DepositOrder::update([
'transaction_id' => $extra['transaction_id'] ?? '',
'pay_status' => PayEnum::ISPAID,
'pay_time' => time(),
],['id'=>$order['id']]);
}
}