示例#1
0
文件: member.go 项目: honj51/go2o
func (this *Member) GetDeliverAddrs(m *jsv.Args, r *jsv.Result) error {
	memberId, err := Verify(m)
	if err != nil {
		return err
	}
	r.Result = true
	r.Data = dps.MemberService.GetDeliverAddrs(memberId)
	return nil
}
示例#2
0
func (this *Partner) CheckUsrExist(m *jsv.Args, r *jsv.Result) error {
	_, err, _ := VerifyPartner(m)
	if err != nil {
		return err
	}
	r.Result = true
	r.Data = dps.MemberService.CheckUsr((*m)["usr"].(string), 0)
	return nil
}
示例#3
0
func (this *Partner) GetHost(m *jsv.Args, r *jsv.Result) error {
	partnerId, err := strconv.Atoi((*m)["partner_id"].(string))
	if err != nil {
		return err
	}
	host := dps.PartnerService.GetPartnerMajorHost(partnerId)
	r.Data = host
	r.Result = true
	return nil
}
示例#4
0
func (this *Partner) GetPartner(m *jsv.Args, r *jsv.Result) error {
	return nil
	_, err, e := VerifyPartner(m)
	if err != nil {
		return err
	}
	r.Result = true
	r.Data = e
	return nil
}
示例#5
0
func (this *Partner) Category(m *jsv.Args, r *jsv.Result) error {
	partnerId, err, _ := VerifyPartner(m)
	if err != nil {
		return err
	}

	categories := dps.SaleService.GetCategories(partnerId)
	r.Result = true
	r.Data = categories
	return nil
}
示例#6
0
func (this *Partner) GetSiteConf(m *jsv.Args, r *jsv.Result) error {
	partnerId, err, _ := VerifyPartner(m)
	if err != nil {
		return err
	}

	siteConf := dps.PartnerService.GetSiteConf(partnerId)
	r.Result = true
	r.Data = siteConf
	return nil
}
示例#7
0
文件: partner.go 项目: xianmau/go2o
func (this *Partner) BuildOrder(m *jsv.Args, r *jsv.Result) error {
	partnerId, err, _ := VerifyPartner(m)
	if err != nil {
		return err
	}

	memberId, err := strconv.Atoi((*m)["member_id"].(string))
	couponCode := (*m)["coupon_code"].(string)
	if err != nil {
		return err
	}

	order, _, err := dps.ShoppingService.BuildOrder(partnerId, memberId, "", couponCode)
	if err != nil {
		return err
	}

	v := order.GetValue()
	buf := bytes.NewBufferString("")

	for _, v := range order.GetCoupons() {
		buf.WriteString(v.GetDescribe())
		buf.WriteString("\n")
	}

	var data map[string]interface{}
	data = make(map[string]interface{})
	if couponCode != "" {
		if v.CouponFee == 0 {
			data["result"] = v.CouponFee != 0
			data["message"] = "优惠券无效"
		} else {
			// 成功应用优惠券
			data["totalFee"] = v.TotalFee
			data["fee"] = v.Fee
			data["payFee"] = v.PayFee
			data["discountFee"] = v.DiscountFee
			data["couponFee"] = v.CouponFee
			data["couponDescribe"] = buf.String()
		}
	} else {
		// 取消优惠券
		data["totalFee"] = v.TotalFee
		data["fee"] = v.Fee
		data["payFee"] = v.PayFee
		data["discountFee"] = v.DiscountFee
	}

	js, _ := json.Marshal(data)

	r.Result = true
	r.Data = string(js)
	return nil
}
示例#8
0
func (this *Partner) GetShops(m *jsv.Args, r *jsv.Result) error {
	partnerId, err, _ := VerifyPartner(m)

	if err != nil {
		return err
	}

	shops := dps.PartnerService.GetShopsOfPartner(partnerId)
	r.Result = true
	r.Data = shops
	return nil
}
示例#9
0
文件: member.go 项目: honj51/go2o
func (this *Member) GetBankInfo(m *jsv.Args, r *jsv.Result) error {
	memberId, err := Verify(m)
	if err != nil {
		return err
	}
	e := dps.MemberService.GetBank(memberId)
	if e != nil {
		r.Data = e
		r.Result = true
	}
	return nil
}
示例#10
0
文件: member.go 项目: honj51/go2o
func (this *Member) GetDeliverAddrById(m *jsv.Args, r *jsv.Result) error {
	memberId, err := Verify(m)
	if err != nil {
		return err
	}
	addrId, err := strconv.Atoi((*m)["addr_id"].(string))
	if err != nil {
		return err
	}
	r.Result = true
	r.Data = dps.MemberService.GetDeliverAddrById(memberId, addrId)
	return nil
}
示例#11
0
func (this *Partner) GetItems(m *jsv.Args, r *jsv.Result) error {
	partnerId, err, _ := VerifyPartner(m)
	if err != nil {
		return err
	}
	cid, _ := strconv.Atoi((*m)["cid"].(string))
	num, _ := strconv.Atoi((*m)["num"].(string))

	_, items := dps.SaleService.GetPagedOnShelvesGoods(partnerId, cid, 0, num)
	r.Result = true
	r.Data = items

	return nil
}
示例#12
0
// 需要传递配送地址
func (this *Partner) SubmitOrder(m *jsv.Args, r *jsv.Result) error {
	partnerId, err, _ := VerifyPartner(m)
	if err != nil {
		return err
	}
	memberId, _ := strconv.Atoi((*m)["member_id"].(string))
	couponCode := (*m)["coupon_code"].(string)

	orderNo, err := dps.ShoppingService.SubmitOrder(partnerId, memberId, couponCode, true)
	if err != nil {
		return err
	} else {
		r.Result = true
		r.Data = orderNo
	}
	return nil
}
示例#13
0
文件: member.go 项目: honj51/go2o
func (this *Member) DeleteDeliverAddr(m *jsv.Args, r *jsv.Result) error {
	memberId, err := Verify(m)
	if err != nil {
		return err
	}
	addrId, err := strconv.Atoi((*m)["addr_id"].(string))
	if err != nil {
		return err
	}

	if err = dps.MemberService.DeleteDeliverAddr(memberId, addrId); err == nil {
		r.Result = true
	} else {
		r.Data = err.Error()
	}
	return nil
}
示例#14
0
func (this *Partner) BuildOrder(m *jsv.Args, r *jsv.Result) error {
	partnerId, err, _ := VerifyPartner(m)
	if err != nil {
		return err
	}

	memberId, err := strconv.Atoi((*m)["member_id"].(string))
	couponCode := (*m)["coupon_code"].(string)
	if err != nil {
		return err
	}

	data, err := dps.ShoppingService.BuildOrder(partnerId, memberId, "", couponCode)
	if err != nil {
		return err
	}

	js, _ := json.Marshal(data)

	r.Result = true
	r.Data = string(js)
	return nil
}