Explorar el Código

Wesmiler 2021-0115第4期分销功能新增

wesmiler hace 5 años
padre
commit
379acc0b57
Se han modificado 1 ficheros con 33 adiciones y 2 borrados
  1. 33 2
      app/weixin/model/Wechat.php

+ 33 - 2
app/weixin/model/Wechat.php

@@ -721,16 +721,47 @@ var_dump($unified);
             return ['code' => 'exception', 'message' => 'parase xml error'];
         }
         if (isset($result['return_code']) && $result['return_code'] != 'SUCCESS') {
-            return ['code' => 'error', 'message' => $result['return_msg'],'type'=>'return_code'];
+            return ['code' => 'error', 'message' => Wechat::getError($result['return_msg']),'type'=>'return_code'];
         }
         if (isset($result['result_code']) && $result['result_code'] != 'SUCCESS') {
-            return ['code' => 'error', 'message' => $result['err_code'],'type'=>'result_code'];
+            return ['code' => 'error', 'message' => $result['err_code_des'],'error_code'=> $result['err_code'],'type'=>'result_code'];
         }
 
         return $result;
     }
 
     /**
+     * 获取错误码内容
+     * @param $code
+     * @return mixed|string
+     */
+    public static function getError($code){
+        $codes = [
+            'NO_AUTH'=> '接口没有权限或ip不允许调用',
+            'AMOUNT_LIMIT'=> '支付金额超出限制',
+            'PARAM_ERROR'=> '请求参数错误',
+            'OPENID_ERROR'=> '收款用户微信Openid错误',
+            'SEND_FAILED'=> '付款错误',
+            'NOTENOUGH'=> '商户余额不足',
+            'SYSTEMERROR'=> '系统繁忙,请稍后再试。',
+            'NAME_MISMATCH'=> '收款用户真实姓名验证错误',
+            'SIGN_ERROR'=> '参数签名错误',
+            'XML_ERROR'=> 'POST请求内容错误',
+            'FATAL_ERROR'=> '两次请求参数不一致',
+            'FREQ_LIMIT'=> '超过接口调用频率限制,请稍后再试。',
+            'MONEY_LIMIT'=> '已经达到今日付款总额上限/已达到付款给此用户额度上限',
+            'CA_ERROR'=> '支付证书验证错误',
+            'V2_ACCOUNT_SIMPLE_BAN'=> '无法给未实名用户付款',
+            'PARAM_IS_NOT_UTF8'=> '请求参数中包含非utf8编码字符',
+            'SENDNUM_LIMIT'=> '该用户今日付款次数超过限制',
+            'RECV_ACCOUNT_NOT_ALLOWED'=> '收款账户不在收款账户列表',
+            'PAY_CHANNEL_NOT_ALLOWED'=> '本商户号未配置API发起能力',
+        ];
+
+        return isset($codes[$code])? $codes[$code] : $code;
+    }
+
+    /**
      * 退款订单
      */
     public static function refundOrder(){