You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
package dao |
|
|
|
import ( |
|
"context" |
|
|
|
"go-common/app/job/main/vip/model" |
|
"go-common/library/database/sql" |
|
|
|
"github.com/pkg/errors" |
|
) |
|
|
|
const ( |
|
_notGrantActOrder = "SELECT id,mid,order_no,product_id,months,panel_type,associate_state,ctime,mtime FROM vip_order_activity_record WHERE associate_state = 0 AND panel_type = ? limit ?;" |
|
) |
|
|
|
// NotGrantActOrders not grant activity order. |
|
func (d *Dao) NotGrantActOrders(c context.Context, panelType string, limit int) (res []*model.VipOrderActivityRecord, err error) { |
|
var rows *sql.Rows |
|
if rows, err = d.oldDb.Query(c, _notGrantActOrder, panelType, limit); err != nil { |
|
err = errors.Wrapf(err, "dao associate not grants query (%s,%d)", panelType, limit) |
|
return |
|
} |
|
defer rows.Close() |
|
for rows.Next() { |
|
r := new(model.VipOrderActivityRecord) |
|
if err = rows.Scan(&r.ID, &r.Mid, &r.OrderNo, &r.ProductID, &r.Months, &r.PanelType, &r.AssociateState, &r.Ctime, &r.Mtime); err != nil { |
|
err = errors.Wrapf(err, "dao associate not grants scan (%s,%d)", panelType, limit) |
|
res = nil |
|
return |
|
} |
|
res = append(res, r) |
|
} |
|
err = rows.Err() |
|
return |
|
}
|
|
|