Index.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. public function pay()
  65. {
  66. return $this->view->fetch();
  67. }
  68. public function aa(){
  69. return 0;
  70. $start_time = time() - (3600 * 1);
  71. $end_time = time() - (3600 * 1);
  72. $active = "select user_id from mt_user_active where requesttime BETWEEN {$start_time} and {$end_time}";
  73. $sql = "update `mt_user` set is_active = 1 where is_active = 0 and gender = 1 and id in ({$active})";//gender = 1 只改男性用户
  74. if (!db()->query($sql)){
  75. return 0;
  76. }
  77. return 1;
  78. }
  79. public function index()
  80. {
  81. $code = input('code', '', 'trim'); //邀请码
  82. $this->view->assign('code', $code);
  83. $this->view->assign('downurl', config("site.apk_url"));
  84. $is_ios = 0;
  85. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  86. $is_ios = 1;
  87. }
  88. $this->view->assign('is_ios', $is_ios);
  89. return $this->view->fetch();
  90. }
  91. public function wxsharedownload(){
  92. $this->view->assign('downurl', config("site.apk_url"));
  93. return $this->view->fetch();
  94. }
  95. public function suningh5(){
  96. return $this->view->fetch();
  97. }
  98. /**
  99. * app下载页
  100. * 判断是安卓还是ios
  101. */
  102. public function appdownload() {
  103. echo 'hello wold';
  104. }
  105. /**
  106. * app下载页-新
  107. * 判断是安卓还是ios
  108. */
  109. public function downapp() {
  110. $code = input('code', '', 'trim'); //邀请码
  111. $this->view->assign('code', $code);
  112. $this->view->assign('downurl', config("site.apk_url"));
  113. return $this->view->fetch();
  114. // if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  115. // header("Location: https://apps.apple.com/cn/app/%E4%BC%B4%E5%A3%B0%E8%AF%AD%E9%9F%B3/id1556551099");
  116. // }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  117. // //$host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
  118. // //header("Location: ".$host."/index/index/download");
  119. // $this->view->assign('downurl', config("site.apk_url"));
  120. // return $this->view->fetch();
  121. // }else{
  122. // $this->view->assign('downurl', config("site.apk_url"));
  123. // return $this->view->fetch();
  124. // }
  125. }
  126. //基础文章网页
  127. public function basedata(){
  128. $key = input('key','');
  129. if(!$key){
  130. exit;
  131. }
  132. $content = Db::name('basedata')->where('key',$key)->find();
  133. $this->assign('content',$content['content']);
  134. return $this->fetch();
  135. }
  136. }