Index.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. namespace app\index\controller;
  3. use app\utils\PayUtil;
  4. use app\common\controller\Frontend;
  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. exit;
  14. // $start = strtotime(date('Y-m-d')); //默认今日
  15. // $end = $start + 86399;
  16. // dd(Db::name('user_wallet')->where('user_id',1447)->update(['gold'=>357]));
  17. // $mt_user_gold_log = Db::name('user_gold_log'); //金币日志表
  18. // dd($mt_user_gold_log->where('id',582455)->delete());//delete
  19. // $list = $mt_user_gold_log->where([
  20. // // 'user_id' => 1556,
  21. // 'log_type' => 10,
  22. // 'change_value' => ['gt', 0],
  23. // 'createtime' => ['egt', $start],
  24. // 'remark' => ['like', "%微信%"],
  25. // 'user_id' => ['in',[266,1447,23400]],
  26. // ]);
  27. // // dd($list->update(['createtime'=>0]));
  28. // $list = $list->select();
  29. // foreach ($list as $key=>$item){
  30. // $list[$key]['createtime'] = date('Y-m-d H:i:s',$item['createtime']);
  31. // $list[$key]['updatetime'] = date('Y-m-d H:i:s',$item['updatetime']);
  32. // }
  33. // dd($list);
  34. // $query = Db::name('pay_order')
  35. // ->whereBetween('createtime',[1706716800,1706803199])
  36. // ->where('status',3)
  37. // ->whereNotIn('user_id',[1556])
  38. // ->where('payment_class','wechat');
  39. // // dd($query->sum('money'));
  40. // $list = $query->select();
  41. // foreach ($list as $key=>$item){
  42. // $list[$key]['createtime'] = date('Y-m-d H:i:s',$item['createtime']);
  43. // }
  44. // dd($list);
  45. }
  46. /**
  47. * 测试 汇付 支付
  48. */
  49. public function testPay()
  50. {
  51. $params = \request()->post();
  52. $order_no = $params['order_no'] ?? '';
  53. $wxInfo = Cache::get($params['openid'] ?? '');
  54. $openid = $wxInfo['openid'] ?? '';
  55. // $sessionKey = $wxInfo['session_key'] ?? '';
  56. $pay = new PayUtil();
  57. $order_no = !empty($order_no) ? $order_no : time() . rand(1, 200);
  58. $pay->jsPay($openid, "D0{$order_no}", '0.01', '开通会员');
  59. return json_encode([
  60. 'order_no' => $order_no,
  61. 'data' => $pay->getData()
  62. ]);
  63. }
  64. //精秀,微信支付跳转
  65. public function pay()
  66. {
  67. return $this->view->fetch();
  68. }
  69. //精秀,支付宝支付跳转
  70. public function alipay(){
  71. $url = input('url','');
  72. $this->redirect($url);
  73. }
  74. public function aa(){
  75. return 0;
  76. $start_time = time() - (3600 * 1);
  77. $end_time = time() - (3600 * 1);
  78. $active = "select user_id from mt_user_active where requesttime BETWEEN {$start_time} and {$end_time}";
  79. $sql = "update `mt_user` set is_active = 1 where is_active = 0 and gender = 1 and id in ({$active})";//gender = 1 只改男性用户
  80. if (!db()->query($sql)){
  81. return 0;
  82. }
  83. return 1;
  84. }
  85. public function index()
  86. {
  87. $code = input('code', '', 'trim'); //邀请码
  88. $this->view->assign('code', $code);
  89. $this->view->assign('downurl', config("site.apk_url"));
  90. $is_ios = 0;
  91. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  92. $is_ios = 1;
  93. }
  94. $this->view->assign('is_ios', $is_ios);
  95. return $this->view->fetch();
  96. }
  97. public function wxsharedownload(){
  98. $this->view->assign('downurl', config("site.apk_url"));
  99. return $this->view->fetch();
  100. }
  101. public function suningh5(){
  102. return $this->view->fetch();
  103. }
  104. /**
  105. * app下载页
  106. * 判断是安卓还是ios
  107. */
  108. public function appdownload() {
  109. echo 'hello wold';
  110. }
  111. /**
  112. * app下载页-新
  113. * 判断是安卓还是ios
  114. */
  115. public function downapp() {
  116. $code = input('code', '', 'trim'); //邀请码
  117. $this->view->assign('code', $code);
  118. $this->view->assign('downurl', config("site.apk_url"));
  119. return $this->view->fetch();
  120. // if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  121. // header("Location: https://apps.apple.com/cn/app/%E4%BC%B4%E5%A3%B0%E8%AF%AD%E9%9F%B3/id1556551099");
  122. // }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  123. // //$host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
  124. // //header("Location: ".$host."/index/index/download");
  125. // $this->view->assign('downurl', config("site.apk_url"));
  126. // return $this->view->fetch();
  127. // }else{
  128. // $this->view->assign('downurl', config("site.apk_url"));
  129. // return $this->view->fetch();
  130. // }
  131. }
  132. //基础文章网页
  133. public function basedata(){
  134. $key = input('key','');
  135. if(!$key){
  136. exit;
  137. }
  138. $content = Db::name('basedata')->where('key',$key)->find();
  139. $this->assign('content',$content['content']);
  140. return $this->fetch();
  141. }
  142. }