Browse Source

0111bug修改1

shenzekai 2 years ago
parent
commit
c2bc971f2e
5 changed files with 9 additions and 1 deletions
  1. 5 1
      handler/send_code.go
  2. 1 0
      model/http_model/project_show.go
  3. 1 0
      service/login_auth.go
  4. 1 0
      service/project.go
  5. 1 0
      service/send_code.go

+ 5 - 1
handler/send_code.go

@@ -63,7 +63,11 @@ func (h *SendCodeHandler) run() {
 		email, err := service.SendCode.GetEmailByPhone(h.ctx, data.Phone)
 		email, err := service.SendCode.GetEmailByPhone(h.ctx, data.Phone)
 		if err != nil {
 		if err != nil {
 			logrus.Errorf("[SendeCodeHandler] call SetSession err:%+v\n", err)
 			logrus.Errorf("[SendeCodeHandler] call SetSession err:%+v\n", err)
-			util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+			if email != "" {
+				util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "账号不存在")
+			} else {
+				util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+			}
 			log.Info("SendeCode fail,req:%+v", h.req)
 			log.Info("SendeCode fail,req:%+v", h.req)
 			return
 			return
 		}
 		}

+ 1 - 0
model/http_model/project_show.go

@@ -40,6 +40,7 @@ type ShowProjectData struct {
 	EstimatedCost    string                `json:"estimated_cost"`     // 预估成本
 	EstimatedCost    string                `json:"estimated_cost"`     // 预估成本
 	EnterpriseID     string                `json:"enterprise_id"`      // 企业id
 	EnterpriseID     string                `json:"enterprise_id"`      // 企业id
 	Balance          string                `json:"balance"`            // 企业余额
 	Balance          string                `json:"balance"`            // 企业余额
+	AvailableBalance string                `json:"available_balance"`  //可用余额
 	ProjectID        string                `json:"project_id"`         // 项目id
 	ProjectID        string                `json:"project_id"`         // 项目id
 	FailReason       string                `json:"fail_reason"`        // 失效原因
 	FailReason       string                `json:"fail_reason"`        // 失效原因
 	Phone            string                `json:"phone"`              // 联系方式
 	Phone            string                `json:"phone"`              // 联系方式

+ 1 - 0
service/login_auth.go

@@ -50,6 +50,7 @@ func (l *loginAuth) AuthToken(ctx context.Context, token string) (*redis_model.A
 
 
 func (l *loginAuth) AuthCode(ctx context.Context, phone string, code string) (string, error) {
 func (l *loginAuth) AuthCode(ctx context.Context, phone string, code string) (string, error) {
 	user, err := db.GetUserByPhone(ctx, phone)
 	user, err := db.GetUserByPhone(ctx, phone)
+	fmt.Println("login_auth", user, err)
 	if err != nil {
 	if err != nil {
 		return "", err
 		return "", err
 	} else if user == nil {
 	} else if user == nil {

+ 1 - 0
service/project.go

@@ -381,6 +381,7 @@ func (*project) GetPorjectDetail(ctx context.Context, projectID string) (*http_m
 		ProductID:        conv.MustString(project.ProductID),
 		ProductID:        conv.MustString(project.ProductID),
 		EnterpriseID:     conv.MustString(project.EnterpriseID),
 		EnterpriseID:     conv.MustString(project.EnterpriseID),
 		Balance:          conv.MustString(enterprise.Balance),
 		Balance:          conv.MustString(enterprise.Balance),
+		AvailableBalance: conv.MustString(enterprise.AvailableBalance),
 		EstimatedCost:    conv.MustString(project.EstimatedCost),
 		EstimatedCost:    conv.MustString(project.EstimatedCost),
 		FailReason:       conv.MustString(project.FailReason),
 		FailReason:       conv.MustString(project.FailReason),
 		CreateAt:         util.GetTimePoionter(project.CreatedAt),
 		CreateAt:         util.GetTimePoionter(project.CreatedAt),

+ 1 - 0
service/send_code.go

@@ -46,6 +46,7 @@ func (s *sendCode) getRedisKey(key string) string {
 
 
 func (s *sendCode) GetEmailByPhone(ctx context.Context, phone string) (string, error) {
 func (s *sendCode) GetEmailByPhone(ctx context.Context, phone string) (string, error) {
 	user, err := db.GetUserByPhone(ctx, phone)
 	user, err := db.GetUserByPhone(ctx, phone)
+	fmt.Println("send_code", user, err)
 	if err != nil {
 	if err != nil {
 		return "", err
 		return "", err
 	} else if user == nil {
 	} else if user == nil {