作者 唐旭辉

提交存储

@@ -34,3 +34,7 @@ @@ -34,3 +34,7 @@
34 | 机会&审批 模板 | 未开始 | | | | 34 | 机会&审批 模板 | 未开始 | | | |
35 | 机会&审批 模板 | 未开始 | | | | 35 | 机会&审批 模板 | 未开始 | | | |
36 | 机会&审批 模板 | 未开始 | | | | 36 | 机会&审批 模板 | 未开始 | | | |
  37 +| 机会类型设置 | 未开始 | | | |
  38 +| 机会类型设置 | 未开始 | | | |
  39 +| 机会类型设置 | 未开始 | | | |
  40 +| 机会类型设置 | 未开始 | | | |
@@ -95,3 +95,14 @@ func (c *AuthController) ChangeCompany() { @@ -95,3 +95,14 @@ func (c *AuthController) ChangeCompany() {
95 msg = protocol.NewReturnResponse(logintoken, err) 95 msg = protocol.NewReturnResponse(logintoken, err)
96 return 96 return
97 } 97 }
  98 +
  99 +func (c *AuthController) Me() {
  100 + var msg *protocol.ResponseMessage
  101 + defer func() {
  102 + c.ResposeJson(msg)
  103 + }()
  104 + // userid := c.GetUserId()
  105 + // companyid := c.GetCompanyId()
  106 +
  107 + return
  108 +}
@@ -3,11 +3,12 @@ package controllers @@ -3,11 +3,12 @@ package controllers
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
5 "fmt" 5 "fmt"
6 - "github.com/astaxie/beego"  
7 - "github.com/astaxie/beego/validation"  
8 "oppmg/common/log" 6 "oppmg/common/log"
9 "oppmg/protocol" 7 "oppmg/protocol"
10 "strconv" 8 "strconv"
  9 +
  10 + "github.com/astaxie/beego"
  11 + "github.com/astaxie/beego/validation"
11 ) 12 )
12 13
13 //BaseController 基础 14 //BaseController 基础
@@ -72,11 +73,13 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R @@ -72,11 +73,13 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R
72 valid := validation.Validation{} 73 valid := validation.Validation{}
73 result, err = valid.Valid(obj) 74 result, err = valid.Valid(obj)
74 if err != nil { 75 if err != nil {
  76 + log.Error("参数校验失败:%s", err)
75 msg = protocol.BadRequestParam("1") 77 msg = protocol.BadRequestParam("1")
76 return 78 return
77 } 79 }
78 if !result { 80 if !result {
79 - msg = protocol.BadRequestParam("2") 81 + log.Error("校验结果:%v", result)
  82 + msg = protocol.BadRequestParam("1")
80 return 83 return
81 } 84 }
82 85
@@ -28,6 +28,7 @@ func (this *BulletinController) BulletinRelease() { @@ -28,6 +28,7 @@ func (this *BulletinController) BulletinRelease() {
28 uid := this.GetUserId() 28 uid := this.GetUserId()
29 companyId := this.GetCompanyId() 29 companyId := this.GetCompanyId()
30 if companyId <= 0 { 30 if companyId <= 0 {
  31 + log.Debug("companyId:%d err", companyId)
31 msg = protocol.BadRequestParam("1") 32 msg = protocol.BadRequestParam("1")
32 return 33 return
33 } 34 }
@@ -81,8 +81,8 @@ func (c *CompanyController) DepartmentAdd() { @@ -81,8 +81,8 @@ func (c *CompanyController) DepartmentAdd() {
81 msg = protocol.BadRequestParam("1") 81 msg = protocol.BadRequestParam("1")
82 return 82 return
83 } 83 }
84 - err := servecompany.DepartmentAdd(param)  
85 - msg = protocol.NewReturnResponse(nil, err) 84 + result, err := servecompany.DepartmentAdd(param)
  85 + msg = protocol.NewReturnResponse(result, err)
86 return 86 return
87 } 87 }
88 88
@@ -28,36 +28,9 @@ var LogRequestData = func(ctx *context.Context) { @@ -28,36 +28,9 @@ var LogRequestData = func(ctx *context.Context) {
28 } 28 }
29 } 29 }
30 30
31 -//CheckSign Before Router  
32 -// var CheckSign = func(ctx *context.Context) {  
33 -// var (  
34 -// headTimeStamp string  
35 -// headUuid string  
36 -// headAccessToken string  
37 -// headSign string  
38 -// signHex string  
39 -// )  
40 -// headTimeStamp = ctx.Input.Header(protocol.HeaderTimestamp)  
41 -// headUuid = ctx.Input.Header(protocol.HeaderUUID)  
42 -// headSign = ctx.Input.Header(protocol.HeaderSign)  
43 -// setsign := fmt.Sprintf("v!(MmM%v%v%vMmM)i^", headTimeStamp, headUuid, headAccessToken)  
44 -// sha256 := sha256.New()  
45 -// sha256.Write([]byte(setsign))  
46 -// signHex = hex.EncodeToString(sha256.Sum(nil))  
47 -// if strings.Compare(signHex, headSign) != 0 {  
48 -// msg := protocol.BadRequestParam("113")  
49 -// ctx.Output.JSON(msg, false, false)  
50 -// return  
51 -// }  
52 -// return  
53 -// }  
54 -  
55 //AuthToken Before Router 31 //AuthToken Before Router
56 var AuthToken = func(ctx *context.Context) { 32 var AuthToken = func(ctx *context.Context) {
57 log.Debug("执行中间件AuthToken") 33 log.Debug("执行中间件AuthToken")
58 - if beego.BConfig.RunMode != "prod" {  
59 - return  
60 - }  
61 var ( 34 var (
62 storetoken redisdata.RedisLoginToken 35 storetoken redisdata.RedisLoginToken
63 msg *protocol.ResponseMessage 36 msg *protocol.ResponseMessage
@@ -94,7 +67,7 @@ var AuthToken = func(ctx *context.Context) { @@ -94,7 +67,7 @@ var AuthToken = func(ctx *context.Context) {
94 ctx.Output.JSON(msg, false, false) 67 ctx.Output.JSON(msg, false, false)
95 return 68 return
96 } 69 }
97 - msg = protocol.NewMesage("10024") 70 + msg = protocol.NewMesage("1")
98 ctx.Output.JSON(msg, false, false) 71 ctx.Output.JSON(msg, false, false)
99 return 72 return
100 } 73 }
@@ -123,4 +96,7 @@ var LogRouter = func(ctx *context.Context) { @@ -123,4 +96,7 @@ var LogRouter = func(ctx *context.Context) {
123 return 96 return
124 } 97 }
125 98
126 -//登录失效 99 +//CheckOperation 检查操作权限,beforeController
  100 +var CheckOperation = func(ctx *context.Context) {
  101 +
  102 +}
@@ -46,3 +46,19 @@ type RequestSwapCompany struct { @@ -46,3 +46,19 @@ type RequestSwapCompany struct {
46 type ResponseSwapCompany struct { 46 type ResponseSwapCompany struct {
47 LoginAuthToken 47 LoginAuthToken
48 } 48 }
  49 +
  50 +//ResponseMeInfo 用户个人的me信息
  51 +type ResponseMeInfo struct {
  52 + NickName string `json:"nick_name"`
  53 + Icon string `json:"icon"`
  54 + Companyid int64 `json:"company_id"`
  55 + Companyname string `json:"company_name"`
  56 + Logo string `json:"logo"`
  57 + Companys []MeCompany `json:"companys"`
  58 + // Menu
  59 +}
  60 +
  61 +type MeCompany struct {
  62 + Id int64 `json:"id"`
  63 + Name string `json:"name"`
  64 +}
@@ -8,6 +8,10 @@ type RequestDepartmentAdd struct { @@ -8,6 +8,10 @@ type RequestDepartmentAdd struct {
8 Managers []int64 `json:"manages"` //主管userid 8 Managers []int64 `json:"manages"` //主管userid
9 } 9 }
10 10
  11 +type ResponseDepartmenrAdd struct {
  12 + DepartmentId int64 `json:"id"` // 部门id
  13 +}
  14 +
11 type DepartmentManager struct { 15 type DepartmentManager struct {
12 Id int64 `json:"id"` 16 Id int64 `json:"id"`
13 Name string `json:"name"` 17 Name string `json:"name"`
@@ -31,8 +31,7 @@ type RequestRoleEdit struct { @@ -31,8 +31,7 @@ type RequestRoleEdit struct {
31 type ResponseRoleInfo struct { 31 type ResponseRoleInfo struct {
32 ID int64 `json:"id"` 32 ID int64 `json:"id"`
33 Name string `json:"name"` 33 Name string `json:"name"`
34 - Descript string `json:"descript"`  
35 - Types int8 `json:"types"` 34 + Types int8 `json:"type"`
36 } 35 }
37 36
38 //RequestRoleList 分页获取角色列表 37 //RequestRoleList 分页获取角色列表
@@ -57,7 +57,7 @@ func init() { @@ -57,7 +57,7 @@ func init() {
57 57
58 //routerPermission 路由对应的权限 58 //routerPermission 路由对应的权限
59 // var routerPermission = map[string]string{ 59 // var routerPermission = map[string]string{
60 -// "get:/v1/company/:companyid/position": "show", 60 +// : "show",
61 // "post:/v1/company/position": "add", 61 // "post:/v1/company/position": "add",
62 // "put:/v1/company/position": "edit", 62 // "put:/v1/company/position": "edit",
63 // "delete:/v1/company/position": "delete", 63 // "delete:/v1/company/position": "delete",
@@ -227,7 +227,7 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro @@ -227,7 +227,7 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro
227 err error 227 err error
228 logintoken protocol.LoginAuthToken 228 logintoken protocol.LoginAuthToken
229 uclientReturn ucenter.ResponseLogin 229 uclientReturn ucenter.ResponseLogin
230 - companyids []int64 230 + companys []companybase
231 companyid int64 231 companyid int64
232 userdata *models.User 232 userdata *models.User
233 ) 233 )
@@ -240,15 +240,15 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro @@ -240,15 +240,15 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro
240 log.Debug("userdata.IsEnable()==false") 240 log.Debug("userdata.IsEnable()==false")
241 return logintoken, protocol.NewErrWithMessage("10021") 241 return logintoken, protocol.NewErrWithMessage("10021")
242 } 242 }
243 - if companyids, err = getUserCompanyReal(userdata.Id); err != nil { 243 + if companys, err = getUserCompanyReal(userdata.Id); err != nil {
244 log.Error("getUserCompanyReal err:%s", err) 244 log.Error("getUserCompanyReal err:%s", err)
245 return logintoken, protocol.NewErrWithMessage("10021") 245 return logintoken, protocol.NewErrWithMessage("10021")
246 } 246 }
247 - if len(companyids) == 0 { 247 + if len(companys) == 0 {
248 log.Debug("no company") 248 log.Debug("no company")
249 return logintoken, protocol.NewErrWithMessage("10021") 249 return logintoken, protocol.NewErrWithMessage("10021")
250 } 250 }
251 - companyid = companyids[0] 251 + companyid = companys[0].Id
252 param := ucenter.RequesLogin{ 252 param := ucenter.RequesLogin{
253 Phone: account, 253 Phone: account,
254 Password: password, 254 Password: password,
@@ -272,15 +272,22 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro @@ -272,15 +272,22 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro
272 return logintoken, err 272 return logintoken, err
273 } 273 }
274 274
  275 +type companybase struct {
  276 + Id int64 `orm:"column(id)"`
  277 + Name string `orm:"coumn(name)"`
  278 + Logo string `orm:"coumn(logo)"`
  279 +}
  280 +
275 //getUserCompanyReal 获取用户有效的公司id 281 //getUserCompanyReal 获取用户有效的公司id
276 -func getUserCompanyReal(userid int64) (companyids []int64, err error) { 282 +func getUserCompanyReal(userid int64) (companyids []companybase, err error) {
277 const ( 283 const (
278 datasql0 string = `SELECT b.company_id FROM user_company AS b 284 datasql0 string = `SELECT b.company_id FROM user_company AS b
279 WHERE b.delete_at=0 AND b.enable = 1 AND b.user_id=?` 285 WHERE b.delete_at=0 AND b.enable = 1 AND b.user_id=?`
280 - datasql2 string = `SELECT b.id FROM company AS b 286 + datasql2 string = `SELECT b.id,a.name,a.logo FROM company AS b
281 WHERE b.delete_at=0 AND b.enable = 1 AND b.id in (%s) ` 287 WHERE b.delete_at=0 AND b.enable = 1 AND b.id in (%s) `
282 ) 288 )
283 var ( 289 var (
  290 + companys []companybase
284 ids []string 291 ids []string
285 ) 292 )
286 err = utils.ExecuteQueryAll(&ids, datasql0, userid) 293 err = utils.ExecuteQueryAll(&ids, datasql0, userid)
@@ -288,7 +295,7 @@ func getUserCompanyReal(userid int64) (companyids []int64, err error) { @@ -288,7 +295,7 @@ func getUserCompanyReal(userid int64) (companyids []int64, err error) {
288 log.Error("EXECUTE SQL err:%s", err) 295 log.Error("EXECUTE SQL err:%s", err)
289 return nil, err 296 return nil, err
290 } 297 }
291 - if len(ids) == 0 { 298 + if len(companys) == 0 {
292 return nil, nil 299 return nil, nil
293 } 300 }
294 datasql3 := fmt.Sprintf(datasql2, strings.Join(ids, ",")) 301 datasql3 := fmt.Sprintf(datasql2, strings.Join(ids, ","))
@@ -297,5 +304,45 @@ func getUserCompanyReal(userid int64) (companyids []int64, err error) { @@ -297,5 +304,45 @@ func getUserCompanyReal(userid int64) (companyids []int64, err error) {
297 log.Error("EXECUTE SQL err:%s", err) 304 log.Error("EXECUTE SQL err:%s", err)
298 return nil, err 305 return nil, err
299 } 306 }
300 - return companyids, nil 307 + return companys, nil
  308 +}
  309 +
  310 +func UserBaseInfo(userid, companyid int64) (protocol.ResponseMeInfo, error) {
  311 + var (
  312 + err error
  313 + userinfo *models.User
  314 + companylist []companybase
  315 + meInfo protocol.ResponseMeInfo
  316 + currentCompany *models.Company
  317 + )
  318 + userinfo, err = models.GetUserById(userid)
  319 + if err != nil {
  320 + log.Error("GetUserById(%d) err:%s", userid, err)
  321 + return meInfo, protocol.NewErrWithMessage("1", err)
  322 + }
  323 + currentCompany, err = models.GetCompanyById(companyid)
  324 + if err != nil {
  325 + log.Error("GetCompanyById(%d) err:%s", companyid, err)
  326 + return meInfo, protocol.NewErrWithMessage("1", err)
  327 + }
  328 + companylist, err = getUserCompanyReal(userid)
  329 + if err != nil {
  330 + log.Error("getUserCompanyReal(%d) err:%s", userid, err)
  331 + return meInfo, protocol.NewErrWithMessage("1", err)
  332 + }
  333 + meInfo = protocol.ResponseMeInfo{
  334 + NickName: userinfo.NickName,
  335 + Icon: userinfo.Icon,
  336 + Companyid: currentCompany.Id,
  337 + Companyname: currentCompany.Name,
  338 + Logo: currentCompany.Logo,
  339 + }
  340 + for _, v := range companylist {
  341 + t := protocol.MeCompany{
  342 + Id: v.Id,
  343 + Name: v.Name,
  344 + }
  345 + meInfo.Companys = append(meInfo.Companys, t)
  346 + }
  347 + return meInfo, nil
301 } 348 }
@@ -12,9 +12,10 @@ import ( @@ -12,9 +12,10 @@ import (
12 "github.com/astaxie/beego/orm" 12 "github.com/astaxie/beego/orm"
13 ) 13 )
14 14
15 -func DepartmentAdd(param protocol.RequestDepartmentAdd) error { 15 +func DepartmentAdd(param protocol.RequestDepartmentAdd) (protocol.ResponseDepartmenrAdd, error) {
16 var ( 16 var (
17 parentDepart *models.Department 17 parentDepart *models.Department
  18 + returndata protocol.ResponseDepartmenrAdd
18 err error 19 err error
19 ) 20 )
20 if param.ParentID > 0 { 21 if param.ParentID > 0 {
@@ -22,12 +23,12 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error { @@ -22,12 +23,12 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error {
22 if err != nil { 23 if err != nil {
23 e := fmt.Errorf("GetDepartmentById(%d) err:%s", param.ParentID, err) 24 e := fmt.Errorf("GetDepartmentById(%d) err:%s", param.ParentID, err)
24 log.Error(e.Error()) 25 log.Error(e.Error())
25 - return protocol.NewErrWithMessage("1", e) 26 + return returndata, protocol.NewErrWithMessage("1", e)
26 } 27 }
27 if parentDepart.CompanyId != param.CompanyID { 28 if parentDepart.CompanyId != param.CompanyID {
28 e := fmt.Errorf("parentDepart.CompanyId != param.CompanyID") 29 e := fmt.Errorf("parentDepart.CompanyId != param.CompanyID")
29 log.Error(e.Error()) 30 log.Error(e.Error())
30 - return protocol.NewErrWithMessage("1", e) 31 + return returndata, protocol.NewErrWithMessage("1", e)
31 } 32 }
32 } 33 }
33 for _, v := range param.Managers { 34 for _, v := range param.Managers {
@@ -35,7 +36,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error { @@ -35,7 +36,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error {
35 if err != nil { 36 if err != nil {
36 e := fmt.Errorf("GetUserCompanyBy(userid,companyid)[%d, %d] err:%s", v, param.CompanyID, err) 37 e := fmt.Errorf("GetUserCompanyBy(userid,companyid)[%d, %d] err:%s", v, param.CompanyID, err)
37 log.Error(e.Error()) 38 log.Error(e.Error())
38 - return protocol.NewErrWithMessage("1", e) 39 + return returndata, protocol.NewErrWithMessage("1", e)
39 } 40 }
40 } 41 }
41 departmentAdd := &models.Department{ 42 departmentAdd := &models.Department{
@@ -54,24 +55,25 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error { @@ -54,24 +55,25 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error {
54 o.Rollback() 55 o.Rollback()
55 e := fmt.Errorf("AddDepartment err:%s", err) 56 e := fmt.Errorf("AddDepartment err:%s", err)
56 log.Error(e.Error()) 57 log.Error(e.Error())
57 - return protocol.NewErrWithMessage("1", e) 58 + return returndata, protocol.NewErrWithMessage("1", e)
58 } 59 }
59 err = departmentAdd.SetRelation(parentDepart) 60 err = departmentAdd.SetRelation(parentDepart)
60 if err != nil { 61 if err != nil {
61 o.Rollback() 62 o.Rollback()
62 e := fmt.Errorf("SetRelation err:%s", err) 63 e := fmt.Errorf("SetRelation err:%s", err)
63 log.Error(e.Error()) 64 log.Error(e.Error())
64 - return protocol.NewErrWithMessage("1", e) 65 + return returndata, protocol.NewErrWithMessage("1", e)
65 } 66 }
66 err = models.UpdateDepartmentById(departmentAdd, []string{"Relation"}, o) 67 err = models.UpdateDepartmentById(departmentAdd, []string{"Relation"}, o)
67 if err != nil { 68 if err != nil {
68 o.Rollback() 69 o.Rollback()
69 e := fmt.Errorf("UpdateDepartmentById err:%s", err) 70 e := fmt.Errorf("UpdateDepartmentById err:%s", err)
70 log.Error(e.Error()) 71 log.Error(e.Error())
71 - return protocol.NewErrWithMessage("1", e) 72 + return returndata, protocol.NewErrWithMessage("1", e)
72 } 73 }
73 o.Commit() 74 o.Commit()
74 - return nil 75 + returndata.DepartmentId = departmentAdd.Id
  76 + return returndata, nil
75 77
76 } 78 }
77 79
@@ -43,7 +43,6 @@ func RoleAdd(param protocol.RequestRoleAdd) (*protocol.ResponseRoleInfo, error) @@ -43,7 +43,6 @@ func RoleAdd(param protocol.RequestRoleAdd) (*protocol.ResponseRoleInfo, error)
43 r := &protocol.ResponseRoleInfo{ 43 r := &protocol.ResponseRoleInfo{
44 ID: roleid, 44 ID: roleid,
45 Name: role.Name, 45 Name: role.Name,
46 - Descript: role.Descript,  
47 Types: role.Types, 46 Types: role.Types,
48 } 47 }
49 return r, nil 48 return r, nil
@@ -115,7 +114,6 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error @@ -115,7 +114,6 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error
115 r := &protocol.ResponseRoleInfo{ 114 r := &protocol.ResponseRoleInfo{
116 ID: role.Id, 115 ID: role.Id,
117 Name: role.Name, 116 Name: role.Name,
118 - Descript: role.Descript,  
119 Types: role.Types, 117 Types: role.Types,
120 } 118 }
121 return r, nil 119 return r, nil
@@ -66,7 +66,7 @@ token 的响应内容 @@ -66,7 +66,7 @@ token 的响应内容
66 } 66 }
67 ``` 67 ```
68 68
69 -- 响应 json 69 +- 正常响应 json
70 70
71 ```json 71 ```json
72 { 72 {
@@ -95,7 +95,7 @@ token 的响应内容 @@ -95,7 +95,7 @@ token 的响应内容
95 95
96 ``` 96 ```
97 97
98 -- 响应 json 98 +- 正常响应 json
99 99
100 ```json 100 ```json
101 { 101 {
@@ -126,7 +126,7 @@ token 的响应内容 @@ -126,7 +126,7 @@ token 的响应内容
126 } 126 }
127 ``` 127 ```
128 128
129 -- 响应 json 129 +- 正常响应 json
130 130
131 ```json 131 ```json
132 { 132 {
@@ -145,6 +145,267 @@ token 的响应内容 @@ -145,6 +145,267 @@ token 的响应内容
145 145
146 --- 146 ---
147 147
  148 +## 公司部门管理
  149 +
  150 +### 添加部门
  151 +
  152 +- 请求路径:/v1/department/add
  153 +- 请求方式:post
  154 +- 请求 json:
  155 +
  156 +```json
  157 +{
  158 + "name": "部门8",
  159 + "parent_id": 13,
  160 + "manages": [1, 2, 3] //部门主管id列表
  161 +}
  162 +```
  163 +
  164 +- 正常响应 json
  165 +
  166 +```json
  167 +{
  168 + "code": 0,
  169 + "msg": "成功",
  170 + "data": {
  171 + "id": 12 //部门id
  172 + }
  173 +}
  174 +```
  175 +
  176 +- 备注;无
  177 +
  178 +---
  179 +
  180 +### 编辑部门
  181 +
  182 +- 请求路径:/v1/department/edit
  183 +- 请求方式:post
  184 +- 请求 json:
  185 +
  186 +```json
  187 +{
  188 + "id": 1,
  189 + "name": "部门8",
  190 + "parent_id": 13,
  191 + "manages": [1, 2, 3] //部门主管id列表
  192 +}
  193 +```
  194 +
  195 +- 响应 json
  196 +
  197 +```json
  198 +{
  199 + "code": 0,
  200 + "msg": "成功",
  201 + "data": null
  202 +}
  203 +```
  204 +
  205 +- 备注;无
  206 +
  207 +---
  208 +
  209 +### 删除部门
  210 +
  211 +- 请求路径:/v1/department/delete
  212 +- 请求方式:post
  213 +- 请求 json:
  214 +
  215 +```json
  216 +{
  217 + "ids": [1, 2]
  218 +}
  219 +```
  220 +
  221 +- 响应 json
  222 +
  223 +```json
  224 +{
  225 + "code": 0,
  226 + "msg": "成功",
  227 + "data": null
  228 +}
  229 +```
  230 +
  231 +- 备注;无
  232 +
  233 +---
  234 +
  235 +## 公司职位管理
  236 +
  237 +### 添加职位
  238 +
  239 +- 请求路径:/v1/position/add
  240 +- 请求方式:post
  241 +- 请求 json:
  242 +
  243 +```json
  244 +{
  245 + "name": "职位b-1",
  246 + "parent_id": 8
  247 +}
  248 +```
  249 +
  250 +- 响应 json
  251 +
  252 +```json
  253 +{
  254 + "code": 0,
  255 + "msg": "成功",
  256 + "data": {
  257 + "id": 2
  258 + }
  259 +}
  260 +```
  261 +
  262 +- 备注;无
  263 +
  264 +---
  265 +
  266 +### 编辑职位
  267 +
  268 +- 请求路径:/v1/position/edit
  269 +- 请求方式:post
  270 +- 请求 json:
  271 +
  272 +```json
  273 +{
  274 + "id": 2,
  275 + "name": "职位b-1",
  276 + "parent_id": 8
  277 +}
  278 +```
  279 +
  280 +- 响应 json
  281 +
  282 +```json
  283 +{
  284 + "code": 0,
  285 + "msg": "成功",
  286 + "data": {
  287 + "id": 2
  288 + }
  289 +}
  290 +```
  291 +
  292 +- 备注;无
  293 +
  294 +---
  295 +
  296 +### 删除职位
  297 +
  298 +- 请求路径:/v1/position/delete
  299 +- 请求方式:post
  300 +- 请求 json:
  301 +
  302 +```json
  303 +{
  304 + "id": [1, 2, 3]
  305 +}
  306 +```
  307 +
  308 +- 响应 json
  309 +
  310 +```json
  311 +{
  312 + "code": 0,
  313 + "msg": "成功",
  314 + "data":
  315 +}
  316 +```
  317 +
  318 +- 备注;无
  319 +
  320 +---
  321 +
  322 +## 公司员工角色
  323 +
  324 +### 添加角色
  325 +
  326 +- 请求路径:/v1/rbac/role/add
  327 +- 请求方式:post
  328 +- 请求 json:
  329 +
  330 +```json
  331 +{
  332 + "pid": 8,
  333 + "name": "角色7"
  334 +}
  335 +```
  336 +
  337 +- 响应 json
  338 +
  339 +```json
  340 +{
  341 + "code": 0,
  342 + "msg": "成功",
  343 + "data": {
  344 + "id": 2
  345 + }
  346 +}
  347 +```
  348 +
  349 +- 备注;无
  350 +
  351 +---
  352 +
  353 +### 编辑角色
  354 +
  355 +- 请求路径:/v1/rbac/role/edit
  356 +- 请求方式:post
  357 +- 请求 json:
  358 +
  359 +```json
  360 +{
  361 + "id": 7,
  362 + "pid": 8,
  363 + "name": "角色7"
  364 +}
  365 +```
  366 +
  367 +- 响应 json
  368 +
  369 +```json
  370 +{
  371 + "code": 0,
  372 + "msg": "成功",
  373 + "data": {
  374 + "id": 2
  375 + }
  376 +}
  377 +```
  378 +
  379 +### 删除角色
  380 +
  381 +- 请求路径:/v1/rbac/role/delete
  382 +- 请求方式:post
  383 +- 请求 json:
  384 +
  385 +```json
  386 +{
  387 + "ids": [1, 23]
  388 +}
  389 +```
  390 +
  391 +- 响应 json
  392 +
  393 +```json
  394 +{
  395 + "code": 0,
  396 + "msg": "成功",
  397 + "data": null
  398 +}
  399 +```
  400 +
  401 +- 备注;无
  402 +
  403 +---
  404 +
  405 +- 备注;无
  406 +
  407 +---
  408 +
148 ## 公告 409 ## 公告
149 410
150 ### 添加公告 411 ### 添加公告
@@ -155,32 +416,31 @@ token 的响应内容 @@ -155,32 +416,31 @@ token 的响应内容
155 416
156 ```json 417 ```json
157 { 418 {
158 - "type":2,  
159 - "title":"标题",  
160 - "content":"公告内容",  
161 - "allow_close":0,  
162 - "question_switch":1,  
163 - "receiver":["1","2"],  
164 - "question":  
165 - {  
166 - "id":1,  
167 - "type":1,  
168 - "title":"今天星期几?",  
169 - "content":[ 419 + "type": 2,
  420 + "title": "标题",
  421 + "content": "公告内容",
  422 + "allow_close": 0,
  423 + "question_switch": 1,
  424 + "receiver": ["1", "2"],
  425 + "question": {
  426 + "id": 1,
  427 + "type": 1,
  428 + "title": "今天星期几?",
  429 + "content": [
170 { 430 {
171 - "id":1,  
172 - "content":"星期1" 431 + "id": 1,
  432 + "content": "星期1"
173 }, 433 },
174 { 434 {
175 - "id":2,  
176 - "content":"星期2" 435 + "id": 2,
  436 + "content": "星期2"
177 } 437 }
178 ] 438 ]
179 }, 439 },
180 - "cover":{  
181 - "path":"/xx/xx.img",  
182 - "w":50,  
183 - "h":70 440 + "cover": {
  441 + "path": "/xx/xx.img",
  442 + "w": 50,
  443 + "h": 70
184 } 444 }
185 } 445 }
186 ``` 446 ```
@@ -328,33 +588,32 @@ obj.status 状态 0-所有 1-下架 2-上架 @@ -328,33 +588,32 @@ obj.status 状态 0-所有 1-下架 2-上架
328 588
329 ```json 589 ```json
330 { 590 {
331 - "id":3,  
332 - "type":2,  
333 - "title":"测试公告3",  
334 - "content":"今天发布了一则公告3",  
335 - "allow_close":0,  
336 - "question_switch":1,  
337 - "receiver":["1","2","3"],  
338 - "question":  
339 - {  
340 - "id":2,  
341 - "type":1,  
342 - "title":"今天星期几?",  
343 - "content":[ 591 + "id": 3,
  592 + "type": 2,
  593 + "title": "测试公告3",
  594 + "content": "今天发布了一则公告3",
  595 + "allow_close": 0,
  596 + "question_switch": 1,
  597 + "receiver": ["1", "2", "3"],
  598 + "question": {
  599 + "id": 2,
  600 + "type": 1,
  601 + "title": "今天星期几?",
  602 + "content": [
344 { 603 {
345 - "id":1,  
346 - "content":"星期2" 604 + "id": 1,
  605 + "content": "星期2"
347 }, 606 },
348 { 607 {
349 - "id":2,  
350 - "content":"星期3" 608 + "id": 2,
  609 + "content": "星期3"
351 } 610 }
352 ] 611 ]
353 }, 612 },
354 - "cover":{  
355 - "path":"/xx/xx.img",  
356 - "w":50,  
357 - "h":70 613 + "cover": {
  614 + "path": "/xx/xx.img",
  615 + "w": 50,
  616 + "h": 70
358 } 617 }
359 } 618 }
360 ``` 619 ```