<?php
QUnit_Global::includeClass('QUnit_Messager');

class Affiliate_Merchants_Bl_Binding
{
    function Affiliate_Merchants_Bl_Binding()
    {
    }

    function getBindList($aid) {
        $query = 'select * from `wd_g_affclientrelationship` where `affid`="'.$aid.'"';
        $rs = $GLOBALS['db']->Query($query);
        $GLOBALS['dbrequests']++;
        return $rs;
    }

    function isEnable() {
        //检查系统是否开启绑定
        $query = 'select * from `wd_g_settings` where `rtype`=3 and `code`="Aff_bindcust" and `value`="enable" and `accountid`="default1"';
        $rs = $GLOBALS['db']->Query($query);
        $GLOBALS['dbrequests']++;
        if(!$rs || $rs->EOF) {
            return false;
        }
        return true;
    }

    //根据绑定关系表的ID进行解绑
    function unBind($id) {
        $GLOBALS['db']->Execute('delete from `wd_g_affclientrelationship` where `ID`='.$id);
        $GLOBALS['dbrequests']++;
        QUnit_Messager::setOKMessage(L_G_BINDCUST_UNBINDSUCCESS);
    }

}
?>