prop.go 862 Bytes
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
}