The mind of the King Small program PHP Source Construction Introduction (Huang . 1511.970.7084. Micro-Electric . need to prepare the head of the small program source package, collection of source commentary, server matching installation environment.
Using:
1. Technical Framework thinkphp5.0:
2,php version 5.5 above, database is mysql5.5, Instant Messenger We use this side Workerman Service
First, the head of the King php Answer source code small program development Dan Source Display
Qsqlquery query;
get the previous points from the database and add the latest points to the answer score
Query.prepare ("Select *from user_info WHERE name =?");
Query.addbindvalue (Name.toutf8 ());
Query.exec ();
Query.next ();
Tmpscore = Query.value (3). ToInt () + score;
Qdebug () << Tmpscore;
Switch (tmpscore/100)
{
Case 0:
Tmplevel = QString (" bronze ");
Break
Case 1:
Tmplevel = QString (" silver ");
Break
Case 2:
Tmplevel = QString (" gold ");
Break
Case 3:
Tmplevel = QString (" platinum ");
Break
Case 4:
Tmplevel = QString (" Diamond ");
Break
Case 5:
Tmplevel = QString (" star Yiu ");
Break
Case 6:
Tmplevel = QString (" king ");
Break
Default
Break
}
update scores and Duan
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<< (qint16) 0;
out<<sendtoclient1;
Out.device ()->seek (0);
out<< (qint16) (Block.size ()-sizeof (qint16));
Client->write (block, Block.length ());
Second, the head of the King php answer the source code applet Development Registration page, body setting, the Schedule topic section of the show:
Public
Explicit Mythread (Qtcpsocket *client, Qobject *parent = 0);
void run ();
void User_register (); User Registration Request
void User_login (); User Login Request
void User_match (); User matching request
void Sendques (); Distributing topics to users
Overloaded Timer functions
void TimerEvent (Qtimerevent *event);
Signals:
void Client_match_socket (Qtcpsocket *client); Send the client's socket to the main window to save
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 for client
Qsqldatabase DB; Database Handle
Qint16 blocksize;
Recv rec_msg; the information structure of the receiving body
Qvector<qstring> ques; Problem Dry
Qvector<qstring> Answer1; option 1
Qvector<qstring> Answer2; option 2
Qvector<qstring> Answer3; option 3
qvector<int> correct; correct answer
int Timeid; Timer
int num;
int count;
};
Third, the mind of the king PHP answer the source code small program features
1, friends battle, share creative copy
The Main page of the qualifying game shows the number of online players, click to play with online players PK . Score according to the correct rate of the answer and the length of time required.
Friends rank: Mind the King Small Program source code can see their ranking in friends, as well as ranking in the world rankings ( a bit exaggerated, winning in the mobile small part think should be based on the area of their own ranking ) , shared groups are also available - gold coins.
Even more surprisingly, the head of the small program every time a friend to challenge the same copy, the copy is still very heart.
2, two-dimensional code to generate business cards, simplify the entrance
This interface is a bright spot in the head of the small program source code user Information Bar next to the two-dimensional code, click to generate belong to the user's own business card.
When users share business cards in the circle of Friends, the "King of Mind" QR code will allow other users to scan, directly into the game, the entry of small programs more convenient.
Win in the mobile Mind the king of the small program source access to facilitate access to more players, but can not let players stay, for the game developers is also a very important link.
3, the topic toenhance user participation sense
Like many products, the "King of Mind" is also a daily check-in reward coins, active users to stimulate the retention. The difference is that in order to make users more involved, the game also allows users to participate in the question, examining links. It is this feature that occupies a large part of the "topic Factory" at the beginning of the main interface.
The head of the King php Answer source Small program , Mind King source package, Mind King Small program customization upgrade development services, provide software installation, commentary and other integrated information services. More information about the public number -Scarecrow software technology.
The head of the King Small program PHP Source construction Introduction