Exemple #1
0
func (a *Account) ClearStatus(mailbox rpc.Mailbox, msg *rpc.Message) (errcode int32, reply *rpc.Message) {
	r := server.NewMessageReader(msg)
	serverid, err := r.ReadString()
	if server.Check(err) {
		return 0, nil
	}

	server.Check2(db.sql.Exec("UPDATE `role_info` SET `status`=?, `serverid`=? WHERE `status`=? and `serverid`=?", 0, "", 1, serverid))
	log.LogMessage("clear server:", serverid)
	return 0, nil
}
Exemple #2
0
func (this *Database) Log(mailbox rpc.Mailbox, msg *rpc.Message) (errcode int32, reply *rpc.Message) {
	var log_name string
	var log_source, log_type int32
	var log_content, log_comment string

	if server.Check(server.ParseArgs(msg, &log_name, &log_source, &log_type, &log_content, &log_comment)) {
		return 0, nil
	}

	sqlconn := db.sql
	uid, err := sqlconn.GetUid("serial_no")
	if err != nil {
		log.LogError(err)
		return 0, nil
	}
	sql := fmt.Sprintf("INSERT INTO `log_data`(`serial_no`, `log_time`,`log_name`, `log_source`, `log_type`, `log_content`, `log_comment`) VALUES(?,?,?,?,?,?,?)")
	server.Check2(sqlconn.Exec(sql, uid, time.Now().Format(util.TIME_LAYOUT), log_name, log_source, log_type, log_content, log_comment))
	return 0, nil
}