Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
newShopBack
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
newshop
newShopBack
Commits
175b745f
Commit
175b745f
authored
Nov 08, 2019
by
侯贺政
Browse files
Options
Browse Files
Download
Plain Diff
用户
parents
411f1c82
5e3bd75c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
28 deletions
+41
-28
ShopUserMembergradeController.php
...controllers/v1/shopuser/ShopUserMembergradeController.php
+40
-27
ShopUserMembergrade.php
backend/models/v1/shopuser/ShopUserMembergrade.php
+1
-1
No files found.
backend/controllers/v1/shopuser/ShopUserMembergradeController.php
View file @
175b745f
...
...
@@ -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\P
OS
T(
* path="/backend/web/v1/shopuser/shop-user-membergrades/123",
* @OA\P
U
T(
* path="/backend/web/v1/shopuser/shop-user-membergrades/123
123
",
* 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
backend/models/v1/shopuser/ShopUserMembergrade.php
View file @
175b745f
...
...
@@ -110,7 +110,7 @@ class ShopUserMembergrade extends BaseModel
// 'GUID',
// ];
// unset($fields['
']);
unset
(
$fields
[
'USER_POINTS
'
]);
return
$fields
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment