From a207ab7036d205fb2a020df3c53ce82ec34516dd Mon Sep 17 00:00:00 2001 From: tommy <3405129587@qq.com> Date: Fri, 5 Jun 2020 11:30:40 +0800 Subject: [PATCH] feat: real sign --- controllers/client/sign.go | 10 ++++++---- log/hdzj.log | 2 ++ models/real_sign_list.go | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/controllers/client/sign.go b/controllers/client/sign.go index 86c2d13..3953325 100644 --- a/controllers/client/sign.go +++ b/controllers/client/sign.go @@ -201,11 +201,13 @@ func (t *SignCtl) RealSign() { continue } name, _ := m["name"].(string) + val, _ := m["val"].(string) if value, ok := t.Get(name); ok { - params[name] = value - extSql += "and json_list like \"%" + value + "%\" " + params[val] = value + //extSql += " json_list like '%\"" + val + "\"" + ":" + "\"" + value + "\"%' and " + extSql += " json_list like '%" + value + "%' and " } else { - t.ERROR(fmt.Sprintf("%v不能为空", m["val"]), code.MSG_ERR_Param) + t.ERROR(fmt.Sprintf("%s不能为空", val), code.MSG_ERR_Param) } } if len(extSql) == 0 || len(params) == 0 { @@ -215,10 +217,10 @@ func (t *SignCtl) RealSign() { exist, err = new(models.RealSignList).CheckSignIn(activityId, extSql) t.CheckErr(err) + var body []byte body, err = json.Marshal(params) t.CheckErr(err) - history.SignRuleId = sign.Id history.SignMethod = 2 history.ActivityId = activityId diff --git a/log/hdzj.log b/log/hdzj.log index 7e69cef..2047111 100644 --- a/log/hdzj.log +++ b/log/hdzj.log @@ -472,3 +472,5 @@ 2020-06-04 19:56:25.166 ERROR utils/utils.go:155 定时任务错误原因欧轩互动打赏过期退款错误: FAILORDERNOTEXIST订单不存在, out_trade_no: FWH6rL0SZcDY5ensh9ge5iFXGlA7bsOw 2020-06-04 20:26:26.117 ERROR utils/utils.go:155 定时任务错误原因欧轩互动打赏过期退款错误: FAILORDERNOTEXIST订单不存在, out_trade_no: FWH6rL0SZcDY5ensh9ge5iFXGlA7bsOw 2020-06-05 09:27:30.973 ERROR utils/utils.go:155 定时任务错误原因获取过期打赏错误原因: dial tcp: lookup gz-cdb-onvbcfqn.sql.tencentcdb.com: no such host +2020-06-05 11:08:49.589 ERROR controllers/base.go:209 check err{error 25 0 Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?) LIMIT 1' at line 1} +2020-06-05 11:11:26.187 ERROR controllers/base.go:209 check err{error 25 0 Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%"姓名":"张三"% and json_list like %"电话":"17688484884"% and json_list ' at line 1} diff --git a/models/real_sign_list.go b/models/real_sign_list.go index e370ce7..1302c59 100644 --- a/models/real_sign_list.go +++ b/models/real_sign_list.go @@ -1,7 +1,6 @@ package models import ( - "fmt" "github.com/ouxuanserver/osmanthuswine/src/core" "time" ) @@ -24,6 +23,7 @@ func (t *RealSignList) TableName() string { // 可能使用模糊匹配 func (t *RealSignList) CheckSignIn(aid int64, ext string) (bool, error) { - var sql = fmt.Sprintf("is_delete=0 and activity_id=%d %s", aid, ext) - return core.GetXormAuto().Where(sql).Get(t) + //var sql = fmt.Sprintf("is_delete=0 and activity_id=%d and ", aid, ext) + ext += " 1 = 1 " + return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Where(ext).Get(t) }