|
@@ -4,6 +4,7 @@ import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"reflect"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
"youngee_b_api/model/common_model"
|
|
@@ -14,6 +15,7 @@ import (
|
|
|
|
|
|
"github.com/issue9/conv"
|
|
|
"github.com/sirupsen/logrus"
|
|
|
+ "github.com/tidwall/gjson"
|
|
|
)
|
|
|
|
|
|
//新增
|
|
@@ -129,6 +131,9 @@ func GetTaskLogisticsList(ctx context.Context, projectID string, pageSize, pageN
|
|
|
TaskLogistics := new(http_model.TaskLogistics)
|
|
|
TaskLogistics.Talent = taskMap[taskId]
|
|
|
TaskLogistics.Logistics = logisticsMap[taskId]
|
|
|
+ TalentPostAddrSnap := TaskLogistics.Talent.TalentPostAddrSnap
|
|
|
+ regionCode, _ := strconv.Atoi(conv.MustString(gjson.Get(TalentPostAddrSnap, "region_code")))
|
|
|
+ TaskLogistics.Region = GetRegion(ctx, regionCode)
|
|
|
TaskLogisticss = append(TaskLogisticss, TaskLogistics)
|
|
|
}
|
|
|
|
|
@@ -158,3 +163,19 @@ func ChangeLogisticsStatus(ctx context.Context, taskIds []string) error {
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+func GetRegion(ctx context.Context, regionCode int) string {
|
|
|
+ db4 := GetReadDB(ctx)
|
|
|
+ var infoRegion *gorm_model.InfoRegion
|
|
|
+ fmt.Printf("regionCode: %+v", regionCode)
|
|
|
+ db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", regionCode).First(&infoRegion)
|
|
|
+
|
|
|
+ provinceCode := conv.MustString(regionCode, "")[0:2] + "0000"
|
|
|
+ var province *gorm_model.InfoRegion
|
|
|
+ db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(provinceCode, 0)).First(&province)
|
|
|
+
|
|
|
+ cityCode := conv.MustString(regionCode, "")[0:4] + "00"
|
|
|
+ var city *gorm_model.InfoRegion
|
|
|
+ db4.Debug().Model(gorm_model.InfoRegion{}).Where("self_code = ?", conv.MustInt(cityCode, 0)).First(&city)
|
|
|
+ return province.RegionName + city.RegionName + infoRegion.RegionName
|
|
|
+}
|