目录

封停/解封


封停/解封自定义函数

/**
 * @param int $usertype 账户类型:0=通行证,1=软件用户
 * @param string $username 用户名
 * @param int $state 状态:0=解封,1=封停
 * @param string $sid 软件SID,通行证封停无需填写
 * @return string
 */
function g_ban(int $usertype, string $username, int $state, string $sid = ''):string
{
    if ($usertype == 0) {
        $userInfo = dbFindOne('user', ['username' => $username], [], ['id']);
        if (!$userInfo) {
            return json_encode(['code'=>1,'msg'=>'通行证不存在']);
        }
        $updateId = dbUpdate('user', ['id' => $userInfo['id']], ['state' => $state == 0 ? 0 : 1]);
        if ($updateId) {
            return json_encode(['code'=>0,'msg'=>'操作成功']);
        } else {
            return json_encode(['code'=>1,'msg'=>'操作失败']);
        }
    } else {
        if (empty($sid)) {
            return json_encode(['code'=>1,'msg'=>'请填写软件sid']);
        }
        $userInfo = dbFindOne('user_softuser', ['username' => $username, 'sid' => $sid], [], ['id']);
        if (!$userInfo) {
            return json_encode(['code'=>1,'msg'=>'软件用户不存在']);
        }
        $updateId = dbUpdate('user_softuser', ['id' => $userInfo['id']], ['state' => $state == 0 ? 0 : 1]);
        if ($updateId) {
            return json_encode(['code'=>0,'msg'=>'操作成功']);
        } else {
            return json_encode(['code'=>1,'msg'=>'操作失败']);
        }
    }
}

调用方法

char tmp[1024];
hwd_callPHP("g_ban","0,用户名,0", tmp, 1024);
OutputDebugString(tmp);

易语言调用方法

操作返回 = 护卫盾_调用PHP函数("g_ban","0,用户名,0")
调试输出 (操作返回)