wangchuanjin 1 жил өмнө
parent
commit
c97fe7b67f
1 өөрчлөгдсөн 4 нэмэгдсэн , 3 устгасан
  1. 4 3
      service/service.go

+ 4 - 3
service/service.go

@@ -154,9 +154,10 @@ func UsePersonList(this *entmanageapplication.UsePersonListReq) *entmanageapplic
 
 func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageapplication.BuyProductListResp {
 	nowTime := time.Now().Format("2006-01-02 15:04:05")
-	data := JyMysql.SelectBySql(`select a.id,sum(1) as use_count,a.empower_count,a.province_count,a.end_time,a.product_type from `+EntnicheWaitEmpower+` a 
-		inner join `+EntnichePower+` b on (a.ent_id=? and a.end_time>=? and a.id=b.wait_empower_id and b.status=1)
-		group by a.id order by a.create_time desc`, this.EntId, nowTime)
+	data := JyMysql.SelectBySql(`SELECT a.id,SUM(IF(c.id IS NULL || b.status IS NULL || b.status<0,0,1)) AS use_count,a.empower_count,a.province_count,a.end_time,a.product_type FROM entniche_wait_empower a 
+                LEFT JOIN entniche_power b ON (a.ent_id=? AND a.end_time>=? AND a.id=b.wait_empower_id AND b.status=1)
+                LEFT JOIN entniche_user c ON (b.ent_user_id=c.id)
+                WHERE a.ent_id=? GROUP BY a.id ORDER BY a.create_time DESC`, this.EntId, nowTime, this.EntId)
 	arr := []*entmanageapplication.BuyProductList{}
 	if data != nil && len(*data) > 0 {
 		for _, v := range *data {