商户企业付款到银行卡操作进行结果查询
@param string $partner_trade_no 商户订单号，需保持唯一
@return array
@throws Exceptions\LocalCacheException
@throws InvalidResponseException
190014
public function queryTransFresBank($partner_trade_no)
    {
        $pay = new TransfersBank($this->config->get());
        return $pay->query($partner_trade_no);
    }
778874
public function getSHA1($token, $timestamp, $nonce, $encrypt_msg)
	{
		//排序
		try {
			$array = array($encrypt_msg, $token, $timestamp, $nonce);
			sort($array, SORT_STRING);
			$str = implode($array);
			return array(ErrorCode::$OK, sha1($str));
		} catch (Exception $e) {
			//print $e . "\n";
			return array(ErrorCode::$ComputeSignatureError, null);
		}
	}
722694
protected function getResult($options)
    {
        $this->applyData($options);
        $method = str_replace('.', '_', $this->options['method']) . '_response';
        $data = json_decode(Tools::get($this->gateway, $this->options->get()), true);
        if (!isset($data[$method]['code']) || $data[$method]['code'] !== '10000') {
            throw new InvalidResponseException(
                "Error: " .
                (empty($data[$method]['code']) ? '' : "{$data[$method]['msg']} [{$data[$method]['code']}]\r\n") .
                (empty($data[$method]['sub_code']) ? '' : "{$data[$method]['sub_msg']} [{$data[$method]['sub_code']}]\r\n"),
                $data[$method]['code'], $data
            );
        }
        return $data[$method];
        // 去除返回结果签名检查
        // return $this->verify($data[$method], $data['sign']);
    }
551625
public function QPayOrderQuery($params = array()){
        /*        //入参
                $params = array();
                $params["out_trade_no"] = "20160512161914_BBC";
                $params["sub_mch_id"] = "1900005911";*/
        if (empty($params["out_trade_no"])){
            throw new Exception('商户订单号参数不能缺少' ,'OUT_TRADE_NO_MUST_INPUT');
        }
        if (empty($params["sub_mch_id"])){
            throw new Exception('sub_mch_id不能缺少' ,'FEE_TYPE');
        }

        //api调用
        $qpayApi = new QpayMchAPI('https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi', null, 10);
        $qpayApi->setMchId('1490434181');
        $qpayApi->setMchKey('8525638f86969d1de5c51ad0494f4f13');
        $ret = $qpayApi->reqQpay($params);
        return QpayMchUtil::xmlToArray($ret);
    }
521888
public function saveSuidTransaction ($save_function, $data, $suid_check = true, $args = []) {
		if (!static::SeesionOnSu()) {
			return null;
		}

		if ($suid_check === false && !static::EnableSuidSession()) {
			return null;
		}

		if (is_callable($data)) {
			$data = $data();
		}

		try {
			static::Begin();

			if (is_string($save_function) && strpos($save_function, '::') !== false) {
				//PHPネイティブでは指定できないが、'クラスパス::メソッド名'の指定に合わせるための処理
				$save_function = explode('::', $save_function, 2);
			} else if (is_callable($save_function)) {

			} else {
				//インスタンスメソッドを指定する場合
				$save_function = [$this, $save_function];
			}
			$ret = $save_function(...array_merge([$data], (array) $args));
		} catch (\Exception $e) {
			static::DeleteSuidSession();
			static::Rollback();
			throw $e;
		}

		static::DeleteSuidSession();
		static::Commit();

		return $ret;
	}
608869
public function start($host, $port, $option = [])
    {
        $registerAddress = !empty($option['registerAddress']) ? $option['registerAddress'] : '127.0.0.1:1236';

        if (!empty($option['register_deploy'])) {
            // 分布式部署的时候其它服务器可以关闭register服务
            // 注意需要设置不同的lanIp
            $this->register($registerAddress);
        }

        // 启动businessWorker
        if (!empty($option['businessWorker_deploy'])) {
            $this->businessWorker($registerAddress, isset($option['businessWorker']) ? $option['businessWorker'] : []);
        }

        // 启动gateway
        if (!empty($option['gateway_deploy'])) {
            $this->gateway($registerAddress, $host, $port, $option);
        }

        Worker::runAll();
    }
