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

namespace app\common\model\bbfxshop;

use think\Model;
use think\Db;


class Payroute extends Model
{
    public static function getSet(){
        global $_W;
        $base = $_W['base'];
        if(empty($base)){
            $base = \app\common\model\bbfxshop\Common::getConfig(true);
        }
        if(!in_array('payroute',$base['pay_plugin'])){
            return []; 
        }
        return $base['payroute'];
    }

    public static function getPayData($level){
        $set = self::getSet();
        if($set['status'] != 1){
            return __json(0,"未开启");
        }
        $level = intval($level);
        if($level < 0){
            return __json(0,"未绑定等级");
        }

        $query =  Db::name("bbfx_payroute_pay")->where(["uniacid"=>UNIACID,"level"=>$level])->find();
        if(empty($query)){
            return __json(0,"未绑定等级支付");
        }

        $pay = iunserializer($query['pay']);

        $pay['id'] = $query['id'];

        return __json(1,"操作成功",$pay);
    }
}