全部
常见问题
产品动态
精选推荐

PROv2.3.0小程序用户发起的提现报错修复

管理 管理 编辑 删除

如显示以下错误,或者直接提现的时候返回服务器内部错误都可以按照此方法进行修复

1048d202211181101586609.png


可以按照下面的提示进行修改代码也可以直接下载修复包,覆盖到根目录下就可以修复


修改app\services\user\UserExtractServices.php文件第168行开始修改

if ($openid) {//公众号用户
      $type = Payment::WEB;
} else {//小程序用户
      $openid = $wechatServices->getWechatOpenid((int)$userExtract['uid'], 'routine');
       $type = Payment::MINI;
}
//app微信用户
if (!$openid) {
    $openid = $wechatServices->getWechatOpenid((int)$userExtract['uid'], 'app');
     $type = Payment::APP;
}

修改app\services\user\UserExtractServices.php文件第442行开始修改

if (sys_config('brokerage_type', 0) && $openid) {
    if ($insertData['extract_price'] < 1) {
         throw new ValidateException('扣除手续费后,提现金额不足1元;而企业微信付款到零钱最低金额为1元');
     }
}

修改crmeb\services\wechat\v3pay\PayClient.php头部引用增加,第17行左右


use crmeb\services\wechat\Payment;


修改当前文件在第41行左右增加以下代码:

     /**
     * @var string
     */
    protected $type = Payment::WEB;

    /**
     * @param string $type
     * @return $this
     * @author 等风来
     * @email [email protected]
     * @date 2022/11/18
     */
    public function setType(string $type)
    {
        $this->type = $type;
        return $this;
    }

修改当前文件第229行左右

        $appid = null;
        if ($this->type === Payment::WEB) {
            $appid = $this->app['config']['v3_payment']['other']['wechat']['appid'];
        } else if ($this->type === Payment::MINI) {
            $appid = $this->app['config']['v3_payment']['other']['miniprog']['appid'];
        } else if ($this->type === Payment::APP) {
            $appid = $this->app['config']['v3_payment']['other']['app']['appid'];
        }

        if (!$appid) {
            throw new PayException('暂时只支持微信用户、小程序用户、APP微信登录用户提现');
        }
        $data = [
            'appid' => $appid,
            'out_batch_no' => $outBatchNo,
            'batch_name' => $batchName,
            'batch_remark' => $remark,
            'total_amount' => $amount,
            'total_num' => count($transferDetailList),
            'transfer_detail_list' => $transferDetailList
        ];

修改crmeb\services\wechat\Payment.php的merchantPay方法


public static function merchantPay(string $openid, string $orderId, string $amount, string $desc, string $type = 'wechat')
    {
        $application = self::instance()->setAccessEnd($type)->application();//新修改行
        $config = $application->getConfig();
        if (!isset($config['cert_path'])) {
            throw new PayException('企业微信支付到零钱需要支付证书,检测到您没有上传!');
        }
        if (!$config['cert_path']) {
            throw new PayException('企业微信支付到零钱需要支付证书,检测到您没有上传!');
        }

        if (self::instance()->isV3PAy) {
            //v3支付使用发起商家转账API
            //新修改行
            $res = $application->v3pay->setType($type)->batches(
                $orderId,
                $amount,
                $desc,
                $desc,
                [
                    [
                        'out_detail_no' => $orderId,
                        'transfer_amount' => $amount,
                        'transfer_remark' => $desc,
                        'openid' => $openid
                    ]
                ]
            );

            return $res;

        } else {
            $merchantPayData = [
                'partner_trade_no' => $orderId, //随机字符串作为订单号,跟红包和支付一个概念。
                'openid' => $openid, //收款人的openid
                'check_name' => 'NO_CHECK',  //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK
                'amount' => (int)bcmul($amount, '100', 0),  //单位为分
                'desc' => $desc,
                'spbill_create_ip' => request()->ip(),  //发起交易的IP地址
            ];
            $result = $application->transfer->toBalance($merchantPayData);

            self::logger('企业付款到零钱', compact('merchantPayData'), $result);

            if ($result['return_code'] == 'SUCCESS' && $result['result_code'] != 'FAIL') {
                return true;
            } else {
                throw new PayException(($result['return_msg'] ?? '支付失败') . ':' . ($result['err_code_des'] ?? '发起企业支付到零钱失败'));
            }
        }

    }


附件

CRMEB_PRO_S_v2.3.0修复提现报错问题.zip

等风来,随风去 最后编辑于2022-11-21 15:33:10

快捷回复
回复({{post_count}}) {{!is_user ? '我的回复' :'全部回复'}}
回复从新到旧

{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}

作者 管理员 企业

{{item.floor}}# 同步到gitee 已同步到gitee {{item.is_suggest==1? '取消推荐': '推荐'}}
{{item.floor}}#
{{item.user_info.title}}
附件

{{itemf.name}}

{{item.created_at}}  {{item.ip_address}}
{{item.like_count}}
{{item.showReply ? '取消回复' : '回复'}}
删除
回复
回复

{{itemc.user_info.nickname}}

{{itemc.user_name}}

作者 管理员 企业

回复 {{itemc.comment_user_info.nickname}}

附件

{{itemf.name}}

{{itemc.created_at}}   {{itemc.ip_address}}
{{itemc.like_count}}
{{itemc.showReply ? '取消回复' : '回复'}}
删除
回复
回复
查看更多
回复
回复
1828
{{like_count}}
{{collect_count}}
添加回复 ({{post_count}})

相关推荐

等风来,随风去 企业
在千千万万的沙子中,宝石一定会发光的,所以不要放弃。

回答

1315

发布

11

经验

28590

快速安全登录

使用微信扫码登录
{{item.label}} {{item.label}} {{item.label}} 板块推荐 常见问题 产品动态 精选推荐 首页头条 首页动态 首页推荐
加精
取 消 确 定
回复
回复
问题:
问题自动获取的帖子内容,不准确时需要手动修改. [获取答案]
答案:
提交
bug 需求 取 消 确 定

微信登录/注册

切换手机号登录

{{ bind_phone ? '绑定手机' : '手机登录'}}

{{codeText}}
切换微信登录/注册
暂不绑定
CRMEB客服

CRMEB咨询热线 咨询热线

400-8888-794

微信扫码咨询

CRMEB开源商城下载 开源下载 CRMEB官方论坛 帮助文档
返回顶部 返回顶部
CRMEB客服