vip当日购买信息导出excel的sql调整,添加新字段:用户关联parentid时间,用户关联salesmanid时间

This commit is contained in:
zhoupengwei 2022-05-11 18:19:30 +08:00
parent d85c65faef
commit 22130c7afe
2 changed files with 16 additions and 3 deletions

View File

@ -169,7 +169,18 @@ var VipOrderCtr = Ctr{
return
}
data := that.Db.Query("SELECT vo.sn 订单号, vo.`name` 订单名, vo.user_id 购买用户ID,usr.`name` 购买用户名, usr.phone 购买用户电话, cp.id 企业ID, cp.`name` 企业名,\nvo.expiration_time 过期时间, vo.old_expiration_time 订购前到期时间, vo.amount `订单金额_单位(分)`,\nvo.salesman_id 业务员ID,sm.`name` 业务员名, sm.phone 业务员电话, pv.`name` 服务商名 \nFROM vip_order vo\nLEFT JOIN salesman sm ON sm.id = vo.salesman_id\nLEFT JOIN provider pv ON pv.id = vo.provider_id\nLEFT JOIN `user` usr ON usr.id = vo.user_id\nLEFT JOIN company cp ON cp.id = vo.company_id\nWHERE vo.`status` = 1 AND vo.create_time >= '" + buy_date + "' \nORDER BY vo.create_time")
//data := that.Db.Query("SELECT vo.sn 订单号, vo.`name` 订单名, vo.user_id 购买用户ID,usr.`name` 购买用户名, usr.phone 购买用户电话, cp.id 企业ID, cp.`name` 企业名,\nvo.expiration_time 过期时间, vo.old_expiration_time 订购前到期时间, vo.amount `订单金额_单位(分)`,\nvo.salesman_id 业务员ID,sm.`name` 业务员名, sm.phone 业务员电话, pv.`name` 服务商名 \nFROM vip_order vo\nLEFT JOIN salesman sm ON sm.id = vo.salesman_id\nLEFT JOIN provider pv ON pv.id = vo.provider_id\nLEFT JOIN `user` usr ON usr.id = vo.user_id\nLEFT JOIN company cp ON cp.id = vo.company_id\nWHERE vo.`status` = 1 AND vo.create_time >= '" + buy_date + "' \nORDER BY vo.create_time")
//data := that.Db.Query("SELECT vo.sn 订单号, vo.`name` 订单名, vo.user_id 购买用户ID,usr.`name` 购买用户名, usr.phone 购买用户电话, cp.id 企业ID, cp.`name` 企业名,\nvo.expiration_time 过期时间, vo.old_expiration_time 订购前到期时间, vo.amount `订单金额_单位(分)`,\nvo.salesman_id 业务员ID,sm.`name` 业务员名, sm.phone 业务员电话, pv.`name` 服务商名 \nFROM vip_order vo\n" +
// "LEFT JOIN salesman sm ON sm.id = vo.salesman_id\nLEFT JOIN provider pv ON pv.id = vo.provider_id\nLEFT JOIN `user` usr" +
// " ON usr.id = vo.user_id\nLEFT JOIN company cp ON cp.id = vo.company_id\nWHERE" +
// " vo.`status` = 1 AND vo.create_time >= ? \nORDER BY vo.create_time",buy_date)
data := that.Db.Select("vip_order", Map{"[>]salesman": "salesman.id=vip_order.id",
"[>]provider": "provider.id = vip_order.provider_id",
"[>]user": "user.id = vip_order.user_id",
"[>]company": "company.id = vip_order.company_id",
}, "vip_order.sn 订单号, vip_order.`name` 订单名, vip_order.user_id 购买用户ID,user.`name` 购买用户名, user.phone 购买用户电话, company.id 企业ID, company.`name` 企业名,\nvip_order.expiration_time 过期时间, vip_order.old_expiration_time 订购前到期时间, vip_order.amount `订单金额_单位(分)`,\nvip_order.salesman_id 业务员ID,salesman.`name` 业务员名, salesman.phone 业务员电话, provider.`name` 服务商名",
Map{"AND": Map{"vip_order.status": 1, "vip_order.create_time[>=]": buy_date}, "ORDER": "vip_order.create_time DESC"})
if len(data) == 0 {
that.Display(0, "今日没有vip购买信息数据")

View File

@ -61,7 +61,8 @@ var Wechath5 = Ctr{
index1 = index1 + ObjToStr(parentId) + ","
}
that.Db.Update("user", Map{"parent_id": parentId, "index": index1 + ObjToStr(userId) + ","}, Map{"id": userId})
//2022/5/11 zpw 添加字段用户关联parenid的时间 join_parent_time
that.Db.Update("user", Map{"parent_id": parentId, "index": index1 + ObjToStr(userId) + ",", "join_parent_time[#]": "NOW()"}, Map{"id": userId})
}()
//最后验证服务商是否绑定
@ -91,7 +92,8 @@ var Wechath5 = Ctr{
return
}
//用户没有企服商id
that.Db.Update("user", Map{"salesman_id": salesman.GetCeilInt64("id"), "provider_id": salesman.GetCeilInt64("provider_id")}, Map{"id": user.GetCeilInt64("id")})
//2022/5/11 zpw 添加字段:用户关联企服商业务人员的时间 join_salesman_time
that.Db.Update("user", Map{"salesman_id": salesman.GetCeilInt64("id"), "provider_id": salesman.GetCeilInt64("provider_id"), "join_salesman_time[#]": "NOW()"}, Map{"id": user.GetCeilInt64("id")})
if user.GetCeilInt("company_id") == 0 {
return
}