22 lines
442 B
Go
22 lines
442 B
Go
package service
|
|
|
|
import (
|
|
"yitao/ecode"
|
|
"yitao/model"
|
|
)
|
|
|
|
type ItemService struct{}
|
|
|
|
func (s *ItemService) CreateItem(itemname string, desc string, types []int, img string, price int) (item *model.ItemModel, e *ecode.Ecode) {
|
|
item = new(model.ItemModel)
|
|
e = ecode.OK()
|
|
item.Itemname = itemname
|
|
item.Desc = desc
|
|
item.Types = types
|
|
item.Img = img
|
|
item.Price = price
|
|
item.States = model.ItemStateOnSale
|
|
model.DB.Create(item)
|
|
return
|
|
}
|