Category: Web Framework
-
Post Views: 17 1. Configure the client through the application component, \common\config\main-local.php 2. Set the format used for the request content to json through the setFormat() method, \common\logics\http\yqdsj_api\article.php 3. When using the REST API, since the request format is all JSON, in order to simplify the code, the format of the request object can be directly configured. by configuring[[\yii\httpclient\Client]] requestConfig…
-
Post Views: 53 1. Use updateAll() to update the value of prev_status to the value of status, and update the value of status to 4, the table structure is shown in Figure 1 2. Based on the query builder, the code is as follows 3. However, it does not meet the expectations. The values of prev_status are updated with 0,…
-
Post Views: 12 1. Edit \api\config\urlmanager.php, define the route to support put close/{id} 2. Edit \API\Controllers\PlantaskController.php, and define the action to support the close method 3. Edit \API\RESTS\plan_task\action.php, copy public function findModel($id) to public function findModels($id) to support finding multiple models 4. All IDs must exist, otherwise the response will fail, as shown in Figure 1 5. Create a new…
-
Post Views: 17 1. The model class file in the /common/models directory is only allowed to be generated by the GII tool, which is a common model data layer, as shown in Figure 1 2. The model file in the /common/logics directory is related to business logic, which is inherited to /common/models The data layer is the common model logic…
-
Post Views: 16 1. \API\RESTS\PLAN_TASK\CreateAction.php, please refer to the URL for the specific implementation:https://github.com/yiisoft/yii2/blob/master/docs/guide-zh-CN/input-tabular-input.md, the code is as follows: 2. On Postman, the request parameters are shown in Figure 1 3. At the request of the front-end, add the form name, \api\rests\plan_task\createaction.php, the code is as follows 4. \common\logics\plantask.php, the code is as follows 5. On Postman, the request parameters…
-
Post Views: 73 1. Delete the controller \API\Controllers\SiteController.php, delete the model \api\models\contactform.php, \api\models\loginform.php, \api\models\PasswordResetRequ estform.php, \api\models\resetpasswordform.php, \api\models\signupform.php, delete the directory (view related) \api\views, \api\assets, \api\web\css 2. Delete the relevant files of the test (unit test, functional test, acceptance test), delete \api\tests\acceptance\homecest.php, delete \API\Tests\Functional\AboutCest.php, \API\Tests\Functional\ContactCest.php, \API\Tests\Functio NAL\HOMECEST.php, \API\Tests\Functional\logincest.php, \api\tests\functional\signupcest.php, delete \API\Tests\Unit\Models\ContactFormTest.php, \API\Tests\Unit\Models\PasswordResetRequestFormTest .php, \api\tests\unit\models\resetpasswordformtest.php, \api\tests\unit\models\signupformtest.php 3. Run all the sample tests,…