| Conditions | 5 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | public function run() |
||
| 10 | { |
||
| 11 | $model = new OrderDeposit(); |
||
| 12 | $data = json_decode(base64_decode(Yii::$app->request->getBodyParam('data')), true); |
||
| 13 | $model->equipment = $data['gameArea']['name'] ?? '无'; |
||
| 14 | $model->serverinfo = $data['gameServer']['name'] ?? '无'; |
||
| 15 | $model->raw = json_encode($data); |
||
| 16 | if ($model->load($data, '') && $model->validate() && $model->save()) { |
||
| 17 | Yii::$app->response->setStatusCode(201); |
||
| 18 | } elseif (!$model->hasErrors()) { |
||
| 19 | throw new yii\web\ServerErrorHttpException('Failed to create the object for unknown reason.'); |
||
| 20 | } |
||
| 21 | return $model; |
||
| 22 | } |
||
| 23 | } |
||
| 24 |