作者 yangfu

短信验证码 999512

@@ -15,6 +15,7 @@ type Config struct { @@ -15,6 +15,7 @@ type Config struct {
15 MiniAuth config.Auth 15 MiniAuth config.Auth
16 Migrate bool `json:",optional,default=true"` 16 Migrate bool `json:",optional,default=true"`
17 ApiAuth ApiService 17 ApiAuth ApiService
  18 + DebugSmsCode string `json:",optional,default=999512"`
18 } 19 }
19 20
20 type ApiService struct { 21 type ApiService struct {
@@ -121,8 +121,12 @@ func (c WxClientLogin) PhoneSmsCodeLogin(phone string, code string) (*domain.Log @@ -121,8 +121,12 @@ func (c WxClientLogin) PhoneSmsCodeLogin(phone string, code string) (*domain.Log
121 var ( 121 var (
122 users []*domain.User 122 users []*domain.User
123 err error 123 err error
  124 + skipCheckSmsCode bool = false
124 ) 125 )
125 - if _, err = c.l.svcCtx.SmsService.CheckSmsCode(c.l.ctx, smslib.RequestCheckSmsCode{Phone: phone, Code: code}); err != nil { 126 + if c.l.svcCtx.Config.DebugSmsCode != "" && c.l.svcCtx.Config.DebugSmsCode == code {
  127 + skipCheckSmsCode = true
  128 + }
  129 + if _, err = c.l.svcCtx.SmsService.CheckSmsCode(c.l.ctx, smslib.RequestCheckSmsCode{Phone: phone, Code: code}); err != nil && !skipCheckSmsCode {
126 return nil, xerr.NewErrMsgErr(err.Error(), err) 130 return nil, xerr.NewErrMsgErr(err.Error(), err)
127 } 131 }
128 conn := c.l.svcCtx.DefaultDBConn() 132 conn := c.l.svcCtx.DefaultDBConn()
  1 +-- 用户表
  2 +-- (公司ID)索引
  3 +CREATE INDEX IF NOT EXISTS idx_user_company_id ON "public"."user" USING btree(company_id);
  4 +-- (手机号)索引
  5 +CREATE INDEX IF NOT EXISTS idx_user_phone ON "public"."user" USING btree(phone);
  6 +
  7 +-- 用户关注表
  8 +-- (发起人)索引
  9 +CREATE INDEX IF NOT EXISTS idx_user_follow_from_user_id on "public".user_follow USING btree(from_user_id);
  10 +
  11 +-- 角色表
  12 +-- (公司ID)索引
  13 +CREATE INDEX IF NOT EXISTS idx_role_company_id ON "public"."role" USING btree(company_id);