|
@@ -5,6 +5,7 @@ import (
|
|
"hongze/hongze_api/models"
|
|
"hongze/hongze_api/models"
|
|
"hongze/hongze_api/services"
|
|
"hongze/hongze_api/services"
|
|
"hongze/hongze_api/utils"
|
|
"hongze/hongze_api/utils"
|
|
|
|
+ "strconv"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -41,7 +42,13 @@ func (this *UserController) Detail() {
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ userPermission, err := services.CheckUserPermission(user.UserId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "判断用户权限信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item.UserPermission = userPermission
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "获取成功"
|
|
br.Msg = "获取成功"
|
|
@@ -110,13 +117,13 @@ func (this *UserCommonController) CheckSmsCode() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
if req.Mobile != "" {
|
|
if req.Mobile != "" {
|
|
- br.Msg="请输入手机号"
|
|
|
|
- br.ErrMsg="请输入手机号"
|
|
|
|
|
|
+ br.Msg = "请输入手机号"
|
|
|
|
+ br.ErrMsg = "请输入手机号"
|
|
return
|
|
return
|
|
}
|
|
}
|
|
if req.SmsCode == "" {
|
|
if req.SmsCode == "" {
|
|
- br.Msg="请输入验证码"
|
|
|
|
- br.ErrMsg="请输入验证码"
|
|
|
|
|
|
+ br.Msg = "请输入验证码"
|
|
|
|
+ br.ErrMsg = "请输入验证码"
|
|
return
|
|
return
|
|
}
|
|
}
|
|
//item,err:=models.GetMsgCode(req.Mobile,req.SmsCode)
|
|
//item,err:=models.GetMsgCode(req.Mobile,req.SmsCode)
|
|
@@ -147,7 +154,6 @@ func (this *UserCommonController) CheckSmsCode() {
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
$app->post('api/user/checkSmsCode',"UserController@checkSmsCode");//校验短信验证码
|
|
$app->post('api/user/checkSmsCode',"UserController@checkSmsCode");//校验短信验证码
|
|
$app->get('api/user/getEmailCode',"UserController@getEmailCode");//获取邮件验证码
|
|
$app->get('api/user/getEmailCode',"UserController@getEmailCode");//获取邮件验证码
|
|
@@ -156,3 +162,48 @@ $app->post('api/user/login',"UserController@login");//登录
|
|
$app->post('api/user/apply',"UserController@apply");//申请试用
|
|
$app->post('api/user/apply',"UserController@apply");//申请试用
|
|
$app->get('api/user/smallLimit',"UserController@smallLimit");//是否小套餐客户
|
|
$app->get('api/user/smallLimit',"UserController@smallLimit");//是否小套餐客户
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+// @Title 是否小套餐客户
|
|
|
|
+// @Description 是否小套餐客户接口
|
|
|
|
+// @Success 200 {object} models.SmallLimitResp
|
|
|
|
+// @router /smallLimit [get]
|
|
|
|
+func (this *UserController) SmallLimit() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ user := this.User
|
|
|
|
+ if user != nil {
|
|
|
|
+ br.Msg = "请登录"
|
|
|
|
+ br.ErrMsg = "请登录"
|
|
|
|
+ br.Ret = 408
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ userItem, err := models.GetWxUserItemByUserId(user.UserId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取用户信息失败"
|
|
|
|
+ br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if userItem == nil {
|
|
|
|
+ br.Msg = "获取用户信息失败"
|
|
|
|
+ br.ErrMsg = "用户信息不存在,UserId:" + strconv.Itoa(user.UserId)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ maxCount, err := models.GetUserIsMaxPermission(userItem.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取用户信息失败"
|
|
|
|
+ br.ErrMsg = "判断是否最大客户权限失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.SmallLimitResp)
|
|
|
|
+ if maxCount >= 15 {
|
|
|
|
+ resp.IsMaxPermission = 1
|
|
|
|
+ } else {
|
|
|
|
+ resp.IsMaxPermission = 0
|
|
|
|
+ }
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|