|
@@ -12,6 +12,7 @@ import (
|
|
|
"net/http"
|
|
|
url2 "net/url"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -61,21 +62,24 @@ func (BP *JyActivity) GetLottery(userId, userName, lotteryIds string) error {
|
|
|
if code != 1 {
|
|
|
return fmt.Errorf("领取优惠券异常%s", msg)
|
|
|
}
|
|
|
-
|
|
|
//存入奖励列表
|
|
|
var awardList []map[string]interface{}
|
|
|
nowStamp := time.Now().Unix()
|
|
|
list, _ := activityLotteryRequest(userId, "0")
|
|
|
for _, v := range list.Data {
|
|
|
- awardList = append(awardList, map[string]interface{}{
|
|
|
- "activity_code": BP.ActivityCode,
|
|
|
- "detail": v.LotteryName,
|
|
|
- "userid": userId,
|
|
|
- "award": "lottery-fullReduce", //满减券
|
|
|
- "num": v.Reduce,
|
|
|
- "getway": "福利一",
|
|
|
- "date": nowStamp,
|
|
|
- })
|
|
|
+ for _, v1 := range strings.Split(lotteryIds, ",") {
|
|
|
+ if v.LotteryIdStr == v1 {
|
|
|
+ awardList = append(awardList, map[string]interface{}{
|
|
|
+ "activity_code": BP.ActivityCode,
|
|
|
+ "detail": v.LotteryName,
|
|
|
+ "userid": userId,
|
|
|
+ "award": "lottery-fullReduce", //满减券
|
|
|
+ "num": v.Reduce,
|
|
|
+ "getway": "福利一",
|
|
|
+ "date": nowStamp,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if len(awardList) > 0 {
|
|
|
db.Mgo.SaveBulk("activity_award", awardList...)
|