'星优办公软件', 'keywords' => '星优办公', 'description' => '【星优办公软件】提供各种办公工具。', ]; public function __construct() { // if ($test = $this->isTest()) { $url = \request()->getScheme() . '://' . $test; } else { $url = \request()->getScheme() . '://www.xingyousoft.com'; } View::share('target', $url); View::share($this->seoData); } /** * 判断是否是测试环境 * * @return false|string */ public function isTest(): bool|string { $url = \request()->getHttpHost(); if ($url == 'www.xingyousoft.me' || $url == 'audio.xingyousoft.me' || $url == 'pdf.xingyousoft.me' || $url == 'audio.xingyousoft.com') { return $url; } else { return false; } } /** * 获取产品信息 * * @param string $pmid * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder|null */ public function getProductInfo(string $pmid) { return DB::table('product')->where('mid', $pmid)->where('is_delete', 0)->first(); } /** * 获取版本信息 * * @param $productId * @param string $osType * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Query\Builder|null */ public function getProductVersion($productId, string $osType = 'windows') { // 如果有相同的版本,则获取最后一条 orderby return DB::table('product_version') ->where('product_id', $productId) ->where('os_type', $osType) ->where('is_delete', 0) ->orderBy("id", "desc")->first(); } public function getAlipayOptions() { $configArr = config('alipay'); $options = new Config(); $options->protocol = 'https'; $options->gatewayHost = 'openapi.alipay.com'; $options->signType = 'RSA2'; $options->appId = $configArr['app_id']; // 为避免私钥随源码泄露,推荐从文件中读取私钥字符串而不是写入源码中 $options->merchantPrivateKey = file_get_contents($configArr['private_key']); $options->alipayCertPath = $configArr['alipay_cert_public_key_rsa2'];//'<-- 请填写您的支付宝公钥证书文件路径,例如:/foo/alipayCertPublicKey_RSA2.crt -->'; $options->alipayRootCertPath = $configArr['alipay_root_cert'];//'<-- 请填写您的支付宝根证书文件路径,例如:/foo/alipayRootCert.crt" -->'; $options->merchantCertPath = $configArr['app_cert_public_key'];//'<-- 请填写您的应用公钥证书文件路径,例如:/foo/appCertPublicKey_2019051064521003.crt -->'; //注:如果采用非证书模式,则无需赋值上面的三个证书路径,改为赋值如下的支付宝公钥字符串即可 //$options->alipayPublicKey = $configArr['ali_public_key']; //可设置异步通知接收服务地址(可选) $options->notifyUrl = $configArr['notify_url']; //可设置AES密钥,调用AES加解密相关接口时需要(可选) // $options->encryptKey = "<-- 请填写您的AES密钥,例如:aa4BtZ4tspm2wnXLb1ThQA== -->"; return $options; } }