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

namespace app\admin\controller\bbfxshop\transfer_account;

use app\admin\controller\bbfxshop\Base;
use think\Db;


class Config extends Base
{

    public $model = null;
    public function _initialize(){
        parent::_initialize();
        $this->model = new \app\common\model\bbfxshop\TransferAccount;
    }
    
    public function set(){
        $params = $this->param();
        
        $config = Db::name("bbfx_transfer_account")->where(["uniacid"=>UNIACID])->find();
        
        $data = array(
            "uniacid"=>UNIACID,
      	    "status"=>intval($params['status']),
      	    "service_charges1"=>intval($params['service_charges1']),
      	    "service_charges2"=>intval($params['service_charges2']),
      	    "service_charges3"=>intval($params['service_charges3']),
      	    "service_charges4"=>intval($params['service_charges4']),
      	    "balance_status"=>intval($params['balance_status']),
      	    "score_status"=>intval($params['score_status']),
      	    "repurchase_currency_status"=>intval($params['repurchase_currency_status']),
      	    "contribute_vadded_status"=>intval($params['contribute_vadded_status']),
      	    "is_crossline"=>intval($params['is_crossline']),
        );
        
        
    	if(!empty($config)){
    	    $res = Db::name("bbfx_transfer_account")->where(["id"=>$config['id']])->update($data);
        }
      	else{
        	$res = Db::name("bbfx_transfer_account")->insert($data);
        }
        
        
        if($res){
            \app\admin\model\AdminLog::record("","",$data,"bbfx_transfer_account");
            __success("编辑成功",$data);
        }
      	else{
      	    __success("操作成功",$data);
      	}
    }
}