Commit 175b745f authored by 侯贺政's avatar 侯贺政

用户

parents 411f1c82 5e3bd75c
......@@ -34,7 +34,7 @@ class ShopUserMembergradeController extends BaseController
* @OA\Get(
* path="/backend/web/v1/shopuser/shop-user-membergrades",
* tags={"用户&员工接口"},
* summary="用户组列表接口",
* summary="用户组列表接口(姚书侠)",
* description="用户组列表接口",
* @OA\RequestBody(
* @OA\MediaType(
......@@ -54,11 +54,36 @@ class ShopUserMembergradeController extends BaseController
// }
/**
* @OA\Get(
* path="/backend/web/v1/shopuser/shop-user-membergrades/123123",
* tags={"用户&员工接口"},
* summary="用户组详情接口(姚书侠)",
* description="用户组详情接口",
* @OA\RequestBody(
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
*
* )
* )
* ),
* @OA\Response(response=200,description="成功时返回access-token"),
* security={{"Authorization": {}}}
* )
*/
//编辑用
public function actionView($id)
{
$model = $this->modelClass::findOne($id);
return $model;
}
/**
* @OA\POST(
* path="/backend/web/v1/shopuser/shop-user-membergrades",
* tags={"用户&员工接口"},
* summary="添加用户组接口",
* summary="添加用户组接口(姚书侠)",
* description="添加用户组接口",
* @OA\RequestBody(
* @OA\MediaType(
......@@ -97,15 +122,15 @@ class ShopUserMembergradeController extends BaseController
} elseif (!$model->hasErrors()) {
throw new ServerErrorHttpException('Failed to create the object for unknown reason.');
}
return 1;
return $model;
}
/**
* @OA\POST(
* path="/backend/web/v1/shopuser/shop-user-membergrades/123",
* @OA\PUT(
* path="/backend/web/v1/shopuser/shop-user-membergrades/123123",
* tags={"用户&员工接口"},
* summary="添加用户组接口",
* description="添加用户组接口",
* summary="修改用户组接口(姚书侠)",
* description="修改用户组接口",
* @OA\RequestBody(
* @OA\MediaType(
* mediaType="application/json",
......@@ -115,7 +140,7 @@ class ShopUserMembergradeController extends BaseController
* @OA\Property(property="GRADE_PERCENT",type="float"),
* @OA\Property(property="IS_SETRANGE",type="string"),
* @OA\Property(property="MONEY_POINT_SRATE",type="float"),
* example={"NAME":"用户组A", "IS_DEFAULT": "1","GRADE_PERCENT": 2.22,"IS_SETRANGE": "0","MONEY_POINT_SRATE":23.1},
* example={"NAME":"修改后用户组A", "IS_DEFAULT": "1","GRADE_PERCENT": 2.22,"IS_SETRANGE": "0","MONEY_POINT_SRATE":23.1},
* )
* )
* ),
......@@ -123,29 +148,17 @@ class ShopUserMembergradeController extends BaseController
* security={{"Authorization": {}}}
* )
*/
public function actionUpdate()
public function actionUpdate($id)
{
echo 2;die;
$model = new $this->modelClass();
$model->scenario = 'create';//创建的场景
$other_param = array(
'GUID'=>Func::create_guid(),
'ORG_GUID'=>'100',//todo 公共变量
);
$model->setAttributes($other_param);
$model = $this->modelClass::findOne($id);
$model->scenario = 'update';//创建的场景
$model->setAttributes(Yii::$app->getRequest()->post());
// $model->attributes = $other_param;
// print_r($model);die;
if ($model->save()) {
$response = Yii::$app->getResponse();
$response->setStatusCode(200);
} elseif (!$model->hasErrors()) {
throw new ServerErrorHttpException('Failed to create the object for unknown reason.');
if ($model->save() === false && !$model->hasErrors()) {
throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
}
return 1;
return $model;
}
}
\ No newline at end of file
......@@ -110,7 +110,7 @@ class ShopUserMembergrade extends BaseModel
// 'GUID',
// ];
// unset($fields['']);
unset($fields['USER_POINTS']);
return $fields;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment