|
@@ -15,21 +15,26 @@ func GiveDoc(userId string, data map[string]interface{}) {
|
|
welfareType = common.IntAll(data["welfareType"])
|
|
welfareType = common.IntAll(data["welfareType"])
|
|
welfareContent = common.ObjToString(data["welfareContent"])
|
|
welfareContent = common.ObjToString(data["welfareContent"])
|
|
}
|
|
}
|
|
- if welfareType != 0 || len(welfareContent) == 0 {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- //查询文档所需积分
|
|
|
|
- docIds := strings.Split(welfareContent, ",")
|
|
|
|
- for i := 0; i < len(docIds); i++ {
|
|
|
|
- _, isBuy, _, err := rpc.GetDocDetail(userId, docIds[i])
|
|
|
|
- if isBuy {
|
|
|
|
- continue
|
|
|
|
|
|
+ switch welfareType {
|
|
|
|
+ case 0:
|
|
|
|
+ if len(welfareContent) == 0 {
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- //转存文库
|
|
|
|
- err = rpc.PayDoc(userId, docIds[i])
|
|
|
|
- if err != nil {
|
|
|
|
- log.Println("文库保存失败", userId, docIds[i])
|
|
|
|
|
|
+ //查询文档所需积分
|
|
|
|
+ docIds := strings.Split(welfareContent, ",")
|
|
|
|
+ for i := 0; i < len(docIds); i++ {
|
|
|
|
+ _, isBuy, _, err := rpc.GetDocDetail(userId, docIds[i])
|
|
|
|
+ if isBuy {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ //转存文库
|
|
|
|
+ err = rpc.PayDoc(userId, docIds[i])
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("文库保存失败", userId, docIds[i])
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ default:
|
|
|
|
+ log.Println("未知 展会活动奖励:", welfareType)
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|