头脑王者源代码包

头脑王者源代码包开发(黄忆.1511.970.7084.微电.)提供头脑王者小程序源码包,集合源码解说、服务器匹配安装服务等。

采用:

1、技术框架thinkphp5.0:

2、php版本5.5以上、数据库是mysql5.5,即时通讯我们这边用到workerman服务

一、头脑王者php答题小程序源码开发段位源码展示

QSqlQuery query;

//先从数据库中获取之前的积分,将本次答题得分相加得到最新的积分

query.prepare("SELECT *FROM user_info WHERE name = ? ");

query.addBindValue(name.toUtf8());

query.exec();

query.next();

tmpScore = query.value(3).toInt() + score;

qDebug()

switch(tmpScore / 100)

{

case 0:

tmpLevel = QString("青铜");

break;

case 1:

tmpLevel = QString("白银");

break;

case 2:

tmpLevel = QString("黄金");

break;

case 3:

tmpLevel = QString("铂金");

break;

case 4:

tmpLevel = QString("钻石");

break;

case 5:

tmpLevel = QString("星耀");

break;

case 6:

tmpLevel = QString("王者");

break;

default:

break;

}

//更新得分和段位

query.prepare("UPDATE user_info SET level = ?, total = ? WHERE name = ?");

query.addBindValue(tmpLevel.toUtf8());

query.addBindValue(tmpScore);

query.addBindValue(name.toUtf8());

query.exec();

sendToClient1.cmd = UPDATESCORE;

sendToClient1.level = tmpLevel;

sendToClient1.total = tmpScore;

QByteArray block;

QDataStream out(&block, QIODevice::WriteOnly);

out

out

out.device()->seek(0);

out

client->write(block, block.length());

二、头脑王者源代码包开发注册页面、体型设置、赛程题目版块版块展示:

public:

explicit Mythread(QTcpSocket *client, QObject *parent = 0);

void run();

void user_Register(); //用户注册申请

void user_Login(); //用户登录申请

void user_match(); //用户匹配申请

void sendQues(); //向用户分发题目

//重载定时器函数

void timerEvent(QTimerEvent *event);

signals:

void client_match_socket(QTcpSocket *client); //将客户端的socket发给 主窗口保存

void send_user_info(QString name, QTcpSocket* client);

void send_trans_score(QTcpSocket* client, int score, QString name);

void send_match_result(QTcpSocket* client, int score);

void removeFromMap(QTcpSocket* client);

public slots:

void dealClientData();

private:

QTcpSocket *client; //客户端的socket

QSqlDatabase db; //数据库句柄

qint16 blocksize;

Recv Rec_msg; //接收的信息结构体

QVector ques; //题干

QVector answer1; //选项1

QVector answer2; //选项2

QVector answer3; //选项3

QVector correct; //正确答案

int timeID; //定时器

int num;

int count;

};

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20180712G1CTKK00?refer=cp_1026
  • 腾讯「云+社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 yunjia_community@tencent.com 删除。

扫码关注云+社区

领取腾讯云代金券