<?php
/*
 本代码由 焕岱科技 创建
 技术支持 WX：15285007200
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace app\api\controller;

use app\api\controller\Base;
use think\Db;
use think\Cache;
use think\Session;

use think\Queue;
use app\common\job\FanhuanJob;

class Index extends Base
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function index()
    {
        $this->success('请求成功'); 
    }
    
    public function task(){
        __success("操作成功");
    }
    
    
    
    public function ceshi(){
        global $_W;
        
 
        $result = strtotime("2026-07-21 11:15:23");
        $result = date('Y-m-d H:i:s',1786729668); 
         
        // $result = \app\common\model\bbfxshop\Salequota::settlement(1030); 
        // $result = \app\common\model\bbfxshop\Order::goodsPayResult('2026042821103676904646',1);
        // $result = \app\common\model\bbfxshop\Salequota::getSupUser(932597652,0,0,[]);

        // file_put_contents("hxe111.txt",date('Y-m-d H:i:s')."\n",FILE_APPEND);

        // $result = \app\common\model\bbfxshop\ImageCheck::check(1403);
        // $result = \app\common\model\bbfxshop\Agent::settlement(1060); 
        
        //  $result = 111;
        // \app\common\model\bbfxshop\User::initSupPath();
        // $result = \app\common\model\bbfxshop\User::initOriginalSupPath();
        // $result = round((intval(12.14  * 100) / 100),2);;

        // $result = \app\common\model\bbfxshop\Cashlottery::confirm(83,'2026060417254607847493','wxapp');

        // Db::execute("ALTER TABLE ".tablename("bbfx_user_log")." ADD `subtitle` varchar(255) DEFAULT NULL;");

        // $alldown = \app\common\model\bbfxshop\Fenxiao::getAllthreedown(83);
        // file_put_contents("ljfh111.txt","222",FILE_APPEND|LOCK_EX);
        // $result = $_SERVER['HTTP_HOST'];

        // $result = \app\common\model\bbfxshop\ReturnMode::unifyReturn1();
        // $fenxiao_orders = Db::name("bbfx_fenxiao_order")->where(['uniacid'=>UNIACID,'order_id'=>1154])->select();
        // $result = \app\common\model\bbfxshop\ContributeVadded::jiesuanCommission($fenxiao_orders);
        // $result = \app\common\model\bbfxshop\Fenxiao::settlement(1163);
        // $result = bd_number(2.555000);

        // $Payeasenet = new \app\common\model\bbfxshop\Payeasenet();
        // $result = $Payeasenet->balanceQuery();

        // $order = Db::name("bbfx_order")->where(['is_pay'=>1])->find();
        // $result = \app\common\model\bbfxshop\Order::execute($order);
        // $result = $Payeasenet->orderQuery('2026072318051882859858');

        // $result = RUNTIME_PATH;

        // $result = \app\common\model\bbfxshop\Sabonus::addPart(1204);
        // \app\common\model\bbfxshop\ReturnMode::signRelease(932286196,4);

        // $result = \app\common\model\bbfxshop\Sabonus::setSabonusCommission(true);

        // $result = stripUrlDomain('https://img.zangxinkeji.com/uploads/20260803/16b97c81c6cfd246e662310cd6bb9af2ieZarb6fDoYKMq1H.pfx');

        // $data = [
        //     'id'    => 1001,
        //     'title' => '测试队列任务'
        // ];

        // //1. 立即执行
        // $result = Queue::push(FanhuanJob::class, $data);

        // print_r(THINK_VERSION);die;

        // $result = \app\common\model\bbfxshop\Sreturn::jiesuan();
        // print_r(PHP_VERSION);die;

        // $result = iunserializer('');

        // for($i=1;$i<=10;$i++){
        //     Queue::push(FanhuanJob::class,[
        //         'task_id'=>"sreturn_".$i,
        //         'limit'=>100
        //     ]);
        // }
        $where = ['a.uniacid'=>UNIACID,'a.surplus'=>['>',0],'b.status'=>1,'a.sdate'=>['neq',date("Y-m-d")],'a.mode'=>0];
        
        $result = Db::name("bbfx_sreturn_user")->alias("a")->join("bbfx_user b","a.user_id=b.id","LEFT")->where($where)->field("a.*")->count();
        echo "<pre>";
        print_r($result);die;
    } 

 
    public function config(){
        global $_W;
        $base = \app\common\model\bbfxshop\Common::getConfig(false);
        if(!empty($base)){

            // echo "<pre>";
            // print_r($_SERVER);die;
            
            $Diypage = new \app\common\model\bbfxshop\Diypage;
            $base['tabBar'] = $Diypage->getTabBar();
            
            $category = \app\common\model\bbfxshop\Goods::getCategoryList();
            
            $base['category'] = $category;
            $base['bargain_category'] = \app\common\model\bbfxshop\Bargain::getCategoryList();

            $platform = Db::name("platform")->where(['id'=>UNIACID])->field("id,wxapp_native_tabbar,wxapp_native_tabbar_shenhe,wxapp_tabbar,huifubafang")->find();

            $base['wxapp_native_tabbar'] = $platform['wxapp_native_tabbar'];
            $base['wxapp_native_tabbar_shenhe'] = $platform['wxapp_native_tabbar_shenhe'];
            $base['wxapp_tabbar'] = iunserializer($platform['wxapp_tabbar']);
            $base['version'] = Db::name("bbfx")->order("id asc")->value("version_name");

            $huifubafang = iunserializer($platform['huifubafang']);
            $base['huifubafang_status'] = 0;
            if($huifubafang['status'] == 1){
                $base['huifubafang_status'] = 1;
            }

            $result = \app\common\model\bbfxshop\Weixin::getWxAccessToken();
            $base['is_gzh_login_ok'] = 0;
            if($result['code'] == 1){
                $base['is_gzh_login_ok'] = 1;
            }
            $base['dg_status'] = $_W['base']['platform']['dg_status'];

            $base['new_wxapp_login'] = $base['wxapp_login'];
            $base['wxapp_login'] = intval($base['new_wxapp_login'][0]);
            $base['new_h5_login'] = $base['h5_login'];
            $base['h5_login'] = intval($base['new_h5_login'][0]);
            $base['new_app_login'] = $base['app_login'];
            $base['app_login'] = intval($base['new_app_login'][0]);

            __success("操作成功",$base);
        }
        else{
            __error("平台未配置基础设置");
        }
    }
}