547120
public function wxPayUnifiedOrder($conf = [])
    {

        // [必填]公众账号ID、应用ID
        $conf['appid'] = $this->appId;

        // [必填]商户号、
        $conf['mch_id'] = $this->mchId;

        // 设备号
        // - device_info

        // [必填]nonce_str 随机字符串
        $conf['nonce_str'] = SHA1::get_random_str(32);

        // 签名类型
        $conf['sign_type'] = 'MD5';

        // [必填]商品描述
        // - body

        // 商品详情
        // - detail

        // 附加数据
        // - attach

        // [必填]商户订单号
        // - out_trade_no

        // 货币类型
        // - fee_type

        // [必填]总金额
        // - total_fee

        // [必填]终端IP
        $conf['spbill_create_ip'] = $_SERVER['REMOTE_ADDR'];

        // 交易起始时间
        // - time_start

        // 交易结束时间
        // - time_expire

        // 商品标记
        // - goods_tag

        // [必填]通知地址
        // - notify_url

        // [必填]交易类型
        // - trade_type

        // 指定支付方式
        // - limit_pay

        // 用户标识, trade_type=JSAPI时（即公众号支付），此参数必传
        // - openid

        // [必填]签名
        $conf['sign'] = SHA1::getSign2($conf, 'key='.$this->key);

        // 生成xml
        $xml = Xml::toXml($conf);

        // 调用接口
        $url = 'https://api.mch.weixin.qq.com/pay/unifiedorder';
        try {
            $res = HttpCurl::post($url, $xml);
            libxml_disable_entity_loader(true);
            return json_decode(json_encode(simplexml_load_string($res, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
        } catch (\Exception $e) {
            return false;
        }
    }
275837
public function h5Pay(array $args = [], $redirect_url = null) {
        $args['trade_type'] = 'MWEB';
        $data = $this->order($args);
        if ($data === false) {
            return false;
        }
        if (array_key_exists('mweb_url', $data)) {
            return $data['mweb_url'].'&redirect_url='.urlencode((string)$redirect_url);
        }
        throw new Exception('unkown');
    }
423154
public function orderQuery($params,$timeOut=6){

         $url='https://api.mch.weixin.qq.com/pay/orderquery';

         $inputObj=new WxPayParam();
         $inputObj->setValues($params); //置入参数
         if(!$inputObj->isKeySet("transaction_id")&&!$inputObj->isKeySet("out_trade_no")){
             throw new \Exception("订单查询接口中，out_trade_no、transaction_id至少填一个！");
         }
         $inputObj->setValueByKey("appid",Config::getAppId());
         $inputObj->setValueByKey("mch_id",Config::getMchid());
         $inputObj->setValueByKey("nonce_str",static::getNonceStr()); //随机字符串

         //签名
         $inputObj->SetSign();
         $xml = $inputObj->ToXml();

         $startTimeStamp = self::getMillisecond();//请求开始时间
         $response=static::postXmlCurl($xml,$url,false,$timeOut);
         $result=WxPayResult::Init($response);

         //上报数据
         $this->reportCostTime($url,$startTimeStamp,$result);

         return $result;


     }
419824
public static function filterPayload($payload, $params, $preserve_notify_url = false): array
    {
        $type = self::getTypeName($params['type'] ?? '');

        $payload = array_merge(
            $payload,
            is_array($params) ? $params : ['out_trade_no' => $params]
        );
        $payload['appid'] = self::$instance->getConfig($type, '');

        if (self::$instance->getConfig('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) {
            $payload['sub_appid'] = self::$instance->getConfig('sub_'.$type, '');
        }

        unset($payload['trade_type'], $payload['type']);
        if (!$preserve_notify_url) {
            unset($payload['notify_url']);
        }

        $payload['sign'] = self::generateSign($payload);

        return $payload;
    }
681080
def QA_util_get_next_trade_date(cursor_date, n=1):
    

    cursor_date = QA_util_format_date2str(cursor_date)
    if cursor_date in trade_date_sse:
        # 如果指定日期为交易日
        return QA_util_date_gap(cursor_date, n, "gt")
    real_pre_trade_date = QA_util_get_real_date(cursor_date)
    return QA_util_date_gap(real_pre_trade_date, n, "gt")
80330
public function getPaySign($openid='',$body,$attach,$out_trade_no,$total_fee,$notify_url,$time_start=0,$time_expire=0){
        $wxpay = new PayLib\WxPayApi($this->type);
        //统一下单
        $input = new PayLib\WxPayUnifiedOrder();

        if($this->type === 'mp'){
            if(empty($openid)){
                throw new Exception('请传入openid','OPENID_EMPTY');
            }
            $input->SetOpenid($openid);
            $input->SetTrade_type('JSAPI');#接口
        }
        elseif($this->type === 'app'){
            $input->SetTrade_type('APP');#接口
        }

        $input->SetBody($body);//设置商品或支付单简要描述
        $input->SetOut_trade_no($out_trade_no);#设置单号
        $input->SetTotal_fee($total_fee);#设置支付金额
        $input->SetAttach($attach);//自定义的参数

        $input->SetNotify_url($notify_url);#回调地址


        if($time_start!==0){
            $input->SetTime_start($time_start);         //交易起始时间
        }

        if($time_expire!==0){
            $input->SetTime_expire($time_expire);       //交易结束时间
        }

        $order = PayLib\Wxpayapi::unifiedOrder($input);#生成订单

        if(empty($order['return_code'])||$order['return_code']!=='SUCCESS'){
            throw new Exception('微信错误,'.$order['return_msg'],'WECHAT_ERROR');
        }

        if(empty($order['result_code'])||$order['result_code']!=='SUCCESS'){
            throw new Exception('生成微信单号失败,'.$order['return_msg'],'WECHAT_ERROR');
        };

        if(!array_key_exists("appid", $order)|| !array_key_exists("prepay_id", $order)|| $order['prepay_id'] == ""){
            throw new Exception("参数错误",'PARAMS_ERROR');
        }

        if($this->type == 'mp'){
            $jsObj=new PayLib\WxPayJsApiPay();
            $jsObj->SetAppid($order["appid"]);
            $timeStamp = time();
            $jsObj->SetTimeStamp("$timeStamp");
            $jsObj->SetNonceStr(PayLib\WxPayApi::getNonceStr());
            $jsObj->SetSignType("MD5");
            $jsObj->SetPackage("prepay_id=" . $order['prepay_id']);
            $jsObj->SetPaySign($jsObj->MakeSign());

            $jsApiParameters = json_encode($jsObj->GetValues());
            if (!$jsApiParameters) {
                throw new Exception('微信接口对接失败','WECHAT_ERROR');
            }
        }
        elseif($this->type == 'app'){
            $appObj=new PayLib\WxPayAppApiPay();
            $appObj->SetAppid($order["appid"]);
            $timeStamp = time();
            $appObj->SetTimeStamp("$timeStamp");
            $appObj->SetNonceStr(PayLib\WxPayApi::getNonceStr());
            $appObj->SetPackage("Sign=WXPay");
            $appObj->SetPartnerId(PayLib\WxPayConfig::$MCHID);
            $appObj->SetPrepayId($order['prepay_id']);
            $appObj->SetSign();

            $getValues=$appObj->GetValues();
            $getValues['orderid']=$out_trade_no;

            $jsApiParameters = json_encode($getValues);
            //log_message('error',$jsApiParameters);
            if (!$jsApiParameters) {
                throw new Exception('微信接口对接失败','WECHAT_ERROR');
            }
        }
        else{
            throw new Exception('位置类型','TYPE_ERROR');
        }

        return $jsApiParameters;
    }
1013846
public BaseResponse close(String tradeNumber) {
        OrderCloseRequestWrapper wrapper = new OrderCloseRequestWrapper();
        wrapper.setTradeNumber(tradeNumber);
        setBaseSettings(wrapper);

        SortedMap<String, Object> closeOrderRequestMap = JsonMapper.nonEmptyMapper().getMapper().convertValue(wrapper, SortedMap.class);
        sign(wrapper, closeOrderRequestMap);

        String url = WxEndpoint.get("url.pay.payment.order.close");
        try {
            String xml = XmlObjectMapper.nonEmptyMapper().toXml(wrapper);
            logger.info("支付 close order request: {}", xml);
            String response = wxSslClient.post(url, xml);
            logger.info("支付 close order response: {}", response);

            OrderCloseResponseWrapper responseWrapper = XmlObjectMapper.defaultMapper().fromXml(response, OrderCloseResponseWrapper.class);
            return responseWrapper.getResponse();
        } catch (Exception e) {
            throw new WxRuntimeException(999, "close order failed:" + e.getMessage());
        }

    }
957181
public function index()
    {
        return Merchant::content(function (Content $content) {
            $content->header(trans('merchant.operation_log'));
            $content->description(trans('merchant.list'));

            $grid = Merchant::grid(OperationLog::class, function (Grid $grid) {
                $grid->model()->orderBy('id', 'DESC');

                $grid->id('ID')->sortable();
                $grid->user()->name(trans('merchant.user'));
                $grid->method()->display(function ($method) {
                    $color = array_get(OperationLog::$methodColors, $method, 'grey');

                    return "<span class=\"badge bg-$color\">$method</span>";
                });
                $grid->path()->label('info');
                $grid->ip()->label('primary');
                $grid->input()->display(function ($input) {
                    $input = json_decode($input, true);
                    $input = array_except($input, ['_pjax', '_token', '_method', '_previous_']);
                    if (empty($input)) {
                        return '<code>{}</code>';
                    }

                    return '<pre>'.json_encode($input, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE).'</pre>';
                });

                $grid->created_at(trans('merchant.created_at'));

                $grid->actions(function (Grid\Displayers\Actions $actions) {
                    $actions->disableEdit();
                });

                $grid->disableCreation();

                $grid->filter(function ($filter) {
                    $filter->equal('user_id', 'User')->select(Administrator::all()->pluck('name', 'id'));
                    $filter->equal('method')->select(array_combine(OperationLog::$methods, OperationLog::$methods));
                    $filter->like('path');
                    $filter->equal('ip');
                });
            });

            $content->body($grid);
        });
    }
1094465
final function GetVar($qry, $row_no = 0, $offset = 0)
    {
        if ($this->lock_sel_data) {
            return array();
        }
        if ($this->Query($qry)) {
            $this->result = $this->Fetch($this->query_result, $row_no, $offset);
            $this->SetDebugDump($offset);

            return $this->result[0][0];
        }
        return array();
    }
152136
public function sendPartnerAcceptance(string $partnerEmail)
    {
        $mailTemplate = $this->createMailTemplate('partner-request-accept');

        if (!empty($mailTemplate)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $sendFrom = [\Yii::$app->get('shopMailer')->transport->getUsername() => \Yii::$app->name ?? parse_url(Url::base(true), PHP_URL_HOST)];

            $this->sendMessage($sendFrom, $partnerEmail, $subject, $bodyParams);
        }

    }
1263338
def upcoming_data(self, broker, data):
        '''
        
        '''
        # main thread'
        # if self.running_time is not None and self.running_time!= data.datetime[0]:
        #     for item in self.broker.keys():
        #         self._settle(item)
        self.running_time = data.datetime[0]
        for account in self.session.values():
            account.run(QA_Event(
                event_type=ENGINE_EVENT.UPCOMING_DATA,
                # args 附加的参数
                market_data=data,
                broker_name=broker,
                send_order=self.insert_order,  # 🛠todo insert_order = insert_order
                query_data=self.query_data_no_wait,
                query_order=self.query_order,
                query_assets=self.query_assets,
                query_trade=self.query_trade
            ))