好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > PHP實現(xiàn)微信提現(xiàn)(企業(yè)付款到零錢)

PHP實現(xiàn)微信提現(xiàn)(企業(yè)付款到零錢)

熱門標簽:高德地圖標注家 長春人工外呼系統(tǒng)服務商 江西手機自動外呼防封系統(tǒng)是什么 哪里辦理400電話 廣東地市地圖標注 仁和怎么申請400開頭的電話 廣州防封卡外呼系統(tǒng)多少錢一個月 怎么向銷售公司推銷外呼系統(tǒng) 外呼系統(tǒng)撥打暫時無法接通

怎么開通企業(yè)付款到零錢?

有的商戶號的產(chǎn)品中心是沒有這個功能的,不過,該功能的pid(product id)是5,只要隨便進去某一個產(chǎn)品,在地址欄把pid改為5。

即可進入該功能頁面,進行開通,不過要滿足條件。

用戶提現(xiàn)代碼:

//用戶微信提現(xiàn)
 private function withdrawals_weixin($id){
    $falg = M('withdrawals')->where(['id'=>$id])->find();
    $openid = M('users')->where('user_id', $falg['user_id'])->value('openid');
    $data['openid'] = $openid;
    $data['pay_code'] = $falg['id'].$falg['user_id'];
    $data['desc'] = '提現(xiàn)ID'.$falg['id'];
    if($falg['taxfee'] >= $falg['money']){
      return array('status'=>1, 'msg'=>"提現(xiàn)額度必須大于手續(xù)費!" );
    }else{
      $data['money'] = bcsub($falg['money'], $falg['taxfee'], 2);
    }
    include_once PLUGIN_PATH . "payment/weixin/weixin.class.php";
    $weixin_obj = new \weixin();
    $result = $weixin_obj->transfer($data);
   
    return $result;
 }

其中pay_code在商戶號的提現(xiàn)功能是唯一的,所以為了防重放攻擊,這個值千萬不能用隨機數(shù),最好用ID,具有提現(xiàn)記錄唯一。

提現(xiàn)邏輯代碼:

// 微信提現(xiàn)轉(zhuǎn)賬
  function transfer($data){
    
    header("Content-type: text/html; charset=utf-8");
    //CA證書及支付信息
   $wxchat['appid'] = WxPayConfig::$appid;
   $wxchat['mchid'] = WxPayConfig::$mchid;
 
   $wxchat['api_cert'] = PLUGIN_PATH.'/payment/weixin/cert/apiclient_cert.pem';
    $wxchat['api_key'] = PLUGIN_PATH.'/payment/weixin/cert/apiclient_key.pem';
    
    // $wxchat['api_ca'] = '/plugins/payment/weixin/cert/rootca.pem';
   $webdata = array(
    'mch_appid' => $wxchat['appid'],
    'mchid'   => $wxchat['mchid'],
    'nonce_str' => md5(time()),
    //'device_info' => '1000',
    'partner_trade_no'=> $data['pay_code'], //商戶訂單號,需要唯一
    'openid' => $data['openid'],//轉(zhuǎn)賬用戶的openid
    'check_name'=> 'NO_CHECK', //OPTION_CHECK不強制校驗真實姓名, FORCE_CHECK:強制 NO_CHECK:
    //'re_user_name' => 'jorsh', //收款人用戶姓名
    'amount' => $data['money'] * 100, //付款金額單位為分
    'desc'  => $data['desc'],
    'spbill_create_ip' => request()->ip(),
    );
  
   foreach ($webdata as $k => $v) {
   $tarr[] =$k.'='.$v;
    }
 
   sort($tarr);
   $sign = implode($tarr, '');
   $sign .= 'key='.WxPayConfig::$key;
    $webdata['sign']=strtoupper(md5($sign));
    
    $wget = $this->array2xml($webdata);
    
    $pay_url = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers';
 
    $res = $this->http_post($pay_url, $wget, $wxchat);
 
   if(!$res){
   return array('status'=>1, 'msg'=>"Can't connect the server" );
   }
    $content = simplexml_load_string($res, 'SimpleXMLElement', LIBXML_NOCDATA);
    
   if(strval($content->return_code) == 'FAIL'){
   return array('status'=>1, 'msg'=>strval($content->return_msg));
   }
   if(strval($content->result_code) == 'FAIL'){
   return array('status'=>1, 'msg'=>strval($content->err_code),':'.strval($content->err_code_des));
    }
 
   $rdata = array(
    'mch_appid'    => strval($content->mch_appid),
    'mchid'      => strval($content->mchid),
    'device_info'   => strval($content->device_info),
    'nonce_str'    => strval($content->nonce_str),
    'result_code'   => strval($content->result_code),
    'partner_trade_no' => strval($content->partner_trade_no),
    'payment_no'    => strval($content->payment_no),
    'payment_time'   => strval($content->payment_time),
   );
   return $rdata;
 
  }

