예제 #1
0
func setPhotosHandler(request *http.Request, resp http.ResponseWriter, redis *models.RedisLogger,
	user *models.Account, p Parameter) {
	form := p.(setPhotosForm)

	awards := Awards{}
	if !user.PhotoSet {
		awards.Wealth = 10 * int64(len(form.Pics)) * models.Satoshi
		awards.Score = 10 * int64(len(form.Pics))
	}
	err := user.AddPhotos(form.Pics)
	GiveAwards(user, awards, redis)
	writeResponse(request.RequestURI, resp, map[string]interface{}{"ExpEffect": awards}, err)
}