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
5e3bd75c
Commit
5e3bd75c
authored
Nov 08, 2019
by
姚书霞
🐘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户组接口
parent
1b9eb45e
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 @
5e3bd75c
...
@@ -34,7 +34,7 @@ class ShopUserMembergradeController extends BaseController
...
@@ -34,7 +34,7 @@ class ShopUserMembergradeController extends BaseController
* @OA\Get(
* @OA\Get(
* path="/backend/web/v1/shopuser/shop-user-membergrades",
* path="/backend/web/v1/shopuser/shop-user-membergrades",
* tags={"用户&员工接口"},
* tags={"用户&员工接口"},
* summary="用户组列表接口",
* summary="用户组列表接口
(姚书侠)
",
* description="用户组列表接口",
* description="用户组列表接口",
* @OA\RequestBody(
* @OA\RequestBody(
* @OA\MediaType(
* @OA\MediaType(
...
@@ -54,11 +54,36 @@ class ShopUserMembergradeController extends BaseController
...
@@ -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(
* @OA\POST(
* path="/backend/web/v1/shopuser/shop-user-membergrades",
* path="/backend/web/v1/shopuser/shop-user-membergrades",
* tags={"用户&员工接口"},
* tags={"用户&员工接口"},
* summary="添加用户组接口",
* summary="添加用户组接口
(姚书侠)
",
* description="添加用户组接口",
* description="添加用户组接口",
* @OA\RequestBody(
* @OA\RequestBody(
* @OA\MediaType(
* @OA\MediaType(
...
@@ -97,15 +122,15 @@ class ShopUserMembergradeController extends BaseController
...
@@ -97,15 +122,15 @@ class ShopUserMembergradeController extends BaseController
}
elseif
(
!
$model
->
hasErrors
())
{
}
elseif
(
!
$model
->
hasErrors
())
{
throw
new
ServerErrorHttpException
(
'Failed to create the object for unknown reason.'
);
throw
new
ServerErrorHttpException
(
'Failed to create the object for unknown reason.'
);
}
}
return
1
;
return
$model
;
}
}
/**
/**
* @OA\P
OS
T(
* @OA\P
U
T(
* path="/backend/web/v1/shopuser/shop-user-membergrades/123",
* path="/backend/web/v1/shopuser/shop-user-membergrades/123
123
",
* tags={"用户&员工接口"},
* tags={"用户&员工接口"},
* summary="
添加用户组接口
",
* summary="
修改用户组接口(姚书侠)
",
* description="
添加
用户组接口",
* description="
修改
用户组接口",
* @OA\RequestBody(
* @OA\RequestBody(
* @OA\MediaType(
* @OA\MediaType(
* mediaType="application/json",
* mediaType="application/json",
...
@@ -115,7 +140,7 @@ class ShopUserMembergradeController extends BaseController
...
@@ -115,7 +140,7 @@ class ShopUserMembergradeController extends BaseController
* @OA\Property(property="GRADE_PERCENT",type="float"),
* @OA\Property(property="GRADE_PERCENT",type="float"),
* @OA\Property(property="IS_SETRANGE",type="string"),
* @OA\Property(property="IS_SETRANGE",type="string"),
* @OA\Property(property="MONEY_POINT_SRATE",type="float"),
* @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
...
@@ -123,29 +148,17 @@ class ShopUserMembergradeController extends BaseController
* security={{"Authorization": {}}}
* security={{"Authorization": {}}}
* )
* )
*/
*/
public
function
actionUpdate
()
public
function
actionUpdate
(
$id
)
{
{
echo
2
;
die
;
$model
=
$this
->
modelClass
::
findOne
(
$id
);
$model
=
new
$this
->
modelClass
();
$model
->
scenario
=
'update'
;
//创建的场景
$model
->
scenario
=
'create'
;
//创建的场景
$other_param
=
array
(
'GUID'
=>
Func
::
create_guid
(),
'ORG_GUID'
=>
'100'
,
//todo 公共变量
);
$model
->
setAttributes
(
$other_param
);
$model
->
setAttributes
(
Yii
::
$app
->
getRequest
()
->
post
());
$model
->
setAttributes
(
Yii
::
$app
->
getRequest
()
->
post
());
// $model->attributes = $other_param;
// print_r($model);die;
if
(
$model
->
save
()
===
false
&&
!
$model
->
hasErrors
())
{
if
(
$model
->
save
())
{
throw
new
ServerErrorHttpException
(
'Failed to update the object for unknown reason.'
);
$response
=
Yii
::
$app
->
getResponse
();
$response
->
setStatusCode
(
200
);
}
elseif
(
!
$model
->
hasErrors
())
{
throw
new
ServerErrorHttpException
(
'Failed to create the object for unknown reason.'
);
}
}
return
1
;
return
$model
;
}
}
}
}
\ No newline at end of file
backend/models/v1/shopuser/ShopUserMembergrade.php
View file @
5e3bd75c
...
@@ -110,7 +110,7 @@ class ShopUserMembergrade extends BaseModel
...
@@ -110,7 +110,7 @@ class ShopUserMembergrade extends BaseModel
// 'GUID',
// 'GUID',
// ];
// ];
// unset($fields['
']);
unset
(
$fields
[
'USER_POINTS
'
]);
return
$fields
;
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