| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package controller
- import (
- "gframe/service"
- "net/http"
- )
- type Test struct {
- BaseController
- }
- // UserAdd godoc
- // @Summary 会员用户添加
- // @tags Test
- // @Description 会员用户添加
- // @Accept x-www-form-urlencoded
- // @Produce json
- // @Param name formData string true "姓名"
- // @Success 200 {object} controller.ResponseBase
- // @Router /Test/UserAdd [post]
- func (t *Test) UserAdd() (err error) {
- name := t.postString("name", true)
- err = service.Test{}.UserAdd(name)
- if err != nil {
- return
- }
- t.Ctx().JSON(http.StatusOK, newResponseBase())
- return
- }
- type UserList struct {
- ResponseBase
- Rs []interface{}
- //Rs []*gorm.ShopUserSimpleInfo
- }
- // UserListQuery godoc
- // @Summary 会员用户查询
- // @tags Test
- // @Description 会员用户查询
- // @Accept x-www-form-urlencoded
- // @Produce json
- // @Success 200 {object} controller.UserList
- // @Router /Test/UserListQuery [post]
- func (t *Test) UserListQuery() (err error) {
- rs, err := service.Test{}.UserListQuery()
- if err != nil {
- return
- }
- rp := UserList{
- newResponseBase(),
- rs,
- }
- t.Ctx().JSON(http.StatusOK, rp)
- return
- }
|