prop.go
862 Bytes
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
package models
import (
"errors"
"fmt"
db "client/icesimba.mall/database"
)
type Prop struct {
Id string `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Icon string `json:"icon"`
Desc string `json:"icon"`
CreateTime string `json:"create_time"`
GameId string `json:"game_id"`
}
func (in *Prop) QueryProp() (code int, out Prop, err error) {
if in.Id == "" {
code = 400
err = errors.New("参数错误")
return
}
fmt.Printf("select * from ice_prop where id=%s\n", in.Id)
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("ice_prop查询数据失败")
code = 400
return
}
code = 200
return
}