Browse Source

fix:线上详情页手机号展示调整

duxin 5 ngày trước cách đây
mục cha
commit
5c40e8126d
1 tập tin đã thay đổi với 17 bổ sung1 xóa
  1. 17 1
      internal/logic/order/detail.go

+ 17 - 1
internal/logic/order/detail.go

@@ -3,6 +3,7 @@ package order
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/mongodb"
 	"context"
 	"fmt"
 	"github.com/gogf/gf/v2/frame/g"
@@ -349,6 +350,21 @@ WHERE eo.wait_empower_id = %s and jod.is_service_open =1 and jod.status =1 and d
 		}
 		productArr = append(productArr, m)
 	}
+	if userId := gconv.String(orderMap["user_id"]); userId != "" {
+		if gconv.Int(orderMap["is_backstage_order"]) == 0 {
+			if mongodb.IsObjectIdHex(userId) {
+				userData, ok := jyutil.MG.DB().FindById("user", userId, "")
+				if ok && userData != nil && len(*userData) > 0 {
+					orderMap["user_phone"] = common.If(gconv.String((*userData)["s_phone"]) != "", (*userData)["s_phone"], (*userData)["s_m_phone"])
+				}
+			} else {
+				identity := jyutil.Middleground.UserCenter.IdentityByPositionId(gconv.Int64(userId))
+				if identity.EntUserPhone != "" {
+					orderMap["user_phone"] = identity.EntUserPhone
+				}
+			}
+		}
+	}
 
 	//合同
 	contractData, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT * FROM  contract WHERE order_code =%s `, param.OrderCode))
@@ -390,7 +406,7 @@ WHERE eo.wait_empower_id = %s and jod.is_service_open =1 and jod.status =1 and d
 				gconv.String(depart.Map()["pid"]), gconv.String(depart.Map()["id"]),
 			}
 			department, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT edu.user_id  FROM entniche_department_user edu 
-INNER JOIN entniche_user_role eur on eur.role_id =2 and edu.user_id = eur.user_id
+INNER JOIN entniche_user_role eur on eur.role_id = 2 and edu.user_id = eur.user_id
 where edu.dept_id in (%s)`, strings.Join(ids, ",")))
 			if !department.IsEmpty() {
 				for _, m := range department.List() {