互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
971 B

package client
import (
"hudongzhuanjia/controllers"
"hudongzhuanjia/models"
"hudongzhuanjia/utils/code"
)
type GoodCtl struct {
controllers.AuthorCtl
}
// 商品列表
func (t *GoodCtl) List() {
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt64("area_id")
goods, err := models.GetGoodsByActivityId(activityId, areaId)
t.CheckErr(err)
t.JSON(goods)
}
// 下订单
func (t *GoodCtl) Order() {
name := t.MustGet("name") // 收货人名字
phone := t.MustGet("phone") // 收货电话
address := t.MustGet("address") // 收货地址
goodId := t.MustGetInt64("good_id") // 商品id
num := t.MustGetInt("num") // 商品数量
_type := t.MustGetInt("delivery") // 配送: 1 快递免邮 2 快递 xxx 3 自提 4 到付
fee, exist := t.GetDouble("fee") // 快递费用
if _type == 2 && !exist || fee == 0 {
t.ERROR("fee参数错误", code.MSG_ERR_Param)
return
}
order := models.CustomerOrder{}
}