prop.go
1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package models
import (
"errors"
db "client/icesimba.mail/database"
)
type Prop struct {
Id string
Code string
Name string
Icon string
Desc string
CreateTime string
GameId string
}
func (in *Prop) QueryProp() (out Prop, err error) {
if in.Id == "" {
err = errors.New("参数错误")
return
}
sqlQue := "select * from ice_prop where id=?"
row := db.SqlDB.QueryRow(sqlQue, in.Id)
err = row.Scan(
&out.Id,
&out.Name,
&out.GameId,
&out.Icon,
&out.Desc,
&out.CreateTime,
&out.GameId,
)
if err != nil {
err = errors.New("查询数据失败")
return
}
return
}
func (in *Prop) InsertGift() (code int, out Prop, err error) {
// sqlIn := "insert into ice_gift(gname,gid,gico,description,discount,price,createtime) VALUES (?, ?, ?, ?, ?, ?, ?)"
// _, err = db.SqlDB.Exec(
// sqlIn,
// in.Name,
// in.GameId,
// in.Icon,
// in.Desc,
// in.Discount,
// in.Price,
// in.CreateTime,
// )
// if err != nil {
// err = errors.New("插入数据失败")
// code = 400
// return
// }
// code = 200
return
}