|
@@ -177,18 +177,21 @@ func (s *SysServ) authWechat(gctx *context.Context) map[string]interface{} {
|
177
|
177
|
// 获取 token
|
178
|
178
|
token, err := s.getToken(gctx)
|
179
|
179
|
if err != nil {
|
180
|
|
- // token 报错一律视为需要重新登录
|
181
|
|
- return map[string]interface{}{
|
182
|
|
- "code": http.StatusUnauthorized,
|
183
|
|
- "error": err,
|
184
|
|
- "message": map[string]interface{}{
|
185
|
|
- "appid": utils.GetWxAppID(s.org.OrgId),
|
186
|
|
- },
|
|
180
|
+ tokenStr := s.ctx.Get("token").(string)
|
|
181
|
+ if tokenStr != "" {
|
|
182
|
+ // token 报错一律视为需要重新登录
|
|
183
|
+ return map[string]interface{}{
|
|
184
|
+ "code": http.StatusUnauthorized,
|
|
185
|
+ "error": err,
|
|
186
|
+ "message": map[string]interface{}{
|
|
187
|
+ "appid": utils.GetWxAppID(s.org.OrgId),
|
|
188
|
+ },
|
|
189
|
+ }
|
187
|
190
|
}
|
188
|
191
|
}
|
189
|
192
|
|
190
|
193
|
// 未登录 或 未验证
|
191
|
|
- if token.ID == "" {
|
|
194
|
+ if token == nil || token.ID == "" {
|
192
|
195
|
if code == "" {
|
193
|
196
|
return map[string]interface{}{
|
194
|
197
|
"code": http.StatusUnauthorized,
|
|
@@ -216,6 +219,8 @@ func (s *SysServ) authWechat(gctx *context.Context) map[string]interface{} {
|
216
|
219
|
}
|
217
|
220
|
}
|
218
|
221
|
|
|
222
|
+ utils.LogError("获取到微信人员: ", wxUser)
|
|
223
|
+
|
219
|
224
|
openID = wxUser.OpenID
|
220
|
225
|
} else {
|
221
|
226
|
openID = token.ID
|
|
@@ -242,7 +247,7 @@ func (s *SysServ) authWechat(gctx *context.Context) map[string]interface{} {
|
242
|
247
|
// 如果尚无人员映射信息, 代表人员初次使用本系统
|
243
|
248
|
if userMapping == nil {
|
244
|
249
|
// 如果没有微信用户信息, 代表产生了未知异常
|
245
|
|
- if wxUser == nil || wxUser.UnionID == "" {
|
|
250
|
+ if wxUser == nil || wxUser.OpenID == "" {
|
246
|
251
|
return map[string]interface{}{
|
247
|
252
|
"code": http.StatusInternalServerError,
|
248
|
253
|
"error": errors.New("系统异常, 请清空缓存后重试"),
|