|
@@ -62,36 +62,36 @@ func init() {
|
|
|
}
|
|
|
|
|
|
//一次性任务积分
|
|
|
-func InCreditA(userId, code string, credit_a int) (bool, int, error) {
|
|
|
+func InCreditA(userId, code string, credit_a int) (bool, int, int, error) {
|
|
|
result := false
|
|
|
if len(userId) < 1 {
|
|
|
- return result, credit_a, nil
|
|
|
+ return result, credit_a, 0, nil
|
|
|
}
|
|
|
- var Replay *int
|
|
|
+ var Replay int
|
|
|
if !AIsHasDo(code, credit_a) {
|
|
|
param := make(map[string]interface{})
|
|
|
- err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, Replay)
|
|
|
- if err == nil && *Replay == 1 {
|
|
|
+ err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, &Replay)
|
|
|
+ if err == nil && Replay > 0 {
|
|
|
result, credit_a = UpuserCreditA(code, userId, credit_a)
|
|
|
}
|
|
|
- return result, credit_a, err
|
|
|
+ return result, credit_a, Replay, err
|
|
|
}
|
|
|
- return result, credit_a, nil
|
|
|
+ return result, credit_a, 0, nil
|
|
|
}
|
|
|
|
|
|
//日常任务积分
|
|
|
-func InCreditB(userId, code string) (bool, error) {
|
|
|
+func InCreditB(userId, code string) (bool, int, error) {
|
|
|
b := false
|
|
|
if len(userId) < 1 {
|
|
|
- return b, nil
|
|
|
+ return b, 0, nil
|
|
|
}
|
|
|
- var Replay *int
|
|
|
+ var Replay int
|
|
|
param := make(map[string]interface{})
|
|
|
- err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, Replay)
|
|
|
- if err == nil && *Replay == 1 {
|
|
|
+ err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, &Replay)
|
|
|
+ if err == nil && Replay > 0 {
|
|
|
b = true
|
|
|
}
|
|
|
- return b, err
|
|
|
+ return b, Replay, err
|
|
|
}
|
|
|
|
|
|
//更新用户一次性积分状态
|
|
@@ -119,13 +119,12 @@ func AIsHasDo(code string, num int) bool {
|
|
|
}
|
|
|
|
|
|
//扣积分
|
|
|
-func OutCreditB(userId, code string, score int, param map[string]interface{}) (b bool) {
|
|
|
+func OutCreditB(userId, code string, score int, param map[string]interface{}) (b bool, Replay int) {
|
|
|
if len(userId) < 5 {
|
|
|
return
|
|
|
}
|
|
|
- var Replay *int
|
|
|
- err := Rc.OutCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: score, OtherParam: param}, Replay)
|
|
|
- if err == nil && *Replay == 1 {
|
|
|
+ err := Rc.OutCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: score, OtherParam: param}, &Replay)
|
|
|
+ if err == nil && Replay > 0 {
|
|
|
b = true
|
|
|
}
|
|
|
return
|