package service

import (
	"blazing/cool"
	"blazing/modules/blazing/model"
	"encoding/json"
)

func (s *UserService) ItemExec(t func([]model.ItemE) []model.ItemE) {
	//todo待测试
	var player model.Item
	m1 := cool.DBM(s.reg.Model).Where("player_id", s.userid)
	m1.Scan(&player)
	var tt []model.ItemE
	json.Unmarshal([]byte(player.Data), &tt)
	t(tt)
	tmep, _ := json.Marshal(tt)
	player.Data = string(tmep)
	m1.Save(player)

}
