黄梓健
5 years ago
13 changed files with 45 additions and 260 deletions
-
38controllers/client/order.go
-
23models/annex.go
-
14models/customer_goods.go
-
9models/init_models.go
-
25models/order.go
-
18models/seminar_activity.go
-
21models/seminar_activity_invite_code.go
-
21models/seminar_invite_code.go
-
20models/seminar_invite_page.go
-
32models/seminar_rule.go
-
15models/seminar_style.go
-
54models/user_refund.go
-
15models/wechat_ticket.go
@ -1,12 +1,40 @@ |
|||||
package client |
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{} |
||||
|
|
||||
} |
} |
@ -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 |
|
||||
} |
|
@ -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"` |
|
||||
} |
|
@ -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:"更新时间"` |
|
||||
} |
|
@ -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:"更新时间"` |
|
||||
} |
|
@ -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:"更新时间"` |
|
||||
} |
|
@ -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:"更新时间"` |
|
||||
} |
|
@ -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:"更新时间"` |
|
||||
} |
|
@ -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:"更新时间"` |
|
||||
} |
|
@ -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) |
|
||||
|
|
||||
} |
|
@ -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('更新')"` |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue