Index.php 3.4 KB

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