/** * 生成静态NATIVE方式的微信订单第一步 * @param array $options 参数数组 * @return array */ public function createStaticNativeOrderFirst($options) { $resArr = ['code' => 0]; //设置静态链接 $nativeLinkModel = new WxPayNativeLink($this->wx_config); //设置静态链接参数 $nativeLinkModel->setParameter("product_id", $options['product_id']); //商品id //获取链接 $product_url = $nativeLinkModel->getUrl(); //使用短链接转换接口 $shortUrlModel = new WxPayShortUrl($this->wx_config); //设置必填参数 $shortUrlModel->setParameter("long_url", $product_url . ""); //URL链接 //获取短链接 $resArr['data'] = ['code_url' => $shortUrlModel->getShortUrl()]; return $resArr; }