Commit 04352d23 authored by haoyanbin's avatar haoyanbin

1

parent 20d48647
......@@ -31,28 +31,41 @@ func GetCustomerUserList(c *gin.Context) {
}
func ExportMsgExcel(c *gin.Context) {
var req request.GetCustomerUserListReq
_ = c.ShouldBindQuery(&req)
reqData := request.GetCustomerUserListReq{}
_ = c.ShouldBindQuery(&reqData)
reqData.MocId = 1
fileName := "用户短链列表" + time.Now().Format("20060102")
//region := []string{"广东", "福建", "江西", "安徽", "广西", "新疆", "天津", "山西", "贵州", "吉林", "北京", "上海", "黑龙江"}
regionIn := "'广东','福建','江西','安徽','广西','新疆','天津','山西','贵州','吉林','北京','上海','黑龙江'"
f := excelize.NewFile()
codeList := service.GetVcodeList(reqData.MocId)
//for _, v := range region {
req := request.GetCustomerUserListReq{}
req.RegionIn = regionIn
//req.UserType = 2
req.PageSize = 99999
_, list, _ := service.GetCustomerUserList(req)
codeList := service.GetVcodeList(req.MocId)
fileName := "用户短链列表" + time.Now().Format("20060102")
f := excelize.NewFile()
sheetName := "用户短链列表"
// Create a new sheet.
index := f.NewSheet(fileName)
index := f.NewSheet(sheetName)
f.SetCellValue(fileName, "A1", "用户ID")
f.SetCellValue(fileName, "B1", "用户名称")
f.SetCellValue(fileName, "C1", "省")
f.SetCellValue(fileName, "D1", "市")
f.SetCellValue(fileName, "E1", "区")
f.SetCellValue(fileName, "F1", "工作人员")
f.SetCellValue(fileName, "G1", "工作人员电话")
f.SetCellValue(fileName, "H1", "短链")
f.SetCellValue(sheetName, "A1", "用户ID")
f.SetCellValue(sheetName, "B1", "用户名称")
f.SetCellValue(sheetName, "C1", "省")
f.SetCellValue(sheetName, "D1", "市")
f.SetCellValue(sheetName, "E1", "区")
f.SetCellValue(sheetName, "F1", "工作人员")
f.SetCellValue(sheetName, "G1", "工作人员电话")
f.SetCellValue(sheetName, "H1", "是否识别")
f.SetCellValue(sheetName, "I1", "短链")
for k, v := range list {
url := ""
......@@ -63,19 +76,27 @@ func ExportMsgExcel(c *gin.Context) {
url = global.GVA_CONFIG.Common.Url + "/" + service.GetVcode(v.Id, req.MocId)
}
userType := "未识别"
if v.UserType == 1 {
userType = "已识别"
}
a := strconv.Itoa(k + 2)
f.SetCellValue(fileName, "A"+a, v.Id)
f.SetCellValue(fileName, "B"+a, v.UserName)
f.SetCellValue(fileName, "C"+a, v.Region)
f.SetCellValue(fileName, "D"+a, v.City)
f.SetCellValue(fileName, "E"+a, v.Zone)
f.SetCellValue(fileName, "F"+a, v.WorkerName)
f.SetCellValue(fileName, "G"+a, v.WorkerMobile)
f.SetCellValue(fileName, "H"+a, url)
f.SetCellValue(sheetName, "A"+a, v.Id)
f.SetCellValue(sheetName, "B"+a, v.UserName)
f.SetCellValue(sheetName, "C"+a, v.Region)
f.SetCellValue(sheetName, "D"+a, v.City)
f.SetCellValue(sheetName, "E"+a, v.Zone)
f.SetCellValue(sheetName, "F"+a, v.WorkerName)
f.SetCellValue(sheetName, "G"+a, v.WorkerMobile)
f.SetCellValue(sheetName, "H"+a, userType)
f.SetCellValue(sheetName, "I"+a, url)
}
// Set active sheet of the workbook.
f.SetActiveSheet(index)
//}
// Save xlsx file by the given path.
if err := f.SaveAs("./" + fileName + ".csv"); err != nil {
fmt.Println(err)
......@@ -87,3 +108,7 @@ func ExportMsgExcel(c *gin.Context) {
c.File("./" + fileName + ".csv")
return
}
func msgExcel(req request.GetCustomerUserListReq) {
}
......@@ -116,7 +116,7 @@ encrypt:
key: "75SIQyfvwHDU0GbO"
common:
type: "2"
url: "https://tdt.pet-dbc.cn"
url: "dt.pet-dbc.cn"
sms:
smsname: "dbc"
......
......@@ -5,6 +5,7 @@ type GetCustomerUserListReq struct {
MocId int `gorm:"type:int(255)" json:"moc_id"`
UserName string `gorm:"type:string(255)" json:"user_name"`
Region string `gorm:"type:string(255)" json:"region"`
RegionIn string `gorm:"type:string(255)" json:"region_in"`
City string `gorm:"type:string(255)" json:"city"`
Zone string `gorm:"type:string(255)" json:"zone"`
Address string `gorm:"type:string(255)" json:"address"`
......
......@@ -116,7 +116,7 @@ encrypt:
key: "75SIQyfvwHDU0GbO"
common:
type: "2"
url: "https://dt.pet-dbc.cn/"
url: "dt.pet-dbc.cn"
sms:
smsname: "dbc"
......
......@@ -29,10 +29,18 @@ func GetCustomerUserList(req request.GetCustomerUserListReq) (error, []request.G
orderby := " id asc "
if req.UserType != 0 {
conditions += " AND user_type = " + strconv.Itoa(req.UserType)
}
if req.UserName != "" {
conditions += " AND user_name like '%" + req.UserName + "%'"
}
if req.RegionIn != "" {
conditions += " AND region in (" + req.RegionIn + ")"
}
if req.Region != "" {
conditions += " AND region like '%" + req.Region + "%'"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment