<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/23
 * Time: 10:42
 */

class PayRandomMx{
    public function getRandomaccessproviderKey($orderid){
        require_once('../../init.php');
///---查随机接口商家帐号、密码开始---///
//2.从数据库中查询数据
        $cache=Cache::getInstance();
        $userkey='';
        $accessProvider=$cache->get('accessProvider');
//3.获取orderlist表中数据
        $orderlist_ob = new randomjiekoushang_class();
        $wenjianjia_arr = $orderlist_ob->get_orderlist_by_orderid_wenjianjia($orderid);
        $wenjianjia = $wenjianjia_arr['returnmsg'];

//        $file = fopen(date('ymd').'_PayRandom_log.txt', 'a+');
//        fwrite($file,"\r\n wenjianjia_arr：".http_build_query($wenjianjia_arr));
//        fwrite($file,"\r\n wenjianjia：".$wenjianjia);

        if($accessProvider){
            foreach($accessProvider as $key=>$val){
                if($val['id']==$wenjianjia){
                    $userid=$val['accessID'];
                    $userkey=$val['accessKey'];
                    break;
                }
            }
        }
//        fwrite($file,"\r\n accessKey：".$userkey);

        return ['userid' => $userid, 'userkey' => $userkey];
///---查随机接口商家帐号、密码结束---///

    }
}