jyq %!s(int64=4) %!d(string=hai) anos
pai
achega
79f4c9575d

+ 22 - 20
api/grpc/base.go

@@ -4,7 +4,9 @@ import (
 	"context"
 	pb "sportfitness/base/api/grpc/base"
 	"sportfitness/base/assembly/base/service"
+	"sportfitness/base/global"
 	"strings"
+	"time"
 
 	"google.golang.org/grpc/metadata"
 )
@@ -101,7 +103,7 @@ func (a Api) AcrossUserSimpleQuery(ctx context.Context, r *pb.StandardRequest) (
 func (a Api) VipUserSimpleQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
 	// 获取token,并验证签名函数
 	token, q, sign := a.webToGoVerify(ctx, r)
-	rs := service.User{}.AcrossUserSimpleQuery(token, q.ShopID, q.JsonStr, sign)
+	rs := service.User{}.VipUserSimpleQuery(token, q.ShopID, q.JsonStr, sign)
 	rst := a.toWebFunc(rs)
 	return rst, nil
 }
@@ -994,12 +996,12 @@ func (a Api) UnBindHrSensor(ctx context.Context, r *pb.StandardRequest) (*pb.Sta
 
 // ----------------------- 微信管理 ---------------------------------------------
 
-// GenVerifyImageByWeiXin 微信登陆获取图片验证码
-func (Api) GenVerifyImageByWeiXin(ctx context.Context, r *pb.GenVerifyImageRequest) (*pb.GenVerifyImageReply, error) {
-	height := int(r.Height)
-	width := int(r.Width)
+// GenVerifyImageByWinXin 微信登陆获取图片验证码
+func (Api) GenVerifyImageByWinXin(ctx context.Context, r *pb.GenVerifyImageRequest) (*pb.GenVerifyImageReply, error) {
+	//height := int(r.Height)
+	//width := int(r.Width)
 
-	id, pic := service.VerifyCode{}.GenImage(height, width)
+	id, pic := service.VerifyCode{}.GenImage(int(r.Height), int(r.Width))
 
 	return &pb.GenVerifyImageReply{
 		CodeId:      id,
@@ -1008,20 +1010,20 @@ func (Api) GenVerifyImageByWeiXin(ctx context.Context, r *pb.GenVerifyImageReque
 }
 
 // GenPhoneVerifyCodeByWeiXin 微信登陆获取短信验证码
-func (a Api) GenPhoneVerifyCodeByWeiXin(ctx context.Context, r *pb.GenPhoneVerifyCodeRequest) (*pb.DefaultReply, error) {
-	//service.VerifyCode{}.GetPhoneVFCode(
-	//	a.getSysToken(ctx),
-	//	in.Account, in.Ip, in.Code, in.TemplateCode, in.VerifyType, time.Duration(in.ExpireDurationNano))
-
-	return &pb.DefaultReply{}, nil
-}
-
-// VipUserWeiXinLogin 微信登陆
-func (a Api) VipUserWeiXinLogin(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
-	// 获取token,并验证签名函数
-	token, q, sign := a.webToGoVerify(ctx, r)
-
-	rs := service.Wx{}.VipUserWeiXinLogin(token, q.ShopID, q.JsonStr, sign)
+func (a Api) GenPhoneVerifyCodeByWeiXin(ctx context.Context, r *pb.GenPhoneVerifyCodeRequestWX) (*pb.StandardReply, error) {
+	ip := a.getRemoteIp(ctx)
+	rs := service.VerifyCode{}.GetPhoneVFCode(
+		r.SId,
+		r.Account, ip, global.TemplateCode, r.CodeId, r.ImgCode, r.VerifyType, time.Duration(global.SmsExpireNano))
 	rst := a.toWebFunc(rs)
 	return rst, nil
 }
+
+//// WeiXinSignIn 微信登陆
+//func (a Api) WeiXinSignIn(ctx context.Context, r *pb.WeiXinSignInRequest) (*pb.SignInReply, error) {
+//
+//
+//	rs := service.Wx{}.WeiXinSignIn(token, q.ShopID, q.JsonStr, sign)
+//
+//	return &pb.SignInReply{Token: rs}, nil
+//}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 517 - 449
api/grpc/base/base.pb.go


+ 50 - 14
api/grpc/base/base_grpc.pb.go

@@ -135,8 +135,9 @@ type ApiClient interface {
 	ActionQuery(ctx context.Context, in *StandardRequest, opts ...grpc.CallOption) (*StandardReply, error)
 	// 用户微信登陆
 	GenVerifyImageByWinXin(ctx context.Context, in *GenVerifyImageRequest, opts ...grpc.CallOption) (*GenVerifyImageReply, error)
-	GenPhoneVerifyCode(ctx context.Context, in *GenPhoneVerifyCodeRequest, opts ...grpc.CallOption) (*DefaultReply, error)
+	GenPhoneVerifyCodeByWeiXin(ctx context.Context, in *GenPhoneVerifyCodeRequestWX, opts ...grpc.CallOption) (*StandardReply, error)
 	CheckVerifyCode(ctx context.Context, in *CheckVerifyCodeRequest, opts ...grpc.CallOption) (*DefaultReply, error)
+	WeiXinSignIn(ctx context.Context, in *WeiXinSignInRequest, opts ...grpc.CallOption) (*SignInReply, error)
 }
 
 type apiClient struct {
@@ -1110,9 +1111,9 @@ func (c *apiClient) GenVerifyImageByWinXin(ctx context.Context, in *GenVerifyIma
 	return out, nil
 }
 
-func (c *apiClient) GenPhoneVerifyCode(ctx context.Context, in *GenPhoneVerifyCodeRequest, opts ...grpc.CallOption) (*DefaultReply, error) {
-	out := new(DefaultReply)
-	err := c.cc.Invoke(ctx, "/base.Api/GenPhoneVerifyCode", in, out, opts...)
+func (c *apiClient) GenPhoneVerifyCodeByWeiXin(ctx context.Context, in *GenPhoneVerifyCodeRequestWX, opts ...grpc.CallOption) (*StandardReply, error) {
+	out := new(StandardReply)
+	err := c.cc.Invoke(ctx, "/base.Api/GenPhoneVerifyCodeByWeiXin", in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -1128,6 +1129,15 @@ func (c *apiClient) CheckVerifyCode(ctx context.Context, in *CheckVerifyCodeRequ
 	return out, nil
 }
 
+func (c *apiClient) WeiXinSignIn(ctx context.Context, in *WeiXinSignInRequest, opts ...grpc.CallOption) (*SignInReply, error) {
+	out := new(SignInReply)
+	err := c.cc.Invoke(ctx, "/base.Api/WeiXinSignIn", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // ApiServer is the server API for Api service.
 // All implementations must embed UnimplementedApiServer
 // for forward compatibility
@@ -1249,8 +1259,9 @@ type ApiServer interface {
 	ActionQuery(context.Context, *StandardRequest) (*StandardReply, error)
 	// 用户微信登陆
 	GenVerifyImageByWinXin(context.Context, *GenVerifyImageRequest) (*GenVerifyImageReply, error)
-	GenPhoneVerifyCode(context.Context, *GenPhoneVerifyCodeRequest) (*DefaultReply, error)
+	GenPhoneVerifyCodeByWeiXin(context.Context, *GenPhoneVerifyCodeRequestWX) (*StandardReply, error)
 	CheckVerifyCode(context.Context, *CheckVerifyCodeRequest) (*DefaultReply, error)
+	WeiXinSignIn(context.Context, *WeiXinSignInRequest) (*SignInReply, error)
 	mustEmbedUnimplementedApiServer()
 }
 
@@ -1579,12 +1590,15 @@ func (UnimplementedApiServer) ActionQuery(context.Context, *StandardRequest) (*S
 func (UnimplementedApiServer) GenVerifyImageByWinXin(context.Context, *GenVerifyImageRequest) (*GenVerifyImageReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GenVerifyImageByWinXin not implemented")
 }
-func (UnimplementedApiServer) GenPhoneVerifyCode(context.Context, *GenPhoneVerifyCodeRequest) (*DefaultReply, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method GenPhoneVerifyCode not implemented")
+func (UnimplementedApiServer) GenPhoneVerifyCodeByWeiXin(context.Context, *GenPhoneVerifyCodeRequestWX) (*StandardReply, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GenPhoneVerifyCodeByWeiXin not implemented")
 }
 func (UnimplementedApiServer) CheckVerifyCode(context.Context, *CheckVerifyCodeRequest) (*DefaultReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method CheckVerifyCode not implemented")
 }
+func (UnimplementedApiServer) WeiXinSignIn(context.Context, *WeiXinSignInRequest) (*SignInReply, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method WeiXinSignIn not implemented")
+}
 func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {}
 
 // UnsafeApiServer may be embedded to opt out of forward compatibility for this service.
@@ -3524,20 +3538,20 @@ func _Api_GenVerifyImageByWinXin_Handler(srv interface{}, ctx context.Context, d
 	return interceptor(ctx, in, info, handler)
 }
 
-func _Api_GenPhoneVerifyCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(GenPhoneVerifyCodeRequest)
+func _Api_GenPhoneVerifyCodeByWeiXin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GenPhoneVerifyCodeRequestWX)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
-		return srv.(ApiServer).GenPhoneVerifyCode(ctx, in)
+		return srv.(ApiServer).GenPhoneVerifyCodeByWeiXin(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/base.Api/GenPhoneVerifyCode",
+		FullMethod: "/base.Api/GenPhoneVerifyCodeByWeiXin",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(ApiServer).GenPhoneVerifyCode(ctx, req.(*GenPhoneVerifyCodeRequest))
+		return srv.(ApiServer).GenPhoneVerifyCodeByWeiXin(ctx, req.(*GenPhoneVerifyCodeRequestWX))
 	}
 	return interceptor(ctx, in, info, handler)
 }
@@ -3560,6 +3574,24 @@ func _Api_CheckVerifyCode_Handler(srv interface{}, ctx context.Context, dec func
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Api_WeiXinSignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(WeiXinSignInRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ApiServer).WeiXinSignIn(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/base.Api/WeiXinSignIn",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ApiServer).WeiXinSignIn(ctx, req.(*WeiXinSignInRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Api_ServiceDesc is the grpc.ServiceDesc for Api service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -3996,13 +4028,17 @@ var Api_ServiceDesc = grpc.ServiceDesc{
 			Handler:    _Api_GenVerifyImageByWinXin_Handler,
 		},
 		{
-			MethodName: "GenPhoneVerifyCode",
-			Handler:    _Api_GenPhoneVerifyCode_Handler,
+			MethodName: "GenPhoneVerifyCodeByWeiXin",
+			Handler:    _Api_GenPhoneVerifyCodeByWeiXin_Handler,
 		},
 		{
 			MethodName: "CheckVerifyCode",
 			Handler:    _Api_CheckVerifyCode_Handler,
 		},
+		{
+			MethodName: "WeiXinSignIn",
+			Handler:    _Api_WeiXinSignIn_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "base.proto",

+ 54 - 0
assembly/base/repository/postgre/verifycode.go

@@ -0,0 +1,54 @@
+/**
+ * @ File:
+ * @ Date: 2021/5/21 10:59
+ * @ Author: JYQ
+ * @ Description:
+ */
+package postgre
+
+import (
+	pb "sportfitness/base/api/grpc/base"
+)
+
+type PGVerifyCode struct {
+}
+
+type VFCodeSendType int
+
+const (
+	_ VFCodeSendType = iota
+	VFCodeTypePhone
+	VFCodeTypeEmail
+)
+
+type VCode struct {
+	SId      int64
+	Account  string
+	SendType VFCodeSendType
+	CodeType pb.VerifyType
+	Code     string
+	Ip       string
+	CreateAt int64
+	ExpireAt int64
+}
+
+func (PGVerifyCode) CreateVerifyCode(jsonStr string, sId int64) (result string, err error) {
+	err = getClient().Raw("select fn_verify_code_create(? ,? ,?, ? )", 0, sId, jsonStr, "").
+		Scan(&result).Error
+
+	return
+}
+
+func (PGVerifyCode) CheckPhoneVerifyCode(jsonStr string, sId int64) (result bool, err error) {
+	err = getClient().Raw("select fn_verify_code_check(? ,? ,?, ? )", 0, sId, jsonStr, "").
+		Scan(&result).Error
+
+	return
+}
+
+func (PGVerifyCode) GetShopSmsConf(sId int64) (result string, err error) {
+	//err = getClient().Raw("select fn_verify_code_create(? ,? ,?, ? )", 0, sId, jsonStr, "").
+	//	Scan(&result).Error
+	result = "英泓小飞龙"
+	return
+}

+ 105 - 0
assembly/base/repository/sms/phone_code.go

@@ -0,0 +1,105 @@
+// Package sms
+/**
+ * @ File:
+ * @ Date: 2021/5/21 11:12
+ * @ Author: JYQ
+ * @ Description:
+ */
+package sms
+
+import (
+	"crypto/md5"
+	"encoding/hex"
+	"encoding/json"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+	pb "sportfitness/base/api/grpc/base"
+	"sportfitness/base/assembly/base/repository/postgre"
+	"strings"
+
+	"git.beswell.com/gframe/application"
+)
+
+type Iyoogo struct {
+	station  string
+	appKey   string
+	sign     string
+	signName string
+}
+
+func NewShortMsgIyoogo() *Iyoogo {
+	dao := &Iyoogo{
+		station: "http://sms.iyoogo.com/itf5",
+		appKey:  "07e54cc3bec2fc46adad77486ef857a9",
+		//signName: "佰意兴科技",
+	}
+
+	SECRET := "fb25c484b5a7880ed25a0d303a5f654d"
+	cry := md5.New()
+	cry.Write([]byte(SECRET + dao.appKey + SECRET))
+
+	dao.sign = hex.EncodeToString(cry.Sum(nil))
+	dao.sign = strings.ToUpper(dao.sign)
+	return dao
+
+}
+
+func (i Iyoogo) SendCode(vf *postgre.VCode, templateCode, sName string) {
+	var smsParam []byte
+	var err error
+	switch vf.CodeType {
+	case pb.VerifyType_SignIn:
+		smsParam, err = json.Marshal(map[string]string{
+			"code": vf.Code,
+		})
+		if err != nil {
+			return
+		}
+	}
+
+	url := fmt.Sprintf(
+		"%s/?method=smssend&app_key=%s&sign=%s&v=1.0&sms_free_sign_name=%s&sms_param=%s&rec_num=%s&sms_template_code=%s&sms_type=normal",
+		i.station, i.appKey, i.sign, sName, smsParam, vf.Account, templateCode)
+
+	resp, err := http.Get(url)
+	if err != nil {
+		err = application.ErrorBusinessF(application.ErrorCodeInternal, err.Error())
+		panic(err)
+	}
+	defer resp.Body.Close()
+	body, err := ioutil.ReadAll(resp.Body)
+	if err != nil {
+		err = application.ErrorBusinessF(application.ErrorCodeInternal, err.Error())
+		panic(err)
+	}
+	type Result struct {
+		ErrCode string `json:"err_code"`
+		Success bool   `json:"success"`
+		Msg     string `json:"msg"`
+	}
+	type Resp struct {
+		Result Result `json:"result"`
+	}
+
+	respStruct := &Resp{}
+
+	err = json.Unmarshal(body, respStruct)
+	if err != nil {
+		err = application.ErrorBusinessF(application.ErrorCodeInternal, err.Error()+"|resp string:"+string(body))
+		panic(err)
+	}
+
+	if !respStruct.Result.Success {
+		err = application.ErrorBusinessF(application.ErrorCodeInternal, respStruct.Result.Msg)
+		panic(err)
+	}
+}
+
+type PhoneCode struct {
+}
+
+func (p PhoneCode) SendCode(vf *postgre.VCode, templateCode, sName string) {
+	iyoogo := NewShortMsgIyoogo()
+	iyoogo.SendCode(vf, templateCode, sName)
+}

+ 12 - 0
assembly/base/service/base.go

@@ -2,12 +2,15 @@ package service
 
 import (
 	"encoding/json"
+	"math"
+	"math/rand"
 	"runtime"
 	pb "sportfitness/base/api/grpc/base"
 	"sportfitness/base/errors"
 	"sportfitness/base/repository/grpc/bsw/im"
 	im2 "sportfitness/base/repository/grpc/bsw/im/im"
 	"strings"
+	"time"
 
 	"git.beswell.com/gframe/application"
 	"github.com/sirupsen/logrus"
@@ -121,3 +124,12 @@ func (base) ManageStatusToWebStatus(s im2.Status) (status pb.WebStatus) {
 	}
 	return status
 }
+
+func RandomInt(n int) int {
+	min := int(math.Pow(10, float64(n-1)))
+	max := min*9 - 1
+
+	rand1 := rand.New(rand.NewSource(time.Now().UnixNano()))
+	code := rand1.Intn(max) + min
+	return code
+}

+ 61 - 38
assembly/base/service/verifyCode.go

@@ -8,8 +8,14 @@
 package service
 
 import (
+	"encoding/json"
+	pb "sportfitness/base/api/grpc/base"
+	"sportfitness/base/assembly/base/repository/postgre"
 	"sportfitness/base/assembly/base/repository/redis"
+	"sportfitness/base/assembly/base/repository/sms"
 	"sportfitness/base/errors"
+	"strconv"
+	"time"
 
 	"github.com/mojocn/base64Captcha"
 )
@@ -49,41 +55,58 @@ func (VerifyCode) GenImage(height, width int) (id, pic string) {
 	return
 }
 
-//
-//func (v VerifyCode) GetPhoneVFCode(sysToken, account, ip, code, templateCode string, verifyType im.VerifyType, expireDuration time.Duration) {
-//	sysId := model.SysInfoThisId
-//	if sysToken != "" {
-//		sysId = v.getSysIdBySysToken(sysToken)
-//	}
-//	now := time.Now()
-//	vf := &model.VerifyCode{
-//		SysId:    sysId,
-//		Account:  account,
-//		SendType: model.VFCodeTypePhone,
-//		CodeType: verifyType,
-//		Code:     code,
-//		Ip:       ip,
-//		CreateAt: now,
-//		ExpireAt: now.Add(expireDuration),
-//	}
-//
-//	postgre.VerifyCode{}.Create(vf)
-//	http.PhoneCode{}.SendCode(vf, templateCode)
-//}
-//
-//func (v VerifyCode) CheckPhoneVFCode(sysToken, account, code string, verifyType im.VerifyType) {
-//	sysId := model.SysInfoThisId
-//	if sysToken != "" {
-//		sysId = v.getSysIdBySysToken(sysToken)
-//	}
-//
-//	vf := &model.VerifyCode{
-//		SysId:    sysId,
-//		Account:  account,
-//		SendType: model.VFCodeTypePhone,
-//		CodeType: verifyType,
-//		Code:     code,
-//	}
-//
-//	postgre.VerifyCode{}.Check(vf)
-//}
+func (v VerifyCode) GetPhoneVFCode(sId int64, account, ip, templateCode, codeId, imgCode string,
+	verifyType pb.VerifyType, expireDuration time.Duration) string {
+	// 校验图形验证码是否正确
+	if !(redis.CaptchaStore{}.Verify(codeId, imgCode, true)) {
+		panic(errors.ErrVerifyCode)
+	}
+	// 校验手机号是否存在  todo 调用手机号校验接口
+
+	// 根据sId查询短信签名 todo 以后会存在数据库中,目前只是写在代码层
+	signName, _ := postgre.PGVerifyCode{}.GetShopSmsConf(sId)
+
+	code := strconv.Itoa(RandomInt(6))
+	now := time.Now()
+	vf := &postgre.VCode{
+		SId:      sId,
+		Account:  account,
+		SendType: postgre.VFCodeTypePhone,
+		CodeType: verifyType,
+		Code:     code,
+		Ip:       ip,
+		CreateAt: now.Unix(),
+		ExpireAt: now.Add(expireDuration).Unix(),
+	}
+	str, err := json.Marshal(vf)
+	if err != nil {
+		panic(errors.M2JError)
+	}
+	rs, err := postgre.PGVerifyCode{}.CreateVerifyCode(string(str), sId)
+	if err != nil {
+		panic(errors.PGError)
+	}
+	sms.PhoneCode{}.SendCode(vf, templateCode, signName)
+	return rs
+}
+
+func (v VerifyCode) CheckPhoneVFCode(sId int64, account, code string, verifyType pb.VerifyType) bool {
+
+	vf := &postgre.VCode{
+		SId:      sId,
+		Account:  account,
+		SendType: postgre.VFCodeTypePhone,
+		CodeType: verifyType,
+		Code:     code,
+	}
+	str, err := json.Marshal(vf)
+	if err != nil {
+		panic(errors.M2JError)
+	}
+
+	b, err := postgre.PGVerifyCode{}.CheckPhoneVerifyCode(string(str), sId)
+	if err != nil {
+		panic(errors.PGError)
+	}
+	return b
+}

+ 1 - 1
assembly/base/service/wx.go

@@ -16,7 +16,7 @@ type Wx struct {
 	base
 }
 
-func (w Wx) VipUserWeiXinLogin(token string, objectShopId int64, jsonStr string, sign string) string {
+func (w Wx) WeiXinSignIn(token string, objectShopId int64, jsonStr string, sign string) string {
 	optId := w.checkPermission(token, objectShopId)
 
 	rst, err := postgre.PGWx{}.VipUserWeiXinLogin(optId, objectShopId, jsonStr, sign)

+ 1 - 0
errors/error.go

@@ -27,6 +27,7 @@ var (
 	PGError            = application.Errorf(application.ErrorCode(pb.ErrorCode_PGErr), "数据库内部错误")
 	PmsnError          = application.Errorf(application.ErrorCode(pb.ErrorCode_PmsnError), "用户无此权限,请联系管理员")
 	J2MError           = application.Errorf(application.ErrorCode(pb.ErrorCode_J2MError), "Json数据解析失败,请检查后提交")
+	M2JError           = application.Errorf(application.ErrorCode(pb.ErrorCode_M2JError), "数据封装失败,请检查后提交")
 	WebStatusError     = application.Errorf(application.ErrorCode(pb.ErrorCode_WebStatusError), "状态值错误,请检查后重新提交")
 	WebToImStatusError = application.Errorf(application.ErrorCode(pb.ErrorCode_WebToImStatusError),
 		"状态值转换错误,请检查后提交")

+ 2 - 0
global/vars.go

@@ -3,4 +3,6 @@ package global
 var (
 	SysToken       string
 	TokenExpireSec = int64(60 * 60 * 24 * 14)
+	TemplateCode   = "SMS_215480232"
+	SmsExpireNano  = 180000000000 // 3分钟
 )

+ 16 - 7
proto/server/base.proto

@@ -12,6 +12,7 @@ enum ErrorCode{
   WebStatusError = 121;
   WebToImStatusError = 122;
   ImToWebtatusError = 123;
+  M2JError = 124;
   PARAM = 150;
   Token = 200;
   VerifyCode = 201;
@@ -145,8 +146,9 @@ service Api {
 
   // 用户微信登陆
   rpc GenVerifyImageByWinXin(GenVerifyImageRequest)returns(GenVerifyImageReply){}
-  rpc GenPhoneVerifyCode(GenPhoneVerifyCodeRequest)returns(DefaultReply){}
+  rpc GenPhoneVerifyCodeByWeiXin(GenPhoneVerifyCodeRequestWX)returns(StandardReply){}
   rpc CheckVerifyCode(CheckVerifyCodeRequest)returns(DefaultReply){}
+  rpc WeiXinSignIn(WeiXinSignInRequest)returns(SignInReply){}
 
 }
 message DefaultRequest{
@@ -316,17 +318,24 @@ enum VerifyType{
   ChangePassword = 3;
 }
 
-message GenPhoneVerifyCodeRequest{
+message GenPhoneVerifyCodeRequestWX{
   VerifyType verifyType = 1;
-  string code = 2;
-  string account = 3;
-  string ip = 4;
-  string templateCode = 5;
-  int64 expireDurationNano = 6;
+  string account = 2;
+  //上级商家ID,必传,写入到微信代码中
+  int64 sId = 3;
+  string codeId = 4;
+  string imgCode = 5;
 }
 
 message CheckVerifyCodeRequest{
   VerifyType verifyType = 1;
   string code = 2;
   string account = 3;
+}
+
+message WeiXinSignInRequest{
+  string code = 1;
+  string account = 2;
+  //上级商家ID,必传,写入到微信代码中
+  int64 sId = 3 ;
 }

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio