<?php
/**
 * Created by sublime.
 * User: wosinC
 * Date: 2017/12/2
 * Time: 上午11:39
 */

namespace App\Modules\OfficialAccount\Services;

use App\Libs\SMS;
use App\Modules\OfficialAccount\Models\DistributionSelfDefineConfig;
use App\Modules\OfficialAccount\Models\OfficialAccount;
use App\Modules\OfficialAccount\Models\OfficialAuthUrl;
use App\Modules\User\Services\UserService;
use DB;
use GuzzleHttp\Client;
use Redis;

class PaySubstituteSwitchService
{
    public static function getChannelSwitch($channel_id){
        $switch = DistributionSelfDefineConfig::where([
            ['type','=','pay_substitute_switch'],
            ['distribution_channel_id','=',$channel_id]
        ])->first();
        if($switch){
            return $switch->status;
        }
        return 1;
    }

    public static function setChannelSwitch($channel_id,$switch) {
        return DistributionSelfDefineConfig::updateOrCreate(
            ['distribution_channel_id'=>$channel_id,'type'=>'pay_substitute_switch'],
            ['status'=>$switch]
        );
    }
}