Browse Source

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/services into dev

zjxpcyc 6 years ago
parent
commit
bb12d5d554
7 changed files with 141 additions and 38 deletions
  1. 1
    2
      conf/app.conf
  2. 11
    0
      controllers/coupon/coupon.go
  3. 33
    0
      log/common.log
  4. 25
    10
      models/coupon/coupon.go
  5. 6
    0
      models/coupon/types.go
  6. 13
    0
      service/coupon/coupon.go
  7. 52
    26
      service/sys.go

+ 1
- 2
conf/app.conf View File

1
 appname = services
1
 appname = services
2
 httpport = 8080
2
 httpport = 8080
3
-runmode = dev
3
+runmode = prod
4
 autorender = false
4
 autorender = false
5
 copyrequestbody = true
5
 copyrequestbody = true
6
 EnableDocs = true
6
 EnableDocs = true
7
-sessionon = false
8
 excelpath = ./
7
 excelpath = ./
9
 clienturl = http://dev.ycjcjy.com/c-v2
8
 clienturl = http://dev.ycjcjy.com/c-v2
10
 
9
 

+ 11
- 0
controllers/coupon/coupon.go View File

178
 
178
 
179
 	c.ResponseJSON(coupons)
179
 	c.ResponseJSON(coupons)
180
 }
180
 }
181
+
182
+// GetCouponWithCustomer 获取优惠券领取信息
183
+func (c *CouponController) GetCouponWithCustomer() {
184
+	couponid := c.GetString(":id")
185
+	couponDetail, err := c.serv.GetCouponWithCustomer(couponid)
186
+	if err != nil {
187
+		c.ResponseError(err)
188
+	}
189
+
190
+	c.ResponseJSON(couponDetail)
191
+}

+ 33
- 0
log/common.log View File

3120
 2018/09/13 10:24:25 [E] 用户没有设置默认案场
3120
 2018/09/13 10:24:25 [E] 用户没有设置默认案场
3121
 2018/09/13 10:49:12 [E] 用户没有设置默认案场
3121
 2018/09/13 10:49:12 [E] 用户没有设置默认案场
3122
 >>>>>>> yansen
3122
 >>>>>>> yansen
3123
+2018/09/13 17:53:24 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3124
+2018/09/13 17:53:24 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_sAtgG_I5C0cIB3oE07TwgL0liULpmiKC2LVmEoLV4qAjnw62EGxoKcM6Rwq4ZDQO80ZDZ6Y0g1gX5yTTgmZM-luw5RIGI9l8fkeOfgTk3paqL9Eaf0Qc40p9cLa8XZlFgXaUvwFshVLM2dv1SMHhAGAMGB","expires_in":7200})
3125
+2018/09/13 17:53:24 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_sAtgG_I5C0cIB3oE07TwgL0liULpmiKC2LVmEoLV4qAjnw62EGxoKcM6Rwq4ZDQO80ZDZ6Y0g1gX5yTTgmZM-luw5RIGI9l8fkeOfgTk3paqL9Eaf0Qc40p9cLa8XZlFgXaUvwFshVLM2dv1SMHhAGAMGB expires_in:7200])
3126
+2018/09/13 17:55:33 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3127
+2018/09/13 17:55:33 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_BgSpOJyw7POeYv2-lhNILmp7cu0uXc3D0R1xtwtWSDEz26Yci4pkYNra445VNzJCSaTxLHiF_b4UVjq3hzAQ7LH1icPj7qJN_aMNFyC8Li-C4FAxeCTPeaVpAYEGEi3ibB2BC1kTaJeyUUNaFRGbAIAIUJ","expires_in":7200})
3128
+2018/09/13 17:55:33 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_BgSpOJyw7POeYv2-lhNILmp7cu0uXc3D0R1xtwtWSDEz26Yci4pkYNra445VNzJCSaTxLHiF_b4UVjq3hzAQ7LH1icPj7qJN_aMNFyC8Li-C4FAxeCTPeaVpAYEGEi3ibB2BC1kTaJeyUUNaFRGbAIAIUJ expires_in:7200])
3129
+2018/09/13 18:35:49 [E] 解析 Token 失败: token contains an invalid number of segments
3130
+2018/09/13 18:36:27 [E] 解析 Token 失败: token contains an invalid number of segments
3131
+2018/09/13 18:48:47 [E] 解析 Token 失败: token contains an invalid number of segments
3132
+2018/09/13 18:55:18 [E] 解析 Token 失败: token contains an invalid number of segments
3133
+2018/09/13 18:59:53 [E] 解析 Token 失败: token contains an invalid number of segments
3134
+2018/09/13 18:59:53 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3135
+2018/09/13 18:59:53 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_5wS0P68kkvP1JMUgKvLRHiorDM-9wwzYsyPyvqoO45oQ0svaKslNuzuXiPj_H38ci_CC0I6KOpYftBjHdls38dPUclu9vr-5l2KYA2bQSXzkruy7W_eRaiKgGZm9RDemUtccGpZrt6GsJQd1DRZaAAATHP","expires_in":7200})
3136
+2018/09/13 18:59:53 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[expires_in:7200 access_token:13_5wS0P68kkvP1JMUgKvLRHiorDM-9wwzYsyPyvqoO45oQ0svaKslNuzuXiPj_H38ci_CC0I6KOpYftBjHdls38dPUclu9vr-5l2KYA2bQSXzkruy7W_eRaiKgGZm9RDemUtccGpZrt6GsJQd1DRZaAAATHP])
3137
+2018/09/13 19:04:23 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3138
+2018/09/13 19:04:24 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_5FVpoe4s6lQAYRgaIhfOemZ8x2JZqaVEC0HLnxX2GVDmozbqIEDsOy_VJvYYiV66RLWNi5i4xCXfwhlWOyJt0PsIJG7_WPIHk3L4xcu3hElyNBonTktgQLSJhLJ4yV2eqGbQglXlbE6HN8Z7SQRjABAMKL","expires_in":7200})
3139
+2018/09/13 19:04:24 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_5FVpoe4s6lQAYRgaIhfOemZ8x2JZqaVEC0HLnxX2GVDmozbqIEDsOy_VJvYYiV66RLWNi5i4xCXfwhlWOyJt0PsIJG7_WPIHk3L4xcu3hElyNBonTktgQLSJhLJ4yV2eqGbQglXlbE6HN8Z7SQRjABAMKL expires_in:7200])
3140
+2018/09/13 19:09:43 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3141
+2018/09/13 19:09:44 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_Bt-a8HjMB8lI3pECMEnQHNxh1Po7akGhaKn5eNanfovztO5_nfsc0HWTVN1vpReBlOrUsFEJaLdoy4z8fHFOOPFEB4LDtbaKvFBTRfARZwR-rOKNtgyp0wZ38ySOH-JkxWfdZSRAIXeqI3baVAYgACARWU","expires_in":7200})
3142
+2018/09/13 19:09:44 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_Bt-a8HjMB8lI3pECMEnQHNxh1Po7akGhaKn5eNanfovztO5_nfsc0HWTVN1vpReBlOrUsFEJaLdoy4z8fHFOOPFEB4LDtbaKvFBTRfARZwR-rOKNtgyp0wZ38ySOH-JkxWfdZSRAIXeqI3baVAYgACARWU expires_in:7200])
3143
+2018/09/13 19:11:52 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3144
+2018/09/13 19:11:53 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_BdnfI9eRgdWJ2pX_ptvxYJzNwW1N7Tx5K1fl4Kg96qRNBPiooTJsbFsCie5kE20w8zPX_DVjSwU9i5x12kgxQgFVxkB9gA0BBvpWqzUa4N7BKZCf7sH0o3U7-ZdjeIX5KLRRqnvyQuL7dDIVUVPjADAMNH","expires_in":7200})
3145
+2018/09/13 19:11:53 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_BdnfI9eRgdWJ2pX_ptvxYJzNwW1N7Tx5K1fl4Kg96qRNBPiooTJsbFsCie5kE20w8zPX_DVjSwU9i5x12kgxQgFVxkB9gA0BBvpWqzUa4N7BKZCf7sH0o3U7-ZdjeIX5KLRRqnvyQuL7dDIVUVPjADAMNH expires_in:7200])
3146
+2018/09/13 19:14:43 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3147
+2018/09/13 19:14:44 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_BMIA6dCwkLjDzepNYIIRFe2JzLIctYG36ppOfwE6i_M6bUIvmfktLfZ26ePesQFSdCvVscBoGHS8MPF_P-LJrquzmexWDTHcfZUBw42eHC_XPABs2jKzKz3ekPy5vK0UZnnO68NRYYzBr2nzLGXbAHABWN","expires_in":7200})
3148
+2018/09/13 19:14:44 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_BMIA6dCwkLjDzepNYIIRFe2JzLIctYG36ppOfwE6i_M6bUIvmfktLfZ26ePesQFSdCvVscBoGHS8MPF_P-LJrquzmexWDTHcfZUBw42eHC_XPABs2jKzKz3ekPy5vK0UZnnO68NRYYzBr2nzLGXbAHABWN expires_in:7200])
3149
+2018/09/13 19:23:03 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3150
+2018/09/13 19:23:04 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_3F2SCIMWfeDPI5z-531zJHgzuaUav4JQaR18w0wICNTy6XXNQcfIHldt0bppa4YPZLMwYtKsRJbb2jl8scaagJq5wbGsNCjJuCGA32sMqwN-DjMaFmuflHM9tIhOy9Nc1-7yUtNWcVm-m72FWQBhACADXI","expires_in":7200})
3151
+2018/09/13 19:23:04 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_3F2SCIMWfeDPI5z-531zJHgzuaUav4JQaR18w0wICNTy6XXNQcfIHldt0bppa4YPZLMwYtKsRJbb2jl8scaagJq5wbGsNCjJuCGA32sMqwN-DjMaFmuflHM9tIhOy9Nc1-7yUtNWcVm-m72FWQBhACADXI expires_in:7200])
3152
+2018/09/13 19:36:36 [I] 请求远程接口: %!(EXTRA string=https://api.weixin.qq.com/cgi-bin/token?appid=wx7320287e057bbeee&grant_type=client_credential&secret=6e844dc2ade439545c47569ba1707673)
3153
+2018/09/13 19:36:36 [I] 远程请求结果:%!(EXTRA string={"access_token":"13_Dgj9aFWEtUxeOojlCynPzMk6KposI5qyWTWRhdn_gEBHEEO7uXxaeNRZ-LfWoT8XWB6GFW_Ppk6zj8lotRj0BudhE64k4Pcv9-yuWK-LyvU7ZKqPP2CowT6qzBy0vOjKIvetxFS8yxJeN0C6LSMfAEAUBV","expires_in":7200})
3154
+2018/09/13 19:36:36 [I] 接口返回结果: %!(EXTRA map[string]interface {}=map[access_token:13_Dgj9aFWEtUxeOojlCynPzMk6KposI5qyWTWRhdn_gEBHEEO7uXxaeNRZ-LfWoT8XWB6GFW_Ppk6zj8lotRj0BudhE64k4Pcv9-yuWK-LyvU7ZKqPP2CowT6qzBy0vOjKIvetxFS8yxJeN0C6LSMfAEAUBV expires_in:7200])
3155
+2018/09/13 19:40:08 [E] 解析 Token 失败: token contains an invalid number of segments

+ 25
- 10
models/coupon/coupon.go View File

259
 	return coupons, err
259
 	return coupons, err
260
 }
260
 }
261
 
261
 
262
-// CaseUsableCoupon 案场可用优惠券信息
263
-type CaseUsableCoupon struct {
264
-	model.TaCoupon `xorm:"extends"`
265
-	CustomerCoupon []model.TaCustomerCoupon
266
-}
267
-
268
 // GetCaseUsableCoupon 获取案场可用优惠券信息
262
 // GetCaseUsableCoupon 获取案场可用优惠券信息
269
-func (m *CouponDAO) GetCaseUsableCoupon(caseid, userid string, page, pageSize int) ([]CaseUsableCoupon, error) {
270
-	var Coupons []CaseUsableCoupon
263
+func (m *CouponDAO) GetCaseUsableCoupon(caseid, userid string, page, pageSize int) ([]CaseCouponDetail, error) {
264
+	var Coupons []CaseCouponDetail
271
 	sql := `select * from ta_coupon where case_id=? and status=? and end_date>now() order by create_date limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
265
 	sql := `select * from ta_coupon where case_id=? and status=? and end_date>now() order by create_date limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
272
 	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL).Find(&Coupons)
266
 	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL).Find(&Coupons)
273
 	if userid != "" {
267
 	if userid != "" {
290
 }
284
 }
291
 
285
 
292
 // GetCouponDetail 获取优惠券详情
286
 // GetCouponDetail 获取优惠券详情
293
-func (m *CouponDAO) GetCouponDetail(couponid string) (*CaseUsableCoupon, error) {
294
-	var coupon = new(CaseUsableCoupon)
287
+func (m *CouponDAO) GetCouponDetail(couponid string) (*CaseCouponDetail, error) {
288
+	var coupon = new(CaseCouponDetail)
295
 	sql := `select * from ta_coupon_Coupon where coupon_id=? and status>?`
289
 	sql := `select * from ta_coupon_Coupon where coupon_id=? and status>?`
296
 	_, err := m.db.Sql(sql, couponid, models.STATUS_DEL).Get(&coupon)
290
 	_, err := m.db.Sql(sql, couponid, models.STATUS_DEL).Get(&coupon)
297
 	if err != nil {
291
 	if err != nil {
321
 	err := m.db.Where("case_id=?", caseid).And("sales_id=?", userid).And("status>?", models.STATUS_DEL).Find(&customerCoupons)
315
 	err := m.db.Where("case_id=?", caseid).And("sales_id=?", userid).And("status>?", models.STATUS_DEL).Find(&customerCoupons)
322
 	return customerCoupons, err
316
 	return customerCoupons, err
323
 }
317
 }
318
+
319
+// GetCouponWithCustomer 获取优惠券明细
320
+func (m CouponDAO) GetCouponWithCustomer(couponid string) (*CaseCouponDetail, error) {
321
+	var coupon = new(CaseCouponDetail)
322
+	sql := `select * from ta_coupon where coupin_id=?`
323
+	_, err := m.db.Sql(sql, couponid).Get(&coupon)
324
+	if err != nil {
325
+		return nil, err
326
+	}
327
+	if coupon == nil || coupon.CouponId == "" {
328
+		return nil, errors.New("无优惠券信息")
329
+	}
330
+	var customerCopons []model.TaCustomerCoupon
331
+	sql = `select * from ta_customer_coupon where coupon_id = ? and status>?`
332
+	err = m.db.Sql(sql, coupon, models.STATUS_DEL).Find(&customerCopons)
333
+	if err != nil {
334
+		return nil, err
335
+	}
336
+	coupon.CustomerCoupon = customerCopons
337
+	return coupon, nil
338
+}

+ 6
- 0
models/coupon/types.go View File

18
 	Images         []model.TaCouponImage
18
 	Images         []model.TaCouponImage
19
 	Rules          []model.TaCouponRule
19
 	Rules          []model.TaCouponRule
20
 }
20
 }
21
+
22
+// CaseUsableCoupon 案场可用优惠券信息
23
+type CaseCouponDetail struct {
24
+	model.TaCoupon `xorm:"extends"`
25
+	CustomerCoupon []model.TaCustomerCoupon
26
+}

+ 13
- 0
service/coupon/coupon.go View File

368
 	}
368
 	}
369
 	return coupon, nil
369
 	return coupon, nil
370
 }
370
 }
371
+
372
+// GetCouponWithCustomer 获取优惠券明细
373
+func (s *CouponServ) GetCouponWithCustomer(couponid string) (*coupon.CaseCouponDetail, error) {
374
+	if couponid == "" {
375
+		return nil, errors.New("没有券信息!")
376
+	}
377
+	couponDetail, err := s.dao.GetCouponDetail(couponid)
378
+	if err != nil {
379
+		utils.LogError("获取优惠券失败: " + err.Error())
380
+		return nil, errors.New("获取优惠券失败")
381
+	}
382
+	return couponDetail, nil
383
+}

+ 52
- 26
service/sys.go View File

8
 	"spaceofcheng/services/models/customer"
8
 	"spaceofcheng/services/models/customer"
9
 	"spaceofcheng/services/models/model"
9
 	"spaceofcheng/services/models/model"
10
 	"spaceofcheng/services/utils"
10
 	"spaceofcheng/services/utils"
11
+	"strconv"
11
 	"strings"
12
 	"strings"
12
 	"time"
13
 	"time"
13
 
14
 
54
 		}
55
 		}
55
 	}
56
 	}
56
 
57
 
58
+	// 客户端类型
59
+	// 通过 UA 判断
60
+	clientType := utils.GetClientType(gctx.Request)
61
+	if clientType == utils.ClientWechat {
62
+		// 初始化微信配置
63
+		if err := s.initWechatClient(s.org.OrgId); err != nil {
64
+			utils.LogError("初始化微信客户端失败: " + err.Error())
65
+
66
+			return map[string]interface{}{
67
+				"code":  http.StatusInternalServerError,
68
+				"error": errors.New("初始化微信客户端失败"),
69
+			}
70
+		}
71
+	}
72
+
57
 	// 获取 token
73
 	// 获取 token
58
-	token, err := s.getToken(gctx)
74
+	token, err := s.getToken(gctx, clientType)
59
 	if err != nil {
75
 	if err != nil {
76
+		message := make(map[string]interface{})
77
+		if clientType == utils.ClientWechat {
78
+			message["appid"] = utils.GetWxAppID(s.org.OrgId)
79
+		}
80
+
60
 		// token 报错一律视为需要重新登录
81
 		// token 报错一律视为需要重新登录
61
 		return map[string]interface{}{
82
 		return map[string]interface{}{
62
-			"code":  http.StatusUnauthorized,
63
-			"error": err,
83
+			"code":    http.StatusUnauthorized,
84
+			"error":   err,
85
+			"message": message,
64
 		}
86
 		}
65
 	}
87
 	}
66
 
88
 
67
-	// 客户端类型
68
-	// 通过 UA 判断
69
-	clientType := utils.GetClientType(gctx.Request)
70
-
71
 	// pc 管理端
89
 	// pc 管理端
72
 	if clientType == utils.ClientAdmin {
90
 	if clientType == utils.ClientAdmin {
73
 		return s.authPCAdmin(gctx, token)
91
 		return s.authPCAdmin(gctx, token)
163
 
181
 
164
 	// 未登录 或 未验证
182
 	// 未登录 或 未验证
165
 	if token.ID == "" {
183
 	if token.ID == "" {
166
-		// 需要微信验证
167
-		if code == "" {
168
-			return map[string]interface{}{
169
-				"code":  http.StatusUnauthorized,
170
-				"error": errors.New("请授权微信用户登录"),
171
-				"message": map[string]interface{}{
172
-					"appid": utils.GetWxAppID(s.org.OrgId),
173
-				},
174
-			}
175
-		}
176
-
177
 		// 微信用户信息
184
 		// 微信用户信息
178
 		var err error
185
 		var err error
179
 		wxUser, err = s.wechartSignIn(gctx, code)
186
 		wxUser, err = s.wechartSignIn(gctx, code)
180
 		if err != nil {
187
 		if err != nil {
188
+			if strings.Index(err.Error(), strconv.Itoa(http.StatusUnauthorized)) > -1 {
189
+				return map[string]interface{}{
190
+					"code":  http.StatusUnauthorized,
191
+					"error": errors.New("请授权微信用户登录"),
192
+					"message": map[string]interface{}{
193
+						"appid": utils.GetWxAppID(s.org.OrgId),
194
+					},
195
+				}
196
+			}
197
+
181
 			return map[string]interface{}{
198
 			return map[string]interface{}{
182
 				"code":  http.StatusInternalServerError,
199
 				"code":  http.StatusInternalServerError,
183
 				"error": err,
200
 				"error": err,
299
 		}, nil
316
 		}, nil
300
 	}
317
 	}
301
 
318
 
302
-	// 初始化微信配置
303
-	if err := s.initWechatClient(s.org.OrgId); err != nil {
304
-		utils.LogError("初始化微信客户端失败: " + err.Error())
305
-		return nil, errors.New("初始化微信客户端失败")
319
+	if code == "" {
320
+		return nil, errors.New(strconv.Itoa(http.StatusUnauthorized))
306
 	}
321
 	}
307
 
322
 
308
 	// 获取 微信信息
323
 	// 获取 微信信息
319
 	return utils.MapToWechatUser(wxUserMap), nil
334
 	return utils.MapToWechatUser(wxUserMap), nil
320
 }
335
 }
321
 
336
 
322
-func (s *SysServ) getToken(gctx *context.Context) (*utils.JWTToken, error) {
337
+func (s *SysServ) getToken(gctx *context.Context, clientType string) (*utils.JWTToken, error) {
338
+	if beego.BConfig.RunMode == "dev" {
339
+		id := "0"
340
+		if clientType == utils.ClientWechat {
341
+			id = "OPENID"
342
+		}
343
+
344
+		return &utils.JWTToken{
345
+			ID: id,
346
+		}, nil
347
+	}
348
+
323
 	tokenRaw := gctx.Input.Header(utils.TokenHeader)
349
 	tokenRaw := gctx.Input.Header(utils.TokenHeader)
324
 	if tokenRaw == "" {
350
 	if tokenRaw == "" {
325
-		return nil, nil
351
+		return new(utils.JWTToken), nil
326
 	}
352
 	}
327
 
353
 
328
 	tokenEnStr := strings.Trim(strings.TrimLeft(tokenRaw, utils.TokenSchema), " ")
354
 	tokenEnStr := strings.Trim(strings.TrimLeft(tokenRaw, utils.TokenSchema), " ")
490
 }
516
 }
491
 
517
 
492
 // initWechatClient 初始化微信客户端
518
 // initWechatClient 初始化微信客户端
493
-func (s SysServ) initWechatClient(orgID string) error {
519
+func (s *SysServ) initWechatClient(orgID string) error {
494
 	conf, err := s.dao.GetWeChatConfig(orgID)
520
 	conf, err := s.dao.GetWeChatConfig(orgID)
495
 	if err != nil {
521
 	if err != nil {
496
 		utils.LogError("获取微信配置失败: " + err.Error())
522
 		utils.LogError("获取微信配置失败: " + err.Error())
514
 }
540
 }
515
 
541
 
516
 // SetOrgByID 获取组织
542
 // SetOrgByID 获取组织
517
-func (s SysServ) SetOrgByID(orgID string) error {
543
+func (s *SysServ) SetOrgByID(orgID string) error {
518
 	orgID = utils.DecodeBase64NoTail(orgID)
544
 	orgID = utils.DecodeBase64NoTail(orgID)
519
 
545
 
520
 	org, err := s.dao.GetOrg(orgID)
546
 	org, err := s.dao.GetOrg(orgID)