Files
huangjingfen/pro_v3.5.1_副本/app/services/pay/PayServices.php
apple 434aa8c69d feat(fsgx): 完成全部24项开发任务 Phase1-7
Phase1 后端核心:
- 新增 fsgx_v1.sql 迁移脚本(is_queue_goods/frozen_points/available_points/no_assess)
- SystemConfigServices 返佣设置扩展(周期人数/分档比例/范围/时机)
- StoreOrderCreateServices 周期循环佣金计算
- StoreOrderTakeServices 佣金发放后同步冻结积分
- StoreProductServices/StoreProduct 保存 is_queue_goods

Phase2 后端接口:
- GET /api/hjf/brokerage/progress 佣金周期进度
- GET /api/hjf/assets/overview 资产总览
- HjfPointsServices 每日 frozen_points 0.4‰ 释放定时任务
- PUT /adminapi/hjf/member/{uid}/no_assess 不考核接口
- GET /adminapi/hjf/points/release_log 积分日志接口

Phase3 前端清理:
- hjfCustom.js 路由精简(仅保留 points/log)
- hjfQueue.js/hjfMember.js API 清理/重定向至 CRMEB 原生接口
- pages.json 公排→推荐佣金/佣金记录/佣金规则

Phase4-5 前端改造:
- queue/status.vue 推荐佣金进度页整体重写
- 商品详情/订单确认/支付结果页文案与逻辑改造
- 个人中心/资产页/引导页/规则页文案改造
- HjfQueueProgress/HjfRefundNotice/HjfAssetCard 组件改造
- 推广中心嵌入佣金进度摘要
- hjfMockData.js 全量更新(公排字段→佣金字段)

Phase6 Admin 增强:
- 用户列表新增 frozen_points/available_points 列及不考核操作按钮
- hjfPoints.js USE_MOCK=false 对接真实积分日志接口

Phase7 配置文档:
- docs/fsgx-phase7-config-checklist.md 后台配置与全链路验收清单

Made-with: Cursor
2026-03-23 22:32:19 +08:00

163 lines
5.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\services\pay;
use crmeb\services\AliPayService;
use crmeb\services\wechat\Payment;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use think\exception\ValidateException;
/**
* 支付统一入口
* Class PayServices
* @package app\services\pay
*/
class PayServices
{
/**
* 微信支付类型
*/
const WEIXIN_PAY = 'weixin';
/**
* 积分支付
*/
const INTEGRAL_PAY = 'integral';
/**
* 余额支付
*/
const YUE_PAY = 'yue';
/**
* 线下支付
*/
const OFFLINE_PAY = 'offline';
/**
* 支付宝
*/
const ALIPAY_PAY = 'alipay';
/**
* 现金支付
*/
const CASH_PAY = 'cash';
/**
* 支付方式
* @var string[]
*/
const PAY_TYPE = [
PayServices::WEIXIN_PAY => '微信支付',
PayServices::YUE_PAY => '余额支付',
PayServices::OFFLINE_PAY => '线下支付',
PayServices::ALIPAY_PAY => '支付宝',
PayServices::CASH_PAY => '现金支付',
PayServices::INTEGRAL_PAY => '积分支付',
];
/**
* 二维码条码值
* @var string
*/
protected string $authCode = '';
/**
* 设置二维码条码值
* @param string $authCode
* @return $this
*/
public function setAuthCode(string $authCode)
{
$this->authCode = $authCode;
return $this;
}
/**
* 发起支付
* @param string $payType
* @param string $openid
* @param string $orderId
* @param string $price
* @param string $successAction
* @param string $body
* @param bool $isCode
* @return \Alipay\EasySDK\Payment\Wap\Models\AlipayTradeWapPayResponse|array|string
* @throws InvalidArgumentException
* @throws InvalidConfigException
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws TransportExceptionInterface
*/
public function pay(string $payType, string $openid, string $orderId, string $price, string $successAction, string $body, bool $isCode = false)
{
$body = filter_emoji($body);
switch ($payType) {
case 'routine':
//微信支付从APP端请求过来
if (request()->isApp()) {
return Payment::appPay($openid, $orderId, $price, $successAction, $body);
} else {
//判断有没有打开小程序支付
if (sys_config('pay_routine_open', 0)) {
return Payment::miniPay($openid, $orderId, $price, $successAction, $body);
} else {
//开启了v3支付
if (Payment::instance()->isV3PAy) {
return Payment::instance()->payClient()->miniprogPay($openid, $orderId, $price, $body, $successAction);
}
return Payment::jsPay($openid, $orderId, $price, $successAction, $body);
}
}
case 'weixinh5':
////开启了v3支付
if (Payment::instance()->isV3PAy) {
return Payment::instance()->payClient()->h5Pay($orderId, $price, $body, $successAction);
}
//旧版v2支付
return Payment::paymentOrder(null, $orderId, $price, $successAction, $body, '', 'MWEB');
case self::WEIXIN_PAY:
//微信支付付款码支付付款码支付使用v2支付接口
if ($this->authCode) {
return Payment::microPay($this->authCode, $orderId, $price, $successAction, $body);
} else {
//微信支付从APP端请求过来
if (request()->isApp()) {
return Payment::appPay($openid, $orderId, $price, $successAction, $body);
} else {
//开启了v3支付
if (Payment::instance()->isV3PAy) {
return Payment::instance()->payClient()->jsapiPay($openid, $orderId, $price, $body, $successAction);
}
//使用v2旧版支付接口
return Payment::jsPay($openid, $orderId, $price, $successAction, $body);
}
}
case self::ALIPAY_PAY:
if ($this->authCode) {
return AliPayService::instance()->microPay($this->authCode, $body, $orderId, $price, $successAction);
} else {
return AliPayService::instance()->create($body, $orderId, $price, $successAction, $openid, $openid, $isCode);
}
case 'pc':
case 'store':
//方法内部已经做了区分v2和v3
return Payment::nativePay($openid, $orderId, $price, $successAction, $body);
default:
throw new ValidateException('支付方式不存在');
}
}
}