user.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. package user
  2. import (
  3. "context"
  4. "errors"
  5. "hongze/hongze_yb/global"
  6. userReq "hongze/hongze_yb/models/request/user"
  7. admin2 "hongze/hongze_yb/models/tables/admin"
  8. "hongze/hongze_yb/models/tables/company"
  9. "hongze/hongze_yb/models/tables/company_product"
  10. "hongze/hongze_yb/models/tables/rddp/chart_permission"
  11. "hongze/hongze_yb/models/tables/rddp/msg_code"
  12. "hongze/hongze_yb/models/tables/research_variety_tag_relation"
  13. "hongze/hongze_yb/models/tables/sys_role_admin"
  14. "hongze/hongze_yb/models/tables/wx_user"
  15. "hongze/hongze_yb/models/tables/yb_apply_record"
  16. "hongze/hongze_yb/models/tables/yb_index_tab"
  17. "hongze/hongze_yb/models/tables/yb_message"
  18. "hongze/hongze_yb/services"
  19. companyService "hongze/hongze_yb/services/company"
  20. "hongze/hongze_yb/services/user"
  21. "hongze/hongze_yb/utils"
  22. "strings"
  23. "time"
  24. )
  25. // SendSmsCode 发送手机短信
  26. func SendSmsCode(openid, mobile, areaNum string) (err error, errMsg string) {
  27. if mobile == "" {
  28. err = errors.New("请输入手机号")
  29. return
  30. }
  31. msgCode := utils.GetRandDigit(4)
  32. var result bool
  33. if areaNum == "86" || areaNum == "" || areaNum == "0" {
  34. //国内的短信
  35. result = services.SendSmsCode(mobile, msgCode)
  36. } else {
  37. //国际短信
  38. result = services.SendSmsCodeGj(mobile, msgCode, areaNum)
  39. }
  40. //发送成功
  41. if result {
  42. item := &msg_code.MsgCode{
  43. OpenID: openid,
  44. Mobile: mobile,
  45. Code: msgCode,
  46. ExpiredIn: time.Now().Add(15 * time.Minute).Unix(),
  47. Enabled: 1,
  48. CreatedTime: time.Time{},
  49. LastUpdatedTime: time.Time{},
  50. }
  51. err = item.Create()
  52. } else {
  53. err = errors.New("短信发送失败")
  54. }
  55. return
  56. }
  57. // SendEmailCode 发送邮件
  58. func SendEmailCode(openid, email string) (err error, errMsg string) {
  59. if email == "" {
  60. err = errors.New("请输入邮箱地址")
  61. return
  62. }
  63. if !utils.ValidateEmailFormatat(email) {
  64. err = errors.New("邮箱格式错误,请重新输入")
  65. return
  66. }
  67. msgCode := utils.GetRandDigit(4)
  68. content := "尊敬的用户:</br>您好,感谢您使用弘则研究,您正在进行邮箱验证,本次请求的验证码为:" + msgCode + "(为了保障您账号的安全性,请在15分钟内完成验证。)</br>弘则研究团队 </br>" + time.Now().Format(utils.FormatDateCN)
  69. title := "弘则研究登陆验证"
  70. //发送邮件
  71. result, err := services.SendEmailByHz(title, content, email)
  72. if result {
  73. item := &msg_code.MsgCode{
  74. OpenID: openid,
  75. Mobile: email,
  76. Code: msgCode,
  77. ExpiredIn: time.Now().Add(15 * time.Minute).Unix(),
  78. Enabled: 1,
  79. CreatedTime: time.Time{},
  80. LastUpdatedTime: time.Time{},
  81. }
  82. err = item.Create()
  83. } else {
  84. err = errors.New("发送失败,Err:" + err.Error())
  85. }
  86. return
  87. }
  88. type CompanyPermission struct {
  89. Name string `json:"name" description:"分类名称"`
  90. PermissionList []PermissionList `json:"permission_list" description:"权限列表"`
  91. }
  92. type PermissionList struct {
  93. Name string `json:"name" description:"权限名称"`
  94. StartDate time.Time `json:"start_date" description:"开始日期"`
  95. EndDate time.Time `json:"end_date" description:"结束日期"`
  96. Status string `json:"status" description:"状态"`
  97. }
  98. type Detail struct {
  99. CompanyName string `json:"company_name" description:"客户名称(公司名称)"`
  100. Status string `json:"status" description:"客户状态"`
  101. IsSuspend int8 `json:"is_suspend" description:"启用与否字段:1:暂停,0:启用"`
  102. RealName string `json:"real_name" description:"用户名称"`
  103. Mobile string `json:"mobile" description:"手机号"`
  104. Email string `json:"email" description:"邮箱"`
  105. SellerName string `json:"seal_name" description:"所属销售名称"`
  106. SellerMobile string `json:"seal_mobile" description:"所属销售手机号"`
  107. PermissionList []CompanyPermission `json:"permission_list" description:"权限列表"`
  108. IsInner int `json:"is_inner" description:"是否为内部员工"`
  109. IsResearcher int `json:"is_researcher" description:"是否为研究员"`
  110. IsVoiceAdmin int `json:"is_voice_admin" description:"是否为语音管理员"`
  111. AdminInfo *admin2.Admin `json:"admin_info" description:"系统管理员信息"`
  112. UnRead int64 `json:"un_read" description:"消息未读数"`
  113. NickName string `json:"nick_name" description:"用户昵称"`
  114. HeadImgUrl string `json:"head_img_url" description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
  115. UserId uint64 `json:"user_id" description:"用户ID"`
  116. IsBind int `json:"is_bind" description:"是否绑定了微信"`
  117. }
  118. // GetUserInfo 获取用户我的页面详情数据
  119. func GetUserInfo(userInfo user.UserInfo) (userDetail Detail, err error, errMsg string) {
  120. list := make([]CompanyPermission, 0)
  121. companyName := userInfo.Note
  122. status := ``
  123. var isSuspend int8
  124. sellerName := ``
  125. sellerMobile := ``
  126. if userInfo.CompanyID > 1 {
  127. companyInfo, tmpErr := company.GetByCompanyId(userInfo.CompanyID)
  128. if tmpErr != nil {
  129. err = tmpErr
  130. if tmpErr == utils.ErrNoRow {
  131. err = errors.New("找不到该客户")
  132. errMsg = "找不到该客户"
  133. return
  134. }
  135. errMsg = "系统异常4001"
  136. return
  137. }
  138. companyName = companyInfo.CompanyName
  139. companyProduct, tmpErr := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
  140. //如果有ficc权限,那么就去查询相关权限
  141. if tmpErr == nil {
  142. status = companyProduct.Status //产品状态
  143. isSuspend = companyProduct.IsSuspend
  144. //销售信息
  145. adminInfo, tmpErr := admin2.GetByAdminId(companyProduct.SellerID)
  146. if tmpErr == nil {
  147. sellerName = adminInfo.RealName
  148. sellerMobile = adminInfo.Mobile
  149. }
  150. //获取所有的权限分类列表
  151. allPermissionList, tmpErr := companyService.GetPermissionListByProductId(1)
  152. if tmpErr != nil {
  153. err = tmpErr
  154. return
  155. }
  156. permissionClassMap := make(map[int]*chart_permission.ChartPermission)
  157. for _, chartPermission := range allPermissionList {
  158. permissionClassMap[int(chartPermission.ChartPermissionID)] = chartPermission
  159. }
  160. // 获取权限列表
  161. permissionList, tmpErr := companyService.GetValidPermissionByCompany2ProductId(userInfo.CompanyID, 1)
  162. if tmpErr != nil {
  163. err = tmpErr
  164. return
  165. }
  166. permissionMap := make(map[string][]PermissionList)
  167. for _, permission := range permissionList {
  168. chartPermission, ok := permissionClassMap[permission.ChartPermissionID]
  169. if ok {
  170. tmpPermission := PermissionList{
  171. Name: chartPermission.PermissionName,
  172. StartDate: permission.StartDate,
  173. EndDate: permission.EndDate,
  174. Status: permission.Status,
  175. }
  176. if tmpPermissionList, ok2 := permissionMap[chartPermission.ClassifyName]; ok2 {
  177. permissionMap[chartPermission.ClassifyName] = append(tmpPermissionList, tmpPermission)
  178. } else {
  179. tmpPermissionList := make([]PermissionList, 0)
  180. permissionMap[chartPermission.ClassifyName] = append(tmpPermissionList, tmpPermission)
  181. }
  182. }
  183. }
  184. for name, tmpPermissionList := range permissionMap {
  185. list = append(list, CompanyPermission{
  186. Name: name,
  187. PermissionList: tmpPermissionList,
  188. })
  189. }
  190. }
  191. }
  192. // 查询消息未读数
  193. unRead, err := yb_message.GetUnreadByUserId(userInfo.UserID)
  194. if err != nil {
  195. errMsg = "查询消息未读数失败"
  196. return
  197. }
  198. // 用户头像
  199. headimgurl := userInfo.Headimgurl
  200. if headimgurl == "" {
  201. // 未绑定-灰色头像
  202. headimgurl = utils.DEFAULT_HONGZE_USER_LOGO_GRAY
  203. if userInfo.UserID > 0 {
  204. headimgurl = utils.DEFAULT_HONGZE_USER_LOGO
  205. }
  206. }
  207. // 查询是否为内部员工、研究员、语音管理员
  208. isInner, isResearcher, isVoiceAdmin, adminInfo, e := GetUserIdentity(int(userInfo.CompanyID), userInfo.Mobile, userInfo.Email)
  209. if e != nil {
  210. return
  211. }
  212. isBind := 0
  213. if userInfo.UserID > 0 {
  214. isBind = 1
  215. }
  216. userDetail = Detail{
  217. CompanyName: companyName, //客户名称(公司名称)
  218. Status: status, //产品状态
  219. IsSuspend: isSuspend, //是否启用
  220. RealName: userInfo.RealName,
  221. Mobile: userInfo.Mobile,
  222. Email: userInfo.Email,
  223. SellerName: sellerName,
  224. SellerMobile: sellerMobile,
  225. PermissionList: list, //权限列表
  226. IsInner: isInner, // 是否为内部员工
  227. IsResearcher: isResearcher, // 是否为研究员
  228. IsVoiceAdmin: isVoiceAdmin, // 语音管理员
  229. AdminInfo: adminInfo, // 系统管理员信息
  230. UnRead: unRead,
  231. NickName: userInfo.NickName,
  232. HeadImgUrl: headimgurl,
  233. UserId: userInfo.UserID,
  234. IsBind: isBind,
  235. }
  236. return
  237. }
  238. // SetUserInfo 设置用户的个人信息,头像和昵称
  239. func SetUserInfo(userInfo user.UserInfo, req userReq.SetUserInfoReq) (err error) {
  240. // todo 用户如果没有设置头像,用默认头像也允许上传
  241. // 校验昵称长度
  242. // 校验头像地址是否正确
  243. if !strings.Contains(req.HeadImgUrl, "http://") && !strings.Contains(req.HeadImgUrl, "https://") {
  244. err = errors.New("上传头像出错")
  245. return
  246. }
  247. wxUser := userInfo.WxUser
  248. wxUser.NickName = req.NickName
  249. wxUser.Headimgurl = req.HeadImgUrl
  250. err = wxUser.Update([]string{"nick_name", "headimgurl"})
  251. if err != nil {
  252. err = errors.New("更新用户信息操作失败")
  253. return
  254. }
  255. return
  256. }
  257. type Record struct {
  258. BusinessCardURL string `json:"business_card_url" description:"名片"`
  259. RealName string `json:"real_name" description:"姓名"`
  260. CompanyName string `json:"company_name" description:"客户备注的公司名称"`
  261. Mobile string `json:"mobile" description:"手机号"`
  262. }
  263. // GetLastApplyInfo 获取最近的一套申请记录
  264. func GetLastApplyInfo(userId int) (record Record, err error) {
  265. recordInfo, err := yb_apply_record.GetLastNotOpRecordByUserId(userId)
  266. if err != nil {
  267. if err == utils.ErrNoRow {
  268. err = nil
  269. }
  270. return
  271. }
  272. record = Record{
  273. BusinessCardURL: recordInfo.BusinessCardURL,
  274. RealName: recordInfo.RealName,
  275. CompanyName: recordInfo.CompanyName,
  276. Mobile: recordInfo.Mobile,
  277. }
  278. return
  279. }
  280. // Apply 客户申请
  281. func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.ApplyReq) (ybApplyRecord *yb_apply_record.YbApplyRecord, err error) {
  282. sellerName := ``
  283. status := `潜在用户`
  284. companyName := applyInfo.CompanyName
  285. tmpmYbApplyRecord, err := yb_apply_record.GetLastNotOpRecordByUserId(userId)
  286. if err == nil {
  287. ybApplyRecord = tmpmYbApplyRecord // 申请来源每一种只存在一条数据
  288. return
  289. } else {
  290. if err != utils.ErrNoRow {
  291. return
  292. }
  293. }
  294. // 联系人信息
  295. wxUserInfo, err := wx_user.GetByUserId(userId)
  296. if err != nil {
  297. return
  298. }
  299. if companyId > 1 {
  300. //客户信息
  301. companyInfo, tmpErr := company.GetByCompanyId(companyId)
  302. if tmpErr != nil {
  303. err = tmpErr
  304. return
  305. }
  306. companyName = companyInfo.CompanyName
  307. //客户产品权限
  308. companyProductList, tmpErr := company_product.GetListByCompanyId(companyId)
  309. if tmpErr != nil {
  310. err = tmpErr
  311. return
  312. }
  313. sellerNameList := make([]string, 0)
  314. statusList := make([]string, 0)
  315. for _, companyProductInfo := range companyProductList {
  316. if companyProductInfo.ProductID == 2 && status == "潜在用户" {
  317. status = "权益用户"
  318. }
  319. if companyProductInfo.ProductID == 1 {
  320. sellerName = companyProductInfo.SellerName
  321. status = companyProductInfo.Status
  322. if companyProductInfo.IsSuspend == 1 {
  323. status = `试用暂停`
  324. }
  325. }
  326. }
  327. if len(sellerNameList) > 0 && len(statusList) > 0 {
  328. sellerName = strings.Join(sellerNameList, ",")
  329. status = strings.Join(statusList, ",")
  330. }
  331. }
  332. ybApplyRecord = &yb_apply_record.YbApplyRecord{
  333. UserID: userId,
  334. BusinessCardURL: applyInfo.BusinessCardUrl,
  335. RealName: applyInfo.RealName,
  336. CompanyName: applyInfo.CompanyName,
  337. Mobile: mobile,
  338. Email: email,
  339. Permission: applyInfo.Permission,
  340. SellerName: sellerName,
  341. Status: status,
  342. CompanyIDPay: int(companyId),
  343. CompanyNamePay: companyName,
  344. CreateTime: time.Now(),
  345. Source: applyInfo.Source,
  346. SourceAgent: applyInfo.SourceAgent,
  347. FromPage: applyInfo.FromPage,
  348. }
  349. err = ybApplyRecord.Create()
  350. if err != nil {
  351. return
  352. }
  353. // 修改客户信息
  354. wxUserInfo.RealName = applyInfo.RealName
  355. wxUserInfo.Note = applyInfo.CompanyName
  356. wxUserInfo.IsNote = 1
  357. applyMethod := wxUserInfo.ApplyMethod //0:未申请,1:已付费客户申请试用,2:非客户申请试用
  358. applyMethod = 2
  359. if sellerName != "" {
  360. applyMethod = 1
  361. }
  362. wxUserInfo.ApplyMethod = applyMethod
  363. _ = wxUserInfo.Update([]string{"RealName", "Note", "IsNote", "ApplyMethod"})
  364. return
  365. }
  366. // GetUserTabBar 获取用户小程序TabBar
  367. func GetUserTabBar(userInfo user.UserInfo, version string) (list []string, err error) {
  368. where := make(map[string]interface{})
  369. where["version"] = version
  370. where["position"] = 2
  371. where["is_show"] = 1
  372. tabs, e := yb_index_tab.GetListByCondition(where)
  373. if e != nil {
  374. err = errors.New("获取TabBar失败, Err: " + e.Error())
  375. return
  376. }
  377. if len(tabs) == 0 {
  378. return
  379. }
  380. authOk := false
  381. companyProduct, e := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
  382. if e != nil && e != utils.ErrNoRow {
  383. err = errors.New("获取客户信息失败, Err: " + e.Error())
  384. return
  385. }
  386. if companyProduct != nil && companyProduct.Status != "" {
  387. if strings.Contains("永续,正式", companyProduct.Status) {
  388. authOk = true
  389. }
  390. }
  391. for _, v := range tabs {
  392. if v.AuthCheck == 1 && !authOk {
  393. continue
  394. }
  395. list = append(list, v.Mark)
  396. }
  397. return
  398. }
  399. // PcSendSmsCode 发送手机短信
  400. func PcSendSmsCode(mobile, areaNum string) (err error, errMsg string) {
  401. cacheKey := utils.HONGZEYB_ + "REPORT_SMS_CODE_PC:GetSmsCode:" + areaNum + ":" + mobile
  402. smsCodeStr, _ := global.Redis.Get(context.TODO(), cacheKey).Result()
  403. if smsCodeStr != "" {
  404. err = errors.New("请勿频繁发送验证码")
  405. return
  406. }
  407. if mobile == "" {
  408. err = errors.New("请输入手机号")
  409. return
  410. }
  411. msgCode := utils.GetRandDigit(4)
  412. var result bool
  413. if areaNum == "86" || areaNum == "" || areaNum == "0" {
  414. //国内的短信
  415. result = services.SendSmsCode(mobile, msgCode)
  416. } else {
  417. //国际短信
  418. result = services.SendSmsCodeGj(mobile, msgCode, areaNum)
  419. }
  420. //发送成功
  421. if result {
  422. // 验证码存库
  423. item := &msg_code.MsgCode{
  424. Mobile: mobile,
  425. Code: msgCode,
  426. ExpiredIn: time.Now().Add(15 * time.Minute).Unix(),
  427. Enabled: 1,
  428. CreatedTime: time.Time{},
  429. LastUpdatedTime: time.Time{},
  430. }
  431. err = item.Create()
  432. global.Redis.Set(context.TODO(), cacheKey, msgCode, 60*time.Second)
  433. } else {
  434. err = errors.New("短信发送失败")
  435. }
  436. return
  437. }
  438. // PcSendEmailCode 发送邮件
  439. func PcSendEmailCode(email string) (err error, errMsg string) {
  440. if email == "" {
  441. err = errors.New("请输入邮箱地址")
  442. return
  443. }
  444. if !utils.ValidateEmailFormatat(email) {
  445. err = errors.New("邮箱格式错误,请重新输入")
  446. return
  447. }
  448. cacheKey := utils.HONGZEYB_ + "REPORT_SMS_CODE_PC:PcSendEmailCode:" + email
  449. smsCodeStr, _ := global.Redis.Get(context.TODO(), cacheKey).Result()
  450. if smsCodeStr != "" {
  451. err = errors.New("请勿频繁发送验证码")
  452. return
  453. }
  454. msgCode := utils.GetRandDigit(4)
  455. content := "尊敬的用户:</br>您好,感谢您使用弘则研究,您正在进行邮箱验证,本次请求的验证码为:" + msgCode + "(为了保障您账号的安全性,请在15分钟内完成验证。)</br>弘则研究团队 </br>" + time.Now().Format(utils.FormatDateCN)
  456. title := "弘则研究登陆验证"
  457. //发送邮件
  458. result, err := services.SendEmailByHz(title, content, email)
  459. if result {
  460. item := &msg_code.MsgCode{
  461. Mobile: email,
  462. Code: msgCode,
  463. ExpiredIn: time.Now().Add(15 * time.Minute).Unix(),
  464. Enabled: 1,
  465. CreatedTime: time.Time{},
  466. LastUpdatedTime: time.Time{},
  467. }
  468. err = item.Create()
  469. global.Redis.Set(context.TODO(), cacheKey, msgCode, 60*time.Second)
  470. } else {
  471. err = errors.New("发送失败")
  472. }
  473. return
  474. }
  475. // TopTab
  476. type TopTab struct {
  477. Tab string `json:"tab" description:"选项卡名称"`
  478. Mark string `json:"mark" description:"选项卡标识"`
  479. Icon string `json:"icon" description:"icon图标"`
  480. Sort int `json:"sort" description:"排序"`
  481. }
  482. // GetTopTab 获取小程序首页顶部选项卡
  483. func GetTopTab(userInfo user.UserInfo, version string) (list []*TopTab, err error) {
  484. where := make(map[string]interface{})
  485. where["version"] = version
  486. where["position"] = 1
  487. where["is_show"] = 1
  488. tabs, e := yb_index_tab.GetListByCondition(where)
  489. if e != nil {
  490. err = errors.New("获取TabBar失败, Err: " + e.Error())
  491. return
  492. }
  493. if len(tabs) == 0 {
  494. return
  495. }
  496. authOk := false
  497. companyProduct, e := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
  498. if e != nil && e != utils.ErrNoRow {
  499. err = errors.New("获取客户信息失败, Err: " + e.Error())
  500. return
  501. }
  502. if companyProduct != nil && companyProduct.Status != "" {
  503. if strings.Contains("永续,正式", companyProduct.Status) {
  504. authOk = true
  505. }
  506. }
  507. list = make([]*TopTab, 0)
  508. for _, v := range tabs {
  509. if v.AuthCheck == 1 && !authOk {
  510. continue
  511. }
  512. list = append(list, &TopTab{
  513. Tab: v.Tab,
  514. Mark: v.Mark,
  515. Icon: v.DefaultIcon,
  516. Sort: v.Sort,
  517. })
  518. }
  519. return
  520. }
  521. // GetUserIdentity 获取用户身份(内部员工、研究员、语音管理员)
  522. func GetUserIdentity(companyId int, mobile, email string) (isInner, isResearcher, isVoiceAdmin int, adminInfo *admin2.Admin, err error) {
  523. if companyId != utils.HzCompanyId {
  524. return
  525. }
  526. if mobile == "" && email == "" {
  527. return
  528. }
  529. var e error
  530. // 通过手机号/邮箱获取管理员信息
  531. if mobile != "" {
  532. adminInfo, e = admin2.GetAdminByMobile(mobile)
  533. if e != nil && e != utils.ErrNoRow {
  534. return
  535. }
  536. } else {
  537. adminInfo, e = admin2.GetAdminByEmail(email)
  538. if e != nil && e != utils.ErrNoRow {
  539. return
  540. }
  541. }
  542. // 仅内部员工才判断研究员、语音管理员身份
  543. if adminInfo != nil && adminInfo.AdminID > 0 && adminInfo.Enabled == 1 {
  544. isInner = 1
  545. // 研究员
  546. researchGroupList, e := research_variety_tag_relation.GetResearchVarietyTagRelationByAdminId(int(adminInfo.AdminID))
  547. if e != nil {
  548. err = errors.New("用户研究员信息有误")
  549. return
  550. }
  551. if len(researchGroupList) > 0 {
  552. isResearcher = 1
  553. }
  554. // 语音管理员
  555. voiceAdmin, e := sys_role_admin.GetVoiceAdmin(int(adminInfo.AdminID))
  556. if e != nil && e != utils.ErrNoRow {
  557. err = errors.New("用户语音管理员信息有误")
  558. return
  559. }
  560. if voiceAdmin != nil && voiceAdmin.Id > 0 {
  561. isVoiceAdmin = 1
  562. }
  563. }
  564. return
  565. }