From 22130c7afe044c0752836e2216a542d605cbee4f Mon Sep 17 00:00:00 2001 From: zhoupengwei Date: Wed, 11 May 2022 18:19:30 +0800 Subject: [PATCH] =?UTF-8?q?vip=E5=BD=93=E6=97=A5=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AF=BC=E5=87=BAexcel=E7=9A=84sql=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=96=B0=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=9A=E7=94=A8=E6=88=B7=E5=85=B3=E8=81=94parentid=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=8C=E7=94=A8=E6=88=B7=E5=85=B3=E8=81=94salesmani?= =?UTF-8?q?d=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/app/vip_order.go | 13 ++++++++++++- example/app/wechath5.go | 6 ++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/example/app/vip_order.go b/example/app/vip_order.go index d04c16f..3e313e7 100644 --- a/example/app/vip_order.go +++ b/example/app/vip_order.go @@ -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购买信息数据") diff --git a/example/app/wechath5.go b/example/app/wechath5.go index f65bba1..31b4d8f 100644 --- a/example/app/wechath5.go +++ b/example/app/wechath5.go @@ -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 }