[Daily] project bound phone business phone number to verify achieve

During setting up automatic forwarding, deletions letter rule, modifying their password, the mobile phone must be bound to increase security and to verify the phone number of the authentication operation using the inversion control in the process of design patterns can be packaged in a separate class flexible complex and adjustment logic with codes

First, the definition of a class SecureTel class, which provides all business methods. SecureTel when generating an object, the method requires the use of a generated object provides the framework to operate, not directly to the new class, this method is Sina_Application :: resource ( 'securetel'), in this generator, the method will be to call createResource SecureTel class, and will be based on the configuration file into the parameter passing.

SecureTel new class can be carried out in its own object createResource method, and the parameter configuration file may be set to their properties, the service may be determined based on attributes other methods

Through the above processing, flexibility in the use of this class of each interface controller code, the code for the purpose of reuse. And may control the properties of the class in the configuration file directly, without adjustment operations performed when convenient logic to modify the interior of the class

In the code above is the design level, is described in the following business levels at
1. After the request came, because in this logic will not have high concurrent situation, query the database directly bound phone table, whether or not the phone is already bound If the phone is not bound directly returns the corresponding error code
2. bound phone case, go to memcache queries whether authenticated or not, is the key "c: [email protected]", this key expiration time of day If there is value, indicating verified, no value is returned another error code
3. in the configuration file, you can configure whether to open the phone verification function to prevent in the SMS interface is not, affect the user operation, you can turn off all direct business verification. this configuration corresponds to
a class attribute SecureTel, other methods of determination of the property
expires after the configuration file 4. authentication can be configured, this can be flexibly modified in the test, so that tests can be multiple short test.
5. the front end of different error codes for different pop, pop bound phone handset and verification popups

Guess you like

Origin www.cnblogs.com/taoshihan/p/11727718.html