黄梓健
5 years ago
10 changed files with 124 additions and 24 deletions
-
25controllers/client/login.go
-
37controllers/client/sign.go
-
2go.mod
-
5log/hdzj.log
-
2models/customer.go
-
1models/init_models.go
-
37models/real_sign_list.go
-
25models/sign_up.go
-
12test/config_test.go
-
2utils/code/code.go
@ -0,0 +1,5 @@ |
|||
2020-03-09 12:12:48.883 ERROR logger/logger.go:92 check err {"error": "token invalid"} |
|||
2020-03-09 12:18:11.392 ERROR logger/logger.go:92 check err {"error": "token invalid"} |
|||
2020-03-09 12:19:33.431 ERROR logger/logger.go:92 check err {"error": "Error 1054: Unknown column 'user_id' in 'field list'", "errorVerbose": "Error 1054: Unknown column 'user_id' in 'field list'\nhudongzhuanjia/models.(*RealSignList).CheckSignIn\n\tE:/GoProject/src/hd/models/real_sign_list.go:27\nhudongzhuanjia/controllers/client.(*SignCtl).RealSign\n\tE:/GoProject/src/hd/controllers/client/sign.go:109\nreflect.Value.call\n\tE:/Go/src/reflect/value.go:460\nreflect.Value.Call\n\tE:/Go/src/reflect/value.go:321\ngithub.com/ouxuanserver/osmanthuswine/src/core.(*RouterManage).RouterSend\n\tE:/GoProject/pkg/mod/github.com/ouxuanserver/osmanthuswine@v0.0.0-20190916032555-480efadf4941/src/core/router.go:111\ngithub.com/ouxuanserver/osmanthuswine.RunProg.func1\n\tE:/GoProject/pkg/mod/github.com/ouxuanserver/osmanthuswine@v0.0.0-20190916032555-480efadf4941/osmanthuswine.go:112\nnet/http.HandlerFunc.ServeHTTP\n\tE:/Go/src/net/http/server.go:2007\ngithub.com/go-chi/chi.(*Mux).routeHTTP\n\tE:/GoProject/pkg/mod/github.com/go-chi/chi@v4.0.2+incompatible/mux.go:425\nnet/http.HandlerFunc.ServeHTTP\n\tE:/Go/src/net/http/server.go:2007\ngithub.com/go-chi/chi/middleware.Timeout.func1.1\n\tE:/GoProject/pkg/mod/github.com/go-chi/chi@v4.0.2+incompatible/middleware/timeout.go:45\nnet/http.HandlerFunc.ServeHTTP\n\tE:/Go/src/net/http/server.go:2007\ngithub.com/go-chi/chi/middleware.Recoverer.func1\n\tE:/GoProject/pkg/mod/github.com/go-chi/chi@v4.0.2+incompatible/middleware/recoverer.go:35\nnet/http.HandlerFunc.ServeHTTP\n\tE:/Go/src/net/http/server.go:2007\ngithub.com/go-chi/chi/middleware.RequestLogger.func1.1\n\tE:/GoProject/pkg/mod/github.com/go-chi/chi@v4.0.2+incompatible/middleware/logger.go:46\nnet/http.HandlerFunc.ServeHTTP\n\tE:/Go/src/net/http/server.go:2007\ngithub.com/go-chi/chi/middleware.RealIP.func1\n\tE:/GoProject/pkg/mod/github.com/go-chi/chi@v4.0.2+incompatible/middleware/realip.go:34\nnet/http.HandlerFunc.ServeHTTP\n\tE:/Go/src/net/http/server.go:2007\ngithub.com/go-chi/chi/middleware.RequestID.func1\n\tE:/GoProject/pkg/mod/github.com/go-chi/chi@v4.0.2+incompatible/middleware/request_id.go:72\nnet/http.HandlerFunc.ServeHTTP\n\tE:/Go/src/net/http/server.go:2007\ngithub.com/go-chi/chi.(*Mux).ServeHTTP\n\tE:/GoProject/pkg/mod/github.com/go-chi/chi@v4.0.2+incompatible/mux.go:82\nnet/http.serverHandler.ServeHTTP\n\tE:/Go/src/net/http/server.go:2802\nnet/http.(*conn).serve\n\tE:/Go/src/net/http/server.go:1890\nruntime.goexit\n\tE:/Go/src/runtime/asm_amd64.s:1357"} |
|||
2020-03-09 12:23:40.321 ERROR logger/logger.go:92 check err {"error": "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 '%json_list like %)' at line 1"} |
|||
2020-03-09 12:40:14.756 ERROR logger/logger.go:92 check err {"error": "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 %张三% )' at line 1"} |
@ -0,0 +1,37 @@ |
|||
package models |
|||
|
|||
import ( |
|||
"fmt" |
|||
"github.com/ouxuanserver/osmanthuswine/src/core" |
|||
"github.com/pkg/errors" |
|||
"time" |
|||
) |
|||
|
|||
const RealSignListTN = TableNamePrefix + "real_sign_list" |
|||
|
|||
type RealSignList struct { |
|||
Id int64 `json:"id"` |
|||
ActivityId int64 `json:"activity_id"` |
|||
JsonList string `json:"json_list"` |
|||
UserId int64 `json:"user_id"` |
|||
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` |
|||
CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` |
|||
UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新时间"` |
|||
} |
|||
|
|||
func (t *RealSignList) TableName() string { |
|||
return RealSignListTN |
|||
} |
|||
|
|||
func (t *RealSignList) CheckSignIn(uid int64, aid int64) (bool, error) { |
|||
exist, err := core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=?", uid, aid).Exist(t) |
|||
return exist, errors.WithStack(err) |
|||
} |
|||
|
|||
// 可能使用模糊匹配
|
|||
func (t *RealSignList) SignIn(uid, aid int64, ext string) (int64, error) { |
|||
t.UserId = uid |
|||
|
|||
var sql = fmt.Sprintf("is_delete=0 and user_id=0 and activity_id=%d %s", aid, ext) |
|||
return core.GetXormAuto().Where(sql).Cols("user_id").Update(t) |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue