|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
|
|
|
"github.com/astaxie/beego/logs"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
|
|
|
)
|
|
|
|
|
|
type CompanyController struct {
|
|
|
BaseController
|
|
|
}
|
|
|
|
|
|
//Prepare 重写 BaseController 的Prepare方法
|
|
|
func (c *CompanyController) Prepare() {
|
|
|
c.BaseController.Prepare()
|
|
|
if ok := c.ValidJWTToken(); !ok {
|
|
|
return
|
|
|
}
|
|
|
if ok := c.ValidAdminPermission(domain.PERMINSSION_ADMIN_USER); !ok {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (c *CompanyController) SetPhone() {
|
|
|
//用与适配前端定义的数据结构
|
|
|
type Paramter struct {
|
|
|
Type int `json:"type"`
|
|
|
Phone string `json:"phone"`
|
|
|
}
|
|
|
var (
|
|
|
param Paramter
|
|
|
err error
|
|
|
)
|
|
|
if err = c.BindJsonData(¶m); err != nil {
|
|
|
logs.Error(err)
|
|
|
c.ResponseError(errors.New("json数据解析失败"))
|
|
|
return
|
|
|
}
|
|
|
c.ResponseData(nil)
|
|
|
return
|
|
|
} |
...
|
...
|
|