123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?php
- namespace app\index\controller;
- use app\utils\PayUtil;
- use app\common\controller\Frontend;
- use think\Cache;
- use think\Db;
- class Index extends Frontend
- {
- protected $noNeedLogin = '*';
- protected $noNeedRight = '*';
- protected $layout = '';
-
- public function aaaa(){
- exit;
- // $start = strtotime(date('Y-m-d')); //默认今日
- // $end = $start + 86399;
-
- // dd(Db::name('user_wallet')->where('user_id',1447)->update(['gold'=>357]));
-
- // $mt_user_gold_log = Db::name('user_gold_log'); //金币日志表
-
- // dd($mt_user_gold_log->where('id',582455)->delete());//delete
- // $list = $mt_user_gold_log->where([
- // // 'user_id' => 1556,
- // 'log_type' => 10,
- // 'change_value' => ['gt', 0],
- // 'createtime' => ['egt', $start],
- // 'remark' => ['like', "%微信%"],
- // 'user_id' => ['in',[266,1447,23400]],
- // ]);
-
- // // dd($list->update(['createtime'=>0]));
-
- // $list = $list->select();
-
- // foreach ($list as $key=>$item){
- // $list[$key]['createtime'] = date('Y-m-d H:i:s',$item['createtime']);
- // $list[$key]['updatetime'] = date('Y-m-d H:i:s',$item['updatetime']);
- // }
- // dd($list);
-
-
- // $query = Db::name('pay_order')
- // ->whereBetween('createtime',[1706716800,1706803199])
- // ->where('status',3)
- // ->whereNotIn('user_id',[1556])
- // ->where('payment_class','wechat');
- // // dd($query->sum('money'));
- // $list = $query->select();
- // foreach ($list as $key=>$item){
- // $list[$key]['createtime'] = date('Y-m-d H:i:s',$item['createtime']);
- // }
- // dd($list);
- }
-
- /**
- * 测试 汇付 支付
- */
- public function testPay()
- {
- $params = \request()->post();
- $order_no = $params['order_no'] ?? '';
- $wxInfo = Cache::get($params['openid'] ?? '');
- $openid = $wxInfo['openid'] ?? '';
- // $sessionKey = $wxInfo['session_key'] ?? '';
- $pay = new PayUtil();
- $order_no = !empty($order_no) ? $order_no : time() . rand(1, 200);
- $pay->jsPay($openid, "D0{$order_no}", '0.01', '开通会员');
- return json_encode([
- 'order_no' => $order_no,
- 'data' => $pay->getData()
- ]);
- }
- //精秀,微信支付跳转
- public function pay()
- {
- return $this->view->fetch();
- }
- //精秀,支付宝支付跳转
- public function alipay(){
- $url = input('url','');
- $this->redirect($url);
- }
- public function aa(){
- return 0;
- $start_time = time() - (3600 * 1);
- $end_time = time() - (3600 * 1);
- $active = "select user_id from mt_user_active where requesttime BETWEEN {$start_time} and {$end_time}";
- $sql = "update `mt_user` set is_active = 1 where is_active = 0 and gender = 1 and id in ({$active})";//gender = 1 只改男性用户
- if (!db()->query($sql)){
- return 0;
- }
- return 1;
- }
- public function index()
- {
- $code = input('code', '', 'trim'); //邀请码
- $this->view->assign('code', $code);
- $this->view->assign('downurl', config("site.apk_url"));
- $is_ios = 0;
- if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
- $is_ios = 1;
- }
- $this->view->assign('is_ios', $is_ios);
- return $this->view->fetch();
- }
- public function wxsharedownload(){
- $this->view->assign('downurl', config("site.apk_url"));
- return $this->view->fetch();
- }
- public function suningh5(){
- return $this->view->fetch();
- }
- /**
- * app下载页
- * 判断是安卓还是ios
- */
- public function appdownload() {
- echo 'hello wold';
- }
-
- /**
- * app下载页-新
- * 判断是安卓还是ios
- */
- public function downapp() {
- $code = input('code', '', 'trim'); //邀请码
- $this->view->assign('code', $code);
- $this->view->assign('downurl', config("site.apk_url"));
- return $this->view->fetch();
- // if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
- // header("Location: https://apps.apple.com/cn/app/%E4%BC%B4%E5%A3%B0%E8%AF%AD%E9%9F%B3/id1556551099");
- // }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
- // //$host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
- // //header("Location: ".$host."/index/index/download");
- // $this->view->assign('downurl', config("site.apk_url"));
- // return $this->view->fetch();
- // }else{
- // $this->view->assign('downurl', config("site.apk_url"));
- // return $this->view->fetch();
- // }
- }
- //基础文章网页
- public function basedata(){
- $key = input('key','');
- if(!$key){
- exit;
- }
- $content = Db::name('basedata')->where('key',$key)->find();
- $this->assign('content',$content['content']);
- return $this->fetch();
- }
- }
|