getRootPath() . 'public/pc/index.html'; if (is_mobile()) { $template = app()->getRootPath() . 'public/mobile/index.html'; } if (file_exists($template)) { return view($template); } return ''; } public function app() { if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')) { $url = ConfigServer::get('app', 'line_ios', ''); } else { $url = ConfigServer::get('app', 'line_android', ''); } if (empty($url)) { echo '未设置app下载链接'; exit; } if (!preg_match("/^http(s)?:\\/\\/.+/", $url)) { $url = "http://".$url; } $this->redirect($url); } public function localReturn(){ $re = $_REQUEST; $data['content'] = $re; $data['dtime'] = date("Y-m-d H:i:s"); Db::name("local_return")->save($data); // if (gettype($re) == "string") { // $data['content'] = $re; // $data['dtime'] = date("Y-m-d H:i:s"); // Db::name("local_return")->save($data); // } else { // $data['content'] = var_export($re, true); // $data['dtime'] = date("Y-m-d H:i:s"); // Db::name("local_return")->save($data); // } } public function billions(){ $result = Db::name("user_billions_surplus") ->where("residue_price",">","0") ->where("user_start_price",">","0") ->find(); if($result != null){ $r = Db::name("user_billions")->alias("a") ->join("user_billions_surplus_log b","a.billions_id = b.billions_id","left") ->where("a.billions_id","<=",$result['billions_id']) ->where("b.surplus_id IS NULL") ->limit(1000) ->select()->toArray(); foreach($r as $key=>$value){ $ranking = BillionsLogic::getRanking($value['billions_id']); } } } public function retund(){ $config = WeChatServer::getPayConfigBySource(1)['config']; if (empty($config)) { throw new Exception('请联系管理员设置微信相关配置!'); } if (!isset($config['cert_path']) || !isset($config['key_path'])) { throw new Exception('请联系管理员设置微信证书!'); } if (!file_exists($config['cert_path']) || !file_exists($config['key_path'])) { throw new Exception('微信证书不存在,请联系管理员!'); } $result = WeChatPayServer::refund($config, [ 'transaction_id' => "4200002417202409298999399108", 'refund_sn' => "202409291431067057", 'total_fee' => intval(strval(650 * 100)),//订单金额,单位为分 'refund_fee' => intval(strval(650 * 100)),//退款金额 ]); var_dump($result); if (isset($result['return_code']) && $result['return_code'] == 'FAIL') { throw new Exception($result['return_msg']); } if (isset($result['err_code_des'])) { throw new Exception($result['err_code_des']); } if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') { //更新退款日志记录 $dat['wechat_refund_id'] = $result['refund_id'] ?? 0; $dat['refund_msg'] = json_encode($result, JSON_UNESCAPED_UNICODE); $dat['dtime'] = date("Y-m-d H:i:s"); Db::name("local_pay_return")->save($dat); } else { throw new Exception('微信支付退款失败'); } } }