@@ -356,3 +356,10 @@ func InterfaceArrTointArr(arr []interface{}) []int {
}
return tmp
+func InterfaceArrToint64Arr(arr []interface{}) []int64 {
+ tmp := make([]int64, 0)
+ for _, v := range arr {
+ tmp = append(tmp, int64(v.(float64)))
+ }
+ return tmp
+}
@@ -107,7 +107,8 @@ func InCreditB(userId, code string, param map[string]interface{}) (bool, int, er
err := Rc.InCreadit(&rpc.CreditData{Code: code, Uid: userId, Num: 0, OtherParam: param}, &Replay)
if err == nil && Replay != 0 {
b = true
- } else {
+ if err != nil {
log.Println("调用rpc出错", err)
return b, Replay, err
@@ -105,7 +105,7 @@ func (c *credit) InCreditAjx() error {
if param == "qd" {
- b := cd.UpuserCreditSession(userId, cd.B_QD, "A", nil, c.Action)
+ b := cd.UpuserCreditSession(userId, cd.B_QD, "B", nil, c.Action)
if b {
c.Session().UpdateByCustomField("id", userId, "credit_qd", "y")
result["result"] = "y"
@@ -104,7 +104,7 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
obj := redis.Get(consts.RedisDB, key)
bcon := true
if obj != nil {
- newobj := obj.([]int64)
+ newobj := util.InterfaceArrToint64Arr(obj.([]interface{}))
//比较日期是不是连续签到,并且在有效次数内
if newobj[1] < newobj[2] && time.Unix(newobj[0], 0).AddDate(0, 0, 1).Day() == now.Day() {
newobj[0] = now.Unix()