Index.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace app\index\controller;
  3. use app\common\controller\Frontend;
  4. use app\utils\PayUtil;
  5. use think\Db;
  6. class Index extends Frontend
  7. {
  8. protected $noNeedLogin = '*';
  9. protected $noNeedRight = '*';
  10. protected $layout = '';
  11. /**
  12. * 测试 汇付 支付
  13. */
  14. public function aa()
  15. {
  16. $params = \request()->post();
  17. $openid = $params['openid'] ?? '';
  18. $order_no = $params['order_no'] ?? '';
  19. $pay = new PayUtil();
  20. $order_no = !empty($order_no) ? $order_no : time().rand(1,200);
  21. $pay->jsPay($openid,"D0{$order_no}",'0.01','开通会员');
  22. return json_encode([
  23. 'order_no' => $order_no,
  24. 'data' => $pay->getData()
  25. ]);
  26. }
  27. public function index()
  28. {
  29. $code = input('code', '', 'trim'); //邀请码
  30. $this->view->assign('code', $code);
  31. $this->view->assign('downurl', config("site.apk_url"));
  32. $is_ios = 0;
  33. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  34. $is_ios = 1;
  35. }
  36. $this->view->assign('is_ios', $is_ios);
  37. return $this->view->fetch();
  38. }
  39. public function wxsharedownload(){
  40. $this->view->assign('downurl', config("site.apk_url"));
  41. return $this->view->fetch();
  42. }
  43. public function suningh5(){
  44. return $this->view->fetch();
  45. }
  46. /**
  47. * app下载页
  48. * 判断是安卓还是ios
  49. */
  50. public function appdownload() {
  51. echo 'hello wold';
  52. }
  53. /**
  54. * app下载页-新
  55. * 判断是安卓还是ios
  56. */
  57. public function downapp() {
  58. $code = input('code', '', 'trim'); //邀请码
  59. $this->view->assign('code', $code);
  60. $this->view->assign('downurl', config("site.apk_url"));
  61. return $this->view->fetch();
  62. // if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  63. // header("Location: https://apps.apple.com/cn/app/%E4%BC%B4%E5%A3%B0%E8%AF%AD%E9%9F%B3/id1556551099");
  64. // }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  65. // //$host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
  66. // //header("Location: ".$host."/index/index/download");
  67. // $this->view->assign('downurl', config("site.apk_url"));
  68. // return $this->view->fetch();
  69. // }else{
  70. // $this->view->assign('downurl', config("site.apk_url"));
  71. // return $this->view->fetch();
  72. // }
  73. }
  74. //基础文章网页
  75. public function basedata(){
  76. $key = input('key','');
  77. if(!$key){
  78. exit;
  79. }
  80. $content = Db::name('basedata')->where('key',$key)->find();
  81. $this->assign('content',$content['content']);
  82. return $this->fetch();
  83. }
  84. }