Просмотр исходного кода

Merge branch 'develop' into feature/app_dev

* develop:
  增加促销列表
abiao лет назад: 4
Родитель
Сommit
2b3a27d9be

+ 3 - 0
go/gopath/src/fohow.com/apps/controllers/promotion_controller/promotion_controller.go

@@ -19,6 +19,9 @@ func (self *PromotionController) GetList() {
 	wxUId := self.GetCurrentWxUserId()
 
 	promotionList := promotion_model.GetAllNoPatchPresents(wxUId)
+	for _, v := range promotionList {
+		v.SourceName = promotion_model.SOURCE_CN[v.Source]
+	}
 
 	list := new(Result)
 	list.Presents = promotionList

+ 20 - 12
go/gopath/src/fohow.com/apps/models/promotion_model/present.go

@@ -11,22 +11,30 @@ import (
 const (
 	SOURCE_BALANCE     = "balance"
 	SOURCE_SHOP        = "shop"
+	SOURCE_OTHERS      = "others"
 	presents_tablename = "presents"
 )
 
+var SOURCE_CN = map[string]string{
+	SOURCE_SHOP:    "店长促销发放",
+	SOURCE_BALANCE: "充值促销发放",
+	SOURCE_OTHERS:  "手工添加",
+}
+
 type Present struct {
-	Id        int64     `orm:"column(id);pk"                                       json:"id"`             // int(11)
-	WxUId     int64     `orm:"column(wx_user_id)"                                  json:"wx_user_id"`     // int(11)
-	Price     int64     `orm:"column(price)"                                        json:"price"`         // int(11)
-	Total     int64     `orm:"column(total)"                                        json:"total"`         // int(11)
-	SendProd  int64     `orm:"column(send_prod1)"                                  json:"send_prod1"`     // int(11)
-	SendNums  int64     `orm:"column(send_nums1)"                                  json:"send_nums1"`     // int(11)
-	OrderId   string    `orm:"column(order_id);null"                                     json:"order_id"` // varchar(32)
-	Source    string    `orm:"column(source);null"                                     json:"source"`     // varchar(32)
-	Remark    string    `orm:"column(remark);null"                                     json:"remark"`     // varchar(32)
-	Status    bool      `orm:"column(status)"                         json:"-"`                           // int(11)
-	CreatedAt time.Time `orm:"column(created_at);null;auto_now_add;type(datetime)" json:"created_at"`     // datetime
-	UpdatedAt time.Time `orm:"column(updated_at);null;auto_now;type(datetime)"     json:"updated_at"`     // datetime
+	Id         int64     `orm:"column(id);pk"                                       json:"id"`             // int(11)
+	WxUId      int64     `orm:"column(wx_user_id)"                                  json:"wx_user_id"`     // int(11)
+	Price      int64     `orm:"column(price)"                                        json:"price"`         // int(11)
+	Total      int64     `orm:"column(total)"                                        json:"total"`         // int(11)
+	SendProd   int64     `orm:"column(send_prod1)"                                  json:"send_prod1"`     // int(11)
+	SendNums   int64     `orm:"column(send_nums1)"                                  json:"send_nums1"`     // int(11)
+	OrderId    string    `orm:"column(order_id);null"                                     json:"order_id"` // varchar(32)
+	Source     string    `orm:"column(source);null"                                     json:"source"`     // varchar(32)
+	Remark     string    `orm:"column(remark);null"                                     json:"remark"`     // varchar(32)
+	Status     bool      `orm:"column(status)"                         json:"-"`                           // int(11)
+	SourceName string    `orm:"-"                                                   json:"source_name"`    // varchar(255)
+	CreatedAt  time.Time `orm:"column(created_at);null;auto_now_add;type(datetime)" json:"created_at"`     // datetime
+	UpdatedAt  time.Time `orm:"column(updated_at);null;auto_now;type(datetime)"     json:"updated_at"`     // datetime
 }
 
 func (self *Present) TableName() string {