【WeChat Payment】Share a failed project

This project was done last year. At the beginning, the client was still promoting it. After a few months, it was found that the server had been shut down. This is an application for posting pictures and guessing riddles. If users guess correctly, they will be rewarded with bonus packets, and the rewards can be withdrawn in cash. During the development, I was not very optimistic about the demand, and felt that the user stickiness was too low. Get all the programs out today. For interested partners to play.

Users come in directly from the official account and can do two things, one is to post reward puzzles, and the other is to answer the questions. Rewards for answering questions can be withdrawn. There were chat and friend functions before, but I thought it was too redundant, so I removed it again. The user's reward amount comes from WeChat payment or wallet balance. How do customers make money? There are several points. The first point is to find corporate users. The puzzle is an advertisement. The answer is to get the name of the product. The user enters the answer once and gets a reward to achieve the effect of advertising and gaining users. The second is the existing handling fee for withdrawal, and the third is that there is a certain threshold for withdrawal, for example, you can only withdraw cash when you reach 10 yuan. The fourth is to insert advertisements on the page of the correct answer. The puzzle is counted down. After the countdown, the remaining bounty will be returned to the user's wallet. The user can also choose to resend other people's puzzles or puzzles that have expired. Roughly such a form.

The website is based on Asp.net MVC4, which is equivalent to a mobile version of my previous Portal.MVC . The difference is that it integrates WeChat payment, WeChat login, WeChat sharing, and WeChat reflection and transfer. The front end uses zepto+SUI. I have introduced WeChat before, and this time it just happened to be put together. You may not like the interface, this is another matter, I am only responsible for the implementation of all codes~ Let’s take a look at the interface below.

 When it was released, there were indeed no two buttons for registration and login. I released it for the convenience of everyone playing on the computer. Click the WeChat icon in the official account to log in. The client lets me remember the status so I don't have to log in every time. I put the user's openid in localstorage. Then register here and use the SMS service of Ali Dayu. There should be a few messages now. If you are interested, you can play.

 I originally uploaded it with my own h5 plug-in, but some Androids still don’t support it, so I finally used the method of uploading pictures provided by WeChat. WeChat uploading is still too troublesome. It involves uploading to the WeChat server and then downloading it. You should use a plug-in similar to plupload to do such a thing.

 After the picture is uploaded, the original picture and thumbnail will be saved, and then the user will be asked to confirm the payment. When paying, it will judge whether the money in the user's wallet is enough to pay the reward this time. The js of WeChat payment is all in client.js. After completing the puzzle, other users can see the following page when they enter the puzzle. Of course, WeChat payment in this place is impossible to succeed on the web page, and it needs to be tested in the WeChat environment. For details, please refer to: Official account payment . If you want to play this on the computer, how to recharge, the answer is very simple, that is to change the database~~. There is a table of wallets in the database.

 So take the initiative to do it, and have enough food and clothing. The lockMoney here is the locked amount of the puzzle. When the puzzle expires and the reward is not collected, it will be refunded to the user's account. This is executed by a timing service in the background. For details, please refer to the JobCheckQuestionTimeJob object under Portal.MVC.Models.Job

 Prompt the current bounty to encourage users to answer the question. There are three modes of puzzles, average bounty, decreasing and one person winning

 If the user answers correctly, they are rewarded with a bounty. There is an ad at the bottom of this page. Users are also encouraged to ask questions again.

 

 After the user answers correctly, he can get a reward. The functions of this page are all in the UserCenter Controller. The payment and withdrawal are all designed in the PaymentController. The order of withdrawal is to check whether the amount withdrawn by the user is correct. Existing amount >= withdrawal amount + handling fee. Then create an order, then transfer the amount from the database, and finally /Checkout/CashTransfers transfers the money from the business account to the user's WeChat change.

 

 

There are several back-end modules, and some statistics are made, and Matrix Admin is still used for the template.

The table of the database is as follows, and MenuStatistics is used to count the visited pages. In fact, it doesn't help. Others are comments, shares, answers, puzzles, permissions, and users can be understood at a glance, so there is no need to repeat them.

 Because it is codefirst mode, after configuring the mssql database address in webconfig, it can be run directly. After the website is up, first run /Install

 

This method initializes some data. Includes policies, system wallets, permissions and administrators. Backend administrator Admin, password admin. You can also change it to your own liking. If you want more test accounts. The InsertTestUsers method can be called and five test users will be created. If you want to deploy to your own official account, in addition to registering the official account, merchant, and setting the payment address, then you need to modify the parameters in Config under WxPayApi/lib .

Summary : Although it is a failed project, it is sorted out for everyone to play with. If you have any questions or ideas, you can leave a message. If you like it, give me a hand.

Guess you like

Origin blog.csdn.net/q2243088760/article/details/130824051