コード例 #1
0
 /**
  * Order member properties
  * <b>Request Type: </b>PUT<br/>
  * <b>Request Endpoint: </b>http://{{server-domain}}/api/common/member-property/order<br/>
  * <b>Summary</b> This api is for ordering property for member.
  * <b>Request Parameters</b><br/>
  *
  * <pre>
  *     {
  *         "54a8efe6b81374334e8b4567": 3,
  *         "54a8efe6b81374334e8b4568": 2,
  *         "54a8efe6b81374334e8b4569": 1,
  *         "54a8efe6b81374334e8b4570": 4,
  *       }
  * </pre>
  */
 public function actionOrder()
 {
     $orderMap = $this->getParams();
     foreach ($orderMap as $id => $order) {
         if (!MemberProperty::updateAll(['order' => $order], ['_id' => $id])) {
             throw new ServerErrorHttpException("Failed to save property order with id " . $id);
         }
     }
     Yii::$app->getResponse()->setStatusCode(204);
 }