Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev

This commit is contained in:
From-wh 2023-03-24 14:56:27 +08:00
commit e62700aa83
11 changed files with 61 additions and 35 deletions

View File

@ -36,6 +36,9 @@ class UserRechargeController
* 用户充值
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function recharge(Request $request)
{

View File

@ -679,6 +679,7 @@ class StoreCartServices extends BaseServices
* @param $num
* @param $new
* @return bool
* @throws \ReflectionException
*/
public function checkLimit($uid, $product_id, $num, $new)
{
@ -701,8 +702,8 @@ class StoreCartServices extends BaseServices
}
} else if ($limitInfo['limit_type'] == 2) {
$cartNum = $this->dao->sum(['uid' => $uid, 'product_id' => $product_id], 'cart_num');
$orderPayNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id], 'cart_num');
$orderRefundNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id], 'refund_num');
$orderPayNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id, 'pid' => 0], 'cart_num');
$orderRefundNum = $orderCartServices->sum(['uid' => $uid, 'product_id' => $product_id, 'pid' => 0], 'refund_num');
$orderNum = $orderPayNum - $orderRefundNum;
if (($num + $orderNum + $cartNum) > $limitInfo['limit_num']) {
throw new ApiException(410240, ['limit' => $limitInfo['limit_num'], 'pay_num' => $orderNum]);

View File

@ -435,9 +435,9 @@ class StoreOrderRefundServices extends BaseServices
$res = true;
//回退优惠卷 拆分子订单不退优惠券
if (!$order['pid'] && $order['coupon_id'] && $order['coupon_price']) {
/** @var StoreCouponUserServices $coumonUserServices */
$coumonUserServices = app()->make(StoreCouponUserServices::class);
$res = $res && $coumonUserServices->recoverCoupon((int)$order['coupon_id']);
/** @var StoreCouponUserServices $couponUserServices */
$couponUserServices = app()->make(StoreCouponUserServices::class);
$res = $couponUserServices->recoverCoupon((int)$order['coupon_id']);
$statusService->save([
'oid' => $order['id'],
'change_type' => 'coupon_back',

View File

@ -26,7 +26,10 @@ class PayNotifyServices
/**
* 订单支付成功之后
* @param string|null $order_id 订单id
* @param string|null $trade_no
* @param string $payType
* @return bool
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function wechatProduct(string $order_id = null, string $trade_no = null, string $payType = PayServices::WEIXIN_PAY)
{

View File

@ -40,6 +40,9 @@ class PayServices
//好友代付
const FRIEND = 'friend';
//银行转账
const BANK = 'bank';
//支付方式
const PAY_TYPE = [
PayServices::WEIXIN_PAY => '微信支付',
@ -47,7 +50,8 @@ class PayServices
PayServices::OFFLINE_PAY => '线下支付',
PayServices::ALIAPY_PAY => '支付宝',
PayServices::FRIEND => '好友代付',
PayServices::ALLIN_PAY => '通联支付'
PayServices::ALLIN_PAY => '通联支付',
PayServices::BANK => '银行转账',
];
/**

View File

@ -104,6 +104,9 @@ class CapitalFlowServices extends BaseServices
* 获取资金流水
* @param $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getFlowList($where)
{

View File

@ -104,11 +104,8 @@ class UserRechargeServices extends BaseServices
foreach ($list as &$item) {
switch ($item['recharge_type']) {
case 'routine':
$item['_recharge_type'] = '小程序充值';
break;
case PayServices::WEIXIN_PAY:
$item['_recharge_type'] = '公众号充值';
$item['_recharge_type'] = '微信充值';
break;
case 'system':
$item['_recharge_type'] = '系统充值';
@ -138,8 +135,8 @@ class UserRechargeServices extends BaseServices
$data = [];
$data['sumPrice'] = $this->getRechargeSum($where, 'price');
$data['sumRefundPrice'] = $this->getRechargeSum($where, 'refund_price');
$where['recharge_type'] = 'routine';
$data['sumRoutinePrice'] = $this->getRechargeSum($where, 'price');
$where['recharge_type'] = 'alipay';
$data['sumAlipayPrice'] = $this->getRechargeSum($where, 'price');
$where['recharge_type'] = 'weixin';
$data['sumWeixinPrice'] = $this->getRechargeSum($where, 'price');
return [
@ -158,14 +155,14 @@ class UserRechargeServices extends BaseServices
'col' => 6,
],
[
'name' => '小程序充值金额',
'name' => '支付宝充值金额',
'field' => '元',
'count' => $data['sumRoutinePrice'],
'count' => $data['sumAlipayPrice'],
'className' => 'logo-bitcoin',
'col' => 6,
],
[
'name' => '公众号充值金额',
'name' => '微信充值金额',
'field' => '元',
'count' => $data['sumWeixinPrice'],
'className' => 'ios-bicycle',
@ -174,9 +171,14 @@ class UserRechargeServices extends BaseServices
];
}
/**退款表单
* @param $id
* @return mixed|void
/**
* 退款表单
* @param int $id
* @return array
* @throws \FormBuilder\Exception\FormBuilderException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/03/24
*/
public function refund_edit(int $id)
{
@ -196,15 +198,17 @@ class UserRechargeServices extends BaseServices
$f = array();
$f[] = Form::input('order_id', '退款单号', $UserRecharge->getData('order_id'))->disabled(true);
$f[] = Form::radio('refund_price', '状态', 1)->options([['label' => '本金(扣赠送余额)', 'value' => 1], ['label' => '仅本金', 'value' => 0]]);
// $f[] = Form::number('refund_price', '退款金额', (float)$UserRecharge->getData('price'))->precision(2)->min(0)->max($UserRecharge->getData('price'));
return create_form('编辑', $f, Url::buildUrl('/finance/recharge/' . $id), 'PUT');
}
/**
* 退款操作
* @param int $id
* @param $refund_price
* @param string $refund_price
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function refund_update(int $id, string $refund_price)
{
@ -314,6 +318,9 @@ class UserRechargeServices extends BaseServices
* @param int $uid
* @param $price
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function importNowMoney(int $uid, $price)
{
@ -340,7 +347,7 @@ class UserRechargeServices extends BaseServices
//写入充值记录
$rechargeInfo = [
'uid' => $uid,
'order_id' => $this->getOrderId(),
'order_id' => app()->make(StoreOrderCreateServices::class)->getNewOrderId('cz'),
'recharge_type' => 'balance',
'price' => $price,
'give_price' => 0,
@ -381,7 +388,15 @@ class UserRechargeServices extends BaseServices
/**
* 申请充值
* @param int $uid
* @param $price
* @param $recharId
* @param $type
* @param $from
* @param bool $renten
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function recharge(int $uid, $price, $recharId, $type, $from, bool $renten = false)
{
@ -437,8 +452,13 @@ class UserRechargeServices extends BaseServices
}
/**
* //TODO用户充值成功后
* 用户充值成功后
* @param $orderId
* @param array $other
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function rechargeSuccess($orderId, array $other = [])
{
@ -475,8 +495,12 @@ class UserRechargeServices extends BaseServices
return true;
}
/**根据查询用户充值金额
/**
* 根据查询用户充值金额
* @param array $where
* @param string $rechargeSumField
* @param string $selectType
* @param string $group
* @return float|int
*/
public function getRechargeMoneyByWhere(array $where, string $rechargeSumField, string $selectType, string $group = "")

View File

@ -13,14 +13,12 @@ namespace crmeb\services;
use Alipay\EasySDK\Payment\Wap\Models\AlipayTradeWapPayResponse;
use app\services\pay\PayServices;
use crmeb\utils\Hook;
use think\facade\Event;
use think\facade\Log;
use think\facade\Route as Url;
use Alipay\EasySDK\Kernel\Config;
use Alipay\EasySDK\Kernel\Factory;
use crmeb\exceptions\PayException;
use app\services\pay\PayNotifyServices;
use Alipay\EasySDK\Kernel\Util\ResponseChecker;
/**

View File

@ -12,12 +12,10 @@
namespace crmeb\services\app;
use app\services\message\wechat\MessageServices;
use app\services\order\StoreOrderServices;
use app\services\pay\PayServices;
use app\services\wechat\WechatMessageServices;
use app\services\wechat\WechatReplyServices;
use crmeb\exceptions\AdminException;
use app\services\pay\PayNotifyServices;
use crmeb\exceptions\ApiException;
use crmeb\services\easywechat\Application;
use EasyWeChat\Message\Article;
@ -33,7 +31,6 @@ use Symfony\Component\HttpFoundation\Request;
use think\facade\Event;
use think\facade\Log;
use think\Response;
use crmeb\utils\Hook;
use think\facade\Cache;
use crmeb\services\SystemConfigService;

View File

@ -13,14 +13,11 @@
namespace crmeb\services\pay\storage;
use app\services\pay\PayNotifyServices;
use app\services\pay\PayServices;
use crmeb\exceptions\PayException;
use crmeb\services\pay\BasePay;
use crmeb\services\pay\PayInterface;
use crmeb\services\pay\extend\allinpay\AllinPay as AllinPayService;
use crmeb\utils\Hook;
use EasyWeChat\Payment\Order;
use think\facade\Event;

View File

@ -13,18 +13,14 @@
namespace crmeb\services\pay\storage;
use app\services\pay\PayNotifyServices;
use app\services\pay\PayServices;
use app\services\wechat\WechatMessageServices;
use crmeb\exceptions\PayException;
use crmeb\services\app\MiniProgramService;
use crmeb\services\easywechat\Application;
use crmeb\services\pay\BasePay;
use crmeb\services\pay\PayInterface;
use crmeb\utils\Hook;
use EasyWeChat\Payment\Order;
use think\facade\Event;
use think\facade\Log;
/**
* Class 微信支付v3