其中 PLUGIN_PATH 是一個常量

define('PLUGIN_PATH', __DIR__ . '/plugins/');

定義插件目錄

/**
   * 將一個數(shù)組轉(zhuǎn)換為 XML 結(jié)構(gòu)的字符串
   * @param array $arr 要轉(zhuǎn)換的數(shù)組
   * @param int $level 節(jié)點層級, 1 為 Root.
   * @return string XML 結(jié)構(gòu)的字符串
   */
  function array2xml($arr, $level = 1) {
   $s = $level == 1 ? "xml>" : '';
   foreach($arr as $tagname => $value) {
   if (is_numeric($tagname)) {
    $tagname = $value['TagName'];
    unset($value['TagName']);
   }
   if(!is_array($value)) {
    $s .= "{$tagname}>".(!is_numeric($value) ? '![CDATA[' : '').$value.(!is_numeric($value) ? ']]>' : '')."/{$tagname}>";
   } else {
    $s .= "{$tagname}>" . $this->array2xml($value, $level + 1)."/{$tagname}>";
   }
   }
   $s = preg_replace("/([\x01-\x08\x0b-\x0c\x0e-\x1f])+/", ' ', $s);
   return $level == 1 ? $s."/xml>" : $s;
  }
  
  function http_post($url, $param, $wxchat) {
   $oCurl = curl_init();
   if (stripos($url, "https://") !== FALSE) {
   curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
   curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
   }
   if (is_string($param)) {
   $strPOST = $param;
   } else {
   $aPOST = array();
   foreach ($param as $key => $val) {
    $aPOST[] = $key . "=" . urlencode($val);
   }
   $strPOST = join("", $aPOST);
   }
   curl_setopt($oCurl, CURLOPT_URL, $url);
   curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($oCurl, CURLOPT_POST, true);
   curl_setopt($oCurl, CURLOPT_POSTFIELDS, $strPOST);
   if($wxchat){
   curl_setopt($oCurl,CURLOPT_SSLCERT,$wxchat['api_cert']);
   curl_setopt($oCurl,CURLOPT_SSLKEY,$wxchat['api_key']);
   curl_setopt($oCurl,CURLOPT_CAINFO,$wxchat['api_ca']);
   }
   $sContent = curl_exec($oCurl);
   $aStatus = curl_getinfo($oCurl);
    curl_close($oCurl);
    
   if (intval($aStatus["http_code"]) == 200) {
   return $sContent;
   } else {
   return false;
   }
 }

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • PHP APP微信提現(xiàn)接口代碼
  • PHP實現(xiàn)微信提現(xiàn)功能

標簽:文山 廈門 湘西 黔東 海北 濮陽 梅河口 惠州

巨人網(wǎng)絡通訊聲明:本文標題《PHP實現(xiàn)微信提現(xiàn)(企業(yè)付款到零錢)》,本文關(guān)鍵詞  PHP,實現(xiàn),微信,提現(xiàn),企業(yè),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《PHP實現(xiàn)微信提現(xiàn)(企業(yè)付款到零錢)》相關(guān)的同類信息!
  • 本頁收集關(guān)于PHP實現(xiàn)微信提現(xiàn)(企業(yè)付款到零錢)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 99激情国产AⅤ99在线| 十八禁??国产污污的游戏合集| 黄色小说在线阅读| 天天干天天色综合| 美女网站www精品软件破解版| 诱他上瘾| 鸣人的假期小葵推到视频| 放荡小婬妇H肉辣文糙汉军婚软件| 国精品无码一区二区三区在线蜜桃 | 亚洲国产高潮精品无码星空传媒| 男人趴在女人身上曰皮免费| 初尝尤物美妇| 5060久免费午夜一级毛片牛牛| 三年片韩国在线观看| 免费网禁呦萝资源网视频| 黄色片免费播放| 娇妻冒充妓女接待客人| 99久久久无码国产精品6| 中文字幕三级理论影院| 男女交叉视频| 精品久久久久久亚洲精品| 日本AAAAA级婬片A片| 污污动漫在线| 男同桌嗯…啊摸湿内裤| 久久精品9| videos欧美熟妇ass大白| 公翁的粗大放进我的秘密电影| 啦啦啦www在线观看免费播放高清| 美女张开腿让男人插| 长篇yin荡岳乱合集小说情节| 清冷校草被扒开腿狂c的动漫| 午夜在线精品偷拍| 洗濯屋动漫无删减在线观看| 英语老师的大兔子好软水视频| 色噜噜狠狠一区二区三区 | 午夜视频免费| 成人国产激情福利久久精品| 在私人影院可以做吗| 陈圆圆的婬乱生活hH| Chinese男男Gay FuCK激情| 床上软件|