From cf49e9ea271ba71347a915acc8f38e7ccd810a11 Mon Sep 17 00:00:00 2001 From: tommy <3405129587@qq.com> Date: Mon, 20 Apr 2020 13:53:20 +0800 Subject: [PATCH] rm code file --- controllers/client/order.go | 38 ++++++++++++++++++++---- models/annex.go | 23 --------------- models/customer_goods.go | 14 +++++++-- models/init_models.go | 9 ------ models/order.go | 25 ---------------- models/seminar_activity.go | 18 ------------ models/seminar_activity_invite_code.go | 21 ------------- models/seminar_invite_code.go | 21 ------------- models/seminar_invite_page.go | 20 ------------- models/seminar_rule.go | 32 -------------------- models/seminar_style.go | 15 ---------- models/user_refund.go | 54 ---------------------------------- models/wechat_ticket.go | 15 ---------- 13 files changed, 45 insertions(+), 260 deletions(-) delete mode 100644 models/annex.go delete mode 100644 models/order.go delete mode 100644 models/seminar_activity.go delete mode 100644 models/seminar_activity_invite_code.go delete mode 100644 models/seminar_invite_code.go delete mode 100644 models/seminar_invite_page.go delete mode 100644 models/seminar_rule.go delete mode 100644 models/seminar_style.go delete mode 100644 models/user_refund.go delete mode 100644 models/wechat_ticket.go diff --git a/controllers/client/order.go b/controllers/client/order.go index 21d8992..e22bee8 100644 --- a/controllers/client/order.go +++ b/controllers/client/order.go @@ -1,12 +1,40 @@ package client -import "hudongzhuanjia/controllers" +import ( + "hudongzhuanjia/controllers" + "hudongzhuanjia/models" + "hudongzhuanjia/utils/code" +) -// 订单活动 -type OrderCtl struct { - controllers.BaseCtl +type GoodCtl struct { + controllers.AuthorCtl } -func (t *OrderCtl) ListGood() { +// 商品列表 +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{} } diff --git a/models/annex.go b/models/annex.go deleted file mode 100644 index ba2b368..0000000 --- a/models/annex.go +++ /dev/null @@ -1,23 +0,0 @@ -package models - -import ( - "time" -) - -const AnnexTableName = TableNamePrefix + "annex" - -//附件 -type Annex struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` - Path string `json:"path" xorm:"not null comment('路径') VARCHAR(255)"` - Size int64 `json:"size" xorm:"not null comment('文件得大小') INT(11)"` - Suffix string `json:"suffix" xorm:"not null comment('文件得后缀') VARCHAR(255)"` - Md5 string `json:"md5" xorm:"not null comment('文件得md5值') VARCHAR(255)"` - IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"` - CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建得时间') DATETIME"` - UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新得时间') DATETIME"` -} - -func (t *Annex) TableName() string { - return AnnexTableName -} diff --git a/models/customer_goods.go b/models/customer_goods.go index 4d34ce6..e6975bf 100644 --- a/models/customer_goods.go +++ b/models/customer_goods.go @@ -1,6 +1,9 @@ package models -import "time" +import ( + "github.com/ouxuanserver/osmanthuswine/src/core" + "time" +) const CustomerGoodsTableName = TableNamePrefix + "customer_goods" @@ -22,7 +25,7 @@ type CustomerGoods struct { Desc string `json:"desc" xorm:"not null default '' comment('商品介绍') VARCHAR(255)"` // 无关变量 - Qrcode string `json:"qrcode" xorm:"-"` + Qrcode string `json:"qrcode,omitempty" xorm:"-"` } func (t *CustomerGoods) TableName() string { @@ -36,3 +39,10 @@ func (t *CustomerGoods) Alias(name string) string { //func (t *CustomerGoods) GetById(gid int64) (bool, error) { // return core.GetXormAuto().Where("is_delete=0 and id=?", gid).Get(t) //} + +func GetGoodsByActivityId(activityId, areaId int64) ([]*CustomerGoods, error) { + goods := make([]*CustomerGoods, 0) + err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and area_id=?", activityId, areaId). + Asc("created_at").Find(&goods) + return goods, err +} diff --git a/models/init_models.go b/models/init_models.go index c77b2c4..cb7c48e 100644 --- a/models/init_models.go +++ b/models/init_models.go @@ -12,7 +12,6 @@ func init() { err := core.GetXormAuto().Sync2( new(Activity), new(ActivityModuleService), - new(Annex), new(AreaStore), new(AuctionHistory), new(AuctionResultRecord), @@ -42,7 +41,6 @@ func init() { new(NewVoteActivity), new(NewVoteActivityHistory), new(NewVoteActivityLadder), - new(Order), new(OrderDrawActivity), new(OrderDrawRecord), new(OrderDrawRule), @@ -52,11 +50,6 @@ func init() { new(RewardServer), new(RewardWallet), new(RewardWalletHistory), - new(SeminarActivity), - new(SeminarInviteCode), - new(SeminarInvitePage), - new(SeminarRule), - new(SeminarStyle), new(Sensitive), new(ShakeRedEnvelopeActivity), new(ShakeRedEnvelopeRecord), @@ -72,7 +65,6 @@ func init() { new(NewVoteActivityHistory), new(OrderEntryPerson), new(Rehearsal), - new(WeChatTicket), new(MsgWallServer), new(ShakeRedEnvelopeUser), new(OrderGift), @@ -80,7 +72,6 @@ func init() { new(Calorie), new(CalorieUser), new(UserOrder), - new(UserRefund), new(UserRedPack), new(RealSignList), new(RealSignHistory), diff --git a/models/order.go b/models/order.go deleted file mode 100644 index 410b8e4..0000000 --- a/models/order.go +++ /dev/null @@ -1,25 +0,0 @@ -package models - -import ( - "time" -) - -type Order struct { - Id int64 `json:"id"` - CustomerId int64 `json:"customer_id"` - OutTradeNo string `json:"out_trade_no"` - TradeNo string `json:"trade_no"` - Money float64 `json:"money"` - ServiceFee float64 `json:"service_fee"` - TotalAmount float64 `json:"total_amount"` - PayType string `json:"pay_type"` - PayTime time.Time `json:"pay_time"` - Goods string `json:"goods"` - ServiceIds string `json:"service_ids"` - ActivityId string `json:"activity_id"` - IsPay int `json:"is_pay"` - Mark string `json:"mark"` - IsDelete bool `json:"is_delete" xorm:"default(0)"` - CreatedAt time.Time `json:"created_at" xorm:"created"` - UpdatedAt time.Time `json:"updated_at" xorm:"updated"` -} diff --git a/models/seminar_activity.go b/models/seminar_activity.go deleted file mode 100644 index 6b8fccd..0000000 --- a/models/seminar_activity.go +++ /dev/null @@ -1,18 +0,0 @@ -package models - -import ( - "time" -) - -//会务活动 -type SeminarActivity struct { - Id int64 `json:"id"` - ActivityId int64 `json:"activity_id" description:"主活动id"` - SeminarActivityName string `json:"seminar_activity_name" description:"会务H5的活动名称"` - OpenInviteCode string `json:"open_invite_code" description:"开启邀请码 [开启|关闭]"` - OpenInvitePage string `json:"open_invite_page" description:"开启邀请涵 [开启|关闭]"` - InviteCodeNum int `json:"invite_code_num" description:"邀请码的数量"` - IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` - CreatedAt time.Time `json:"-" xorm:"create" description:"创建时间"` - UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` -} diff --git a/models/seminar_activity_invite_code.go b/models/seminar_activity_invite_code.go deleted file mode 100644 index 3d9c42e..0000000 --- a/models/seminar_activity_invite_code.go +++ /dev/null @@ -1,21 +0,0 @@ -package models - -import ( - "time" -) - -//会务活动邀请码 -type SeminarActivityInviteCode struct { - Id int64 `json:"id"` - SeminarActivityId int64 `json:"seminar_activity_id" description:"会话活动的id"` - Comment string `json:"comment" description:"邀请码的备注"` - InviteCode string `json:"invite_code" description:"邀请码 [规则暂未定义]"` - Prefix string `json:"prefix" description:"邀请码 前缀"` - CodeBind int64 `json:"code_bind" description:"邀请码_绑定用户id 初始为0"` - CodeStartTime time.Time `json:"code_start_time" description:"邀请码的开始时间"` - CodeEndTime time.Time `json:"code_end_time" description:"邀请码的结束时间"` - IsExpire string `json:"is_expire" description:"是否已经过期 [已过期|未过期]"` - IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` - CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` - UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` -} diff --git a/models/seminar_invite_code.go b/models/seminar_invite_code.go deleted file mode 100644 index 08579cd..0000000 --- a/models/seminar_invite_code.go +++ /dev/null @@ -1,21 +0,0 @@ -package models - -import ( - "time" -) - -//会务邀请码 -type SeminarInviteCode struct { - Id int64 `json:"id"` - SeminarActivityId int64 `json:"seminar_activity_id" description:"会话活动的id"` - Comment string `json:"comment" description:"邀请码的备注"` - InviteCode string `json:"invite_code" description:"邀请码 [规则暂未定义]"` - Prefix string `json:"prefix" description:"邀请码 前缀"` - CodeBind int64 `json:"code_bind" description:"邀请码_绑定用户id 初始为0"` - CodeStartTime time.Time `json:"code_start_time" description:"邀请码的开始时间"` - CodeEndTime time.Time `json:"code_end_time" description:"邀请码的结束时间"` - IsExpire string `json:"is_expire" description:"是否已经过期 [已过期|未过期]"` - IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` - CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` - UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` -} diff --git a/models/seminar_invite_page.go b/models/seminar_invite_page.go deleted file mode 100644 index 6403e76..0000000 --- a/models/seminar_invite_page.go +++ /dev/null @@ -1,20 +0,0 @@ -package models - -import ( - "time" -) - -//会务邀请函 -type SeminarInvitePage struct { - Id int64 `json:"id"` - InvitePageImage string `json:"invite_page_image" description:"邀请涵图片"` - SelfFieldDefine string `json:"self_field_define" description:"自定义字段{'xx':xxx}"` - BeInviteName string `json:"be_invite_name" description:"被邀请的人的姓名"` - SeminarActivityId int64 `json:"seminar_activity_id" description:"会话活动的id"` - BeInvitePhone string `json:"be_invite_phone" description:"被邀请的人的手机号码"` - MoreArea int64 `json:"more_area" description:"多地区 开启则只有该地区可以使用 [开启|关闭]"` - AreaId int64 `json:"area_id" description:"该活动下的地区Id"` - IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否已经删除0未 1删"` - CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` - UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` -} diff --git a/models/seminar_rule.go b/models/seminar_rule.go deleted file mode 100644 index ca42ac6..0000000 --- a/models/seminar_rule.go +++ /dev/null @@ -1,32 +0,0 @@ -package models - -import ( - "time" -) - -//会务规则 -type SeminarRule struct { - Id int64 `json:"id"` - SeminarActivityId int64 `json:"seminar_activity_id" description:"会务活动的id"` - Theme string `json:"theme" description:"会务主题"` - SeminarIndex string `json:"seminar_index" description:"会务排序 {seminar_name:1,seminar_seat:2}"` - SeminarName string `json:"seminar_name" description:"会务主页名称"` - SeminarNameImage string `json:"seminar_name_image" description:"会务主页名称背景图片"` - SeminarNameStatus string `json:"seminar_name_status" description:"会务主页名称 开启|关闭"` - SeminarSeat string `json:"seminar_seat" description:"会务座位安排"` - SeminarSeatImage string `json:"seminar_seat_image" description:"会务座位安排背景图片"` - SeminarSeatStatus string `json:"seminar_seat_status" description:"会务座位安排 开启|关闭"` - SeminarQuestion string `json:"seminar_question" description:"会务常见问题"` - SeminarQuestionImage string `json:"seminar_question_image" description:"会务常见问题背景图片"` - SeminarQuestionStatus string `json:"seminar_question_status" description:"会务常见问题 开启|关闭"` - SeminarHotel string `json:"seminar_hotel" description:"会务酒店"` - SeminarHotelImage string `json:"seminar_hotel_image" description:"会务酒店背景图片"` - SeminarHotelStatus string `json:"seminar_hotel_status" description:"会务酒店 开启|关闭"` - SeminarProcess string `json:"seminar_process" description:"会务议程"` - SeminarProcessImage string `json:"seminar_process_image" description:"会务议程背景图片"` - SeminarProcessStatus string `json:"seminar_process_status" description:"会务议程 开启|关闭"` - StyleImageId string `json:"style_image_id" description:"样式 会务的样式表的id"` - IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` - CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` - UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` -} diff --git a/models/seminar_style.go b/models/seminar_style.go deleted file mode 100644 index 882ac08..0000000 --- a/models/seminar_style.go +++ /dev/null @@ -1,15 +0,0 @@ -package models - -import ( - "time" -) - -//会务活动的样式 -type SeminarStyle struct { - Id int64 `json:"id"` - StyleName string `json:"style_name" description:"样式的名字"` - StyleImageUrl string `json:"style_image_url" description:"样式的图片地址"` - IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` - CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` - UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` -} diff --git a/models/user_refund.go b/models/user_refund.go deleted file mode 100644 index c665e90..0000000 --- a/models/user_refund.go +++ /dev/null @@ -1,54 +0,0 @@ -package models - -import ( - "github.com/ouxuanserver/osmanthuswine/src/core" - "time" -) - -const UserRefundTableName = TableNamePrefix + "user_refund" - -type UserRefund struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` - GoodType int `json:"good_type" xorm:"not null default(0) comment('1霸屏2打赏')"` - RefundDesc string `json:"refund_desc" xorm:"not null default('') comment('') VARCHAR(128)"` - WxRefundId string `json:"wx_refund_id" xorm:"not null default '' comment('微信退单号') VARCHAR(32)"` - TransactionId string `json:"transaction_id" xorm:"not null default '' comment('微信订单号')"` - OutTradeNo string `json:"out_trade_no" xorm:"not null default '' comment('商户订单号') VARCHAR(32)"` - FeeType string `json:"fee_type" xorm:"not null default 'CNY' comment('货币种类') VARCHAR(16)"` - TotalFee int `json:"total_fee" xorm:"not null default 0 comment('订单总金额,单位是分') INT(88)"` - OpenId string `json:"open_id" xorm:"not null default '' comment('用户标识') VARCHAR(128)"` - UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"` - ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"` - RefundStatus string `json:"refund_status" xorm:"not null default '' comment('微信退款状态') VARCHAR(16)"` - Status int `json:"status" xorm:"not null default 0 comment('0未查询,1已查询') TINYINT(1)"` - SuccessTime time.Time `json:"success_time" xorm:"not null default '' comment('退款成功时间') VARCHAR(20)"` - RefundRecvAccount string `json:"refund_recv_account" xorm:"not null default '' comment('入账账号') VARCHAR(64)"` - RefundAccount string `json:"refund_account" xorm:"not null default '' comment('入账账号') VARCHAR(64)"` - - IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)" description:"是否删除"` - CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME" description:"创建时间"` - UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME" description:"更新时间"` -} - -func (t *UserRefund) TableName() string { - return UserRefundTableName -} - -func (t *UserRefund) GetByOutRefundNo(no string) (bool, error) { - return core.GetXormAuto().Where("is_delete=0 and out_refund_no=?", no).Get(t) -} - -func (t *UserRefund) GetByOutTradeNo(no string) (bool, error) { - return core.GetXormAuto().Where("is_delete=0 and out_trade_no=?", no).Get(t) -} - -func (t *UserRefund) AddUserRefund() (int64, error) { - return core.GetXormAuto().InsertOne(t) -} - -func (t *UserRefund) QueryUpdate() (int64, error) { - return core.GetXormAuto().Where("id=?", t.Id). - Cols("refund_account, refund_recv_account, " + - "status, refund_status, success_time, refund_id, transaction_id").Update(t) - -} diff --git a/models/wechat_ticket.go b/models/wechat_ticket.go deleted file mode 100644 index 17b7291..0000000 --- a/models/wechat_ticket.go +++ /dev/null @@ -1,15 +0,0 @@ -package models - -import "time" - -type WeChatTicket struct { - Id int64 `json:"id" xorm:"pk autoincr"` - Url string `json:"url" xorm:"not null comment('路径')"` - Token string `json:"-" xorm:"not null comment('token')"` - TokenExpired int64 `json:"ticket_expired" xorm:"not null default(0) comment('token过期时间')"` - Ticket string `json:"ticket" xorm:"not null comment('ticket')"` - TicketExpired int64 `json:"ticket_expired" xorm:"not null default(0) comment('ticket 过期时间')"` - IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除')"` - CreatedAt time.Time `json:"created_at" xorm:"created comment('创建')"` - UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新')"` -}