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.
40 lines
1.4 KiB
40 lines
1.4 KiB
package call |
|
|
|
import ( |
|
"fmt" |
|
"server/common" |
|
"server/db" |
|
"time" |
|
) |
|
|
|
func GetUserItem(uid, itemID int) []*common.PlayerItems { |
|
list := []*common.PlayerItems{} |
|
db.Mysql().QueryAll(fmt.Sprintf("uid = %d and item_id = %d", uid, itemID), "", &common.PlayerItems{}, &list) |
|
return list |
|
} |
|
|
|
func GetUserValidItems(uid, itemID int) []*common.PlayerItems { |
|
list := []*common.PlayerItems{} |
|
db.Mysql().QueryAll(fmt.Sprintf("uid = %d and item_id = %d and status = %d", uid, itemID, common.ItemStatusNormal), "", &common.PlayerItems{}, &list) |
|
return list |
|
} |
|
|
|
func GetUserItemByExi1(uid, itemID, exi1 int) []*common.PlayerItems { |
|
list := []*common.PlayerItems{} |
|
db.Mysql().QueryAll(fmt.Sprintf("uid = %d and item_id = %d and exi1 = %d and status = %d", uid, itemID, exi1, common.ItemStatusNormal), "", &common.PlayerItems{}, &list) |
|
return list |
|
} |
|
|
|
// 获取力度最大的折扣券 |
|
func GetUserBestDiscountTicket(uid int) *common.PlayerItems { |
|
list := []*common.PlayerItems{} |
|
db.Mysql().QueryAll(fmt.Sprintf("uid = %d and item_id = %d and status = %d", uid, common.ItemDiscountTicket, common.ItemStatusNormal), "exi1 desc", &common.PlayerItems{}, &list) |
|
if len(list) > 0 { |
|
return list[0] |
|
} |
|
return nil |
|
} |
|
|
|
func AddUserDiscountTicket(uid int, exi1, exi2 int64) { |
|
db.Mysql().Create(&common.PlayerItems{UID: uid, ItemID: common.ItemDiscountTicket, Time: time.Now().Unix(), Status: common.ItemStatusNormal, Exi1: exi1, Exi2: exi2}) |
|
}
|
|
|