order
This commit is contained in:
@@ -4,21 +4,48 @@ package model
|
|||||||
type BillIncome struct {
|
type BillIncome struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
|
|
||||||
BillID int64 `orm:"bill_id" json:"billID"` //账单ID
|
BillID int64 `orm:"bill_id" json:"billID"` //账单ID
|
||||||
|
Type int `json:"type"` //收入类型
|
||||||
|
IncomePrice int `json:"incomePrice"` //收入金额
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *BillIncome) TableIndex() [][]string {
|
||||||
|
return [][]string{
|
||||||
|
[]string{"BillID"},
|
||||||
|
[]string{"CreatedAt"},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//账单支出表
|
//账单支出表
|
||||||
type BillExpend struct {
|
type BillExpend struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
|
|
||||||
BillID int64 `orm:"bill_id" json:"billID"` //账单ID
|
BillID int64 `orm:"bill_id" json:"billID"` //账单ID
|
||||||
|
Type int `json:"type"` //支出类型
|
||||||
|
ExpendPrice int `json:"expendPrice"` //支出金额
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *BillExpend) TableIndex() [][]string {
|
||||||
|
return [][]string{
|
||||||
|
[]string{"BillID"},
|
||||||
|
[]string{"CreatedAt"},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//用户账单表
|
//用户账单表
|
||||||
type UserBill struct {
|
type UserBill struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
|
|
||||||
BillID int64 `orm:"bill_id" json:"billID"` //账单ID
|
BillID int64 `orm:"bill_id" json:"billID"` //账单ID
|
||||||
UserID string `orm:"user_id" json:"userID"` //用户ID
|
UserID string `orm:"user_id" json:"userID"` //用户ID
|
||||||
|
AccountBalance int `json:"accountBalance"` //账户余额
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *UserBill) TableIndex() [][]string {
|
||||||
|
return [][]string{
|
||||||
|
[]string{"BillID"},
|
||||||
|
[]string{"UserID"},
|
||||||
|
[]string{"CreatedAt"},
|
||||||
|
[]string{"AccountBalance"},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,205 +0,0 @@
|
|||||||
package controllers
|
|
||||||
|
|
||||||
// type WeixinCallbackResult struct {
|
|
||||||
// Code int `json:"code"`
|
|
||||||
// Msg string `json:"msg"`
|
|
||||||
// Data interface{} `json:"data"`
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 认证相关API
|
|
||||||
// type AuthController struct {
|
|
||||||
// beego.Controller
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var (
|
|
||||||
// ErrParameterIsIllegal = "参数不全或不合法"
|
|
||||||
// )
|
|
||||||
|
|
||||||
// // @Title 给微信用的回调接口
|
|
||||||
// // @Description 给微信用的回调接口,自己不能直接调用
|
|
||||||
// // @Param code query string true "客户同意后得到的code"
|
|
||||||
// // @Param block query string true "回调地址"
|
|
||||||
// // @Param state query string false "微信回调的登录状态"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /GetWeiXinUserInfo [get]
|
|
||||||
// func (c *AuthController) GetWeiXinUserInfo() {
|
|
||||||
// retVal := &WeixinCallbackResult{}
|
|
||||||
// var err error
|
|
||||||
// code := c.GetString("code")
|
|
||||||
// block := c.GetString("block")
|
|
||||||
// state := c.GetString("state")
|
|
||||||
// if block != "" {
|
|
||||||
// if code != "" {
|
|
||||||
// result, err2 := weixin.GetWeiXinUserInfo(code, state)
|
|
||||||
// if err = err2; err == nil {
|
|
||||||
// retVal.Code = 1
|
|
||||||
// retVal.Msg = "微信登录成功"
|
|
||||||
// retVal.Data = result
|
|
||||||
// } else {
|
|
||||||
// retVal.Msg = err.Error()
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// retVal.Msg = "code为空"
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// retVal.Msg = "没有block"
|
|
||||||
// }
|
|
||||||
// redirectURL := fmt.Sprintf("%s?info=%s", block, base64.StdEncoding.EncodeToString(utils.MustMarshal(retVal)))
|
|
||||||
// globals.SugarLogger.Debugf("auth GetWeiXinUserInfo retVal:%s, redirectURL:%s", utils.Format4Output(retVal, true), redirectURL)
|
|
||||||
// c.Redirect(redirectURL, http.StatusTemporaryRedirect)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 登录接口
|
|
||||||
// // @Description 登录接口
|
|
||||||
// // @Param id formData string false "登录ID"
|
|
||||||
// // @Param type formData string true "登录类型,当前支持[weixinsns:微信公众号登录,localpass:本地账号密码,mobile:手机短信,weixinmini;小程序code登录]"
|
|
||||||
// // @Param secret formData string true "不同登录类型的登录秘密"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /Login [post]
|
|
||||||
// func (c *AuthController) Login() {
|
|
||||||
// c.callLogin(func(params *tAuthLoginParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// if params.Type == weixin.LoginTypeMiniProgram {
|
|
||||||
// params.Secret = GetComposedCode(&c.Controller, params.Secret)
|
|
||||||
// }
|
|
||||||
// retVal, err = auth.Login(params.Id, params.Type, params.Secret)
|
|
||||||
// if err == auth.ErrUserNotExist {
|
|
||||||
// return retVal, model.ErrCodeUserNotExist, err
|
|
||||||
// }
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 登出接口
|
|
||||||
// // @Description 登出接口
|
|
||||||
// // @Param token header string true "认证token"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /Logout [delete]
|
|
||||||
// func (c *AuthController) Logout() {
|
|
||||||
// c.callLogout(func(params *tAuthLogoutParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// err = auth.Logout(params.Token)
|
|
||||||
// globals.SugarLogger.Debug(err)
|
|
||||||
// return nil, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 得到用户信息
|
|
||||||
// // @Description 得到用户信息(从token中)
|
|
||||||
// // @Param token header string true "认证token"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /GetUserInfo [get]
|
|
||||||
// func (c *AuthController) GetUserInfo() {
|
|
||||||
// c.callGetUserInfo(func(params *tAuthGetUserInfoParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// retVal, err = auth.GetUserInfo(params.Token)
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 发送验证码
|
|
||||||
// // @Description 发送验证码
|
|
||||||
// // @Param mobile formData string true "手机号"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /SendMobileVerifyCode [post]
|
|
||||||
// func (c *AuthController) SendMobileVerifyCode() {
|
|
||||||
// c.callSendMobileVerifyCode(func(params *tAuthSendMobileVerifyCodeParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// err = mobile.SendVerifyCode(params.Mobile)
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 绑定手机
|
|
||||||
// // @Description 绑定手机,待删除
|
|
||||||
// // @Param token header string true "认证token"
|
|
||||||
// // @Param mobile formData string true "手机号"
|
|
||||||
// // @Param code formData string true "验证码"
|
|
||||||
// // @Param nickname formData string false "用户名"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /BindMobile [post]
|
|
||||||
// func (c *AuthController) BindMobile() {
|
|
||||||
// c.callBindMobile(func(params *tAuthBindMobileParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// err = weixin.BindMobile(params.Token, params.Mobile, params.Code, params.Nickname)
|
|
||||||
// if err == auth.ErrUserNotExist {
|
|
||||||
// return retVal, model.ErrCodeUserNotExist, err
|
|
||||||
// }
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 微信公众号绑定手机2
|
|
||||||
// // @Description 微信公众号绑定手机2
|
|
||||||
// // @Param openID formData string true "微信公众号ID"
|
|
||||||
// // @Param secret formData string true "后台之前返回的secret"
|
|
||||||
// // @Param nickname formData string false "用户名"
|
|
||||||
// // @Param mobile formData string true "手机号"
|
|
||||||
// // @Param verifyCode formData string true "手机验证码"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /BindMobile2 [post]
|
|
||||||
// func (c *AuthController) BindMobile2() {
|
|
||||||
// c.callBindMobile2(func(params *tAuthBindMobile2Params) (retVal interface{}, errCode string, err error) {
|
|
||||||
// if retVal, err = weixin.BindMobile2(params.OpenID, params.Secret, params.Mobile, params.VerifyCode, params.Nickname); err == nil {
|
|
||||||
// cms.TransferLegacyWeixins(params.Mobile)
|
|
||||||
// } else if err == auth.ErrUserNotExist {
|
|
||||||
// return retVal, model.ErrCodeUserNotExist, err
|
|
||||||
// }
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 绑定手机
|
|
||||||
// // @Description 绑定手机(调用此方法前先需要以短信方式登录),待删除
|
|
||||||
// // @Param token header string true "认证token"
|
|
||||||
// // @Param code formData string true "小程序用户code"
|
|
||||||
// // @Param nickname formData string false "用户名"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /MiniBindWeiXin [post]
|
|
||||||
// func (c *AuthController) MiniBindWeiXin() {
|
|
||||||
// c.callMiniBindWeiXin(func(params *tAuthMiniBindWeiXinParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// err = weixin.AutherMini.BindWeiXin(params.Ctx, GetComposedCode(&c.Controller, params.Code), params.Nickname)
|
|
||||||
// if err == auth.ErrUserNotExist {
|
|
||||||
// return retVal, model.ErrCodeUserNotExist, err
|
|
||||||
// }
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 绑定小程序
|
|
||||||
// // @Description 绑定小程序
|
|
||||||
// // @Param token header string true "认证token"
|
|
||||||
// // @Param code formData string true "小程序用户code"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /BindMiniProgram [post]
|
|
||||||
// func (c *AuthController) BindMiniProgram() {
|
|
||||||
// c.callBindMiniProgram(func(params *tAuthBindMiniProgramParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// err = weixin.AutherMini.BindMiniProgram(params.Ctx, GetComposedCode(&c.Controller, params.Code))
|
|
||||||
// if err == nil {
|
|
||||||
// cms.TransferLegacyWeixins(params.Ctx.GetLoginID())
|
|
||||||
// }
|
|
||||||
// if err == auth.ErrUserNotExist {
|
|
||||||
// return retVal, model.ErrCodeUserNotExist, err
|
|
||||||
// }
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // @Title 解密小程序数据
|
|
||||||
// // @Description 解密小程序数据
|
|
||||||
// // @Param token header string true "认证token"
|
|
||||||
// // @Param data formData string true "加密数据"
|
|
||||||
// // @Param iv formData string true "iv"
|
|
||||||
// // @Success 200 {object} controllers.CallResult
|
|
||||||
// // @Failure 200 {object} controllers.CallResult
|
|
||||||
// // @router /MiniDecryptData [post]
|
|
||||||
// func (c *AuthController) MiniDecryptData() {
|
|
||||||
// c.callMiniDecryptData(func(params *tAuthMiniDecryptDataParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
// retVal, err = weixin.AutherMini.DecryptData(params.Ctx, params.Data, params.Iv)
|
|
||||||
// return retVal, "", err
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
21
controllers/order_controller.go
Normal file
21
controllers/order_controller.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/astaxie/beego"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderController struct {
|
||||||
|
beego.Controller
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title 支付
|
||||||
|
// @Description 支付
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param userID query string true "用户ID"
|
||||||
|
// @Param roleList query string true "角色列表"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /Pay [post]
|
||||||
|
func (c *OrderController) Pay() {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,86 +9,13 @@ import (
|
|||||||
func Init() {
|
func Init() {
|
||||||
// set default database
|
// set default database
|
||||||
orm.RegisterDataBase("default", "mysql", beego.AppConfig.String("dbConnectStr"), 30)
|
orm.RegisterDataBase("default", "mysql", beego.AppConfig.String("dbConnectStr"), 30)
|
||||||
// orm.RegisterModel(new(legacymodel.Config))
|
|
||||||
// orm.RegisterModel(new(legacymodel.BlackClient))
|
|
||||||
// orm.RegisterModel(new(legacymodel.JxBadComments))
|
|
||||||
// orm.RegisterModel(new(legacymodel.StoreBill))
|
|
||||||
// if !globals.DisableWXAuth1 {
|
|
||||||
// orm.RegisterModel(new(legacymodel.WeiXins))
|
|
||||||
// }
|
|
||||||
// orm.RegisterModel(new(model.GoodsOrder))
|
|
||||||
// orm.RegisterModel(new(model.GoodsOrderOriginal))
|
|
||||||
// orm.RegisterModel(new(model.TempGoodsOrderMobile))
|
|
||||||
// orm.RegisterModel(new(model.OrderSku))
|
|
||||||
// orm.RegisterModel(new(model.Waybill))
|
|
||||||
// orm.RegisterModel(new(model.OrderStatus))
|
|
||||||
|
|
||||||
// orm.RegisterModel(new(model.Message))
|
|
||||||
// orm.RegisterModel(new(model.MessageStatus))
|
|
||||||
// orm.RegisterModel(new(model.ImMessageRecord))
|
|
||||||
|
|
||||||
// orm.RegisterModel(&model.Place{})
|
|
||||||
// orm.RegisterModel(&model.Store{}, &model.StoreSub{}, &model.StoreMap{}, &model.StoreCourierMap{}, &model.StoreCategoryMap{})
|
|
||||||
// orm.RegisterModel(&model.SkuVendorCategory{}, &model.StoreSkuCategoryMap{}, &model.SkuName{}, &model.Sku{}, &model.SkuNamePlaceBind{}, &model.StoreSkuBind{})
|
|
||||||
// orm.RegisterModel(&model.SkuVendorCategoryMap{}) //商品映射平台类目
|
|
||||||
// orm.RegisterModel(&model.StoreSkuBindHistory{})
|
|
||||||
// orm.RegisterModel(&model.StoreSkuAudit{})
|
|
||||||
// orm.RegisterModel(&model.SkuCategory{})
|
|
||||||
// orm.RegisterModel(&model.ThingMap{})
|
|
||||||
// orm.RegisterModel(&model.SkuExinfoMap{})
|
|
||||||
// orm.RegisterModel(&model.StorePushClient{})
|
|
||||||
// orm.RegisterModel(&model.StoreAudit{})
|
|
||||||
|
|
||||||
|
//用户
|
||||||
orm.RegisterModel(&model.AuthBind{}, &model.User{})
|
orm.RegisterModel(&model.AuthBind{}, &model.User{})
|
||||||
|
//账单
|
||||||
|
orm.RegisterModel(&model.UserBill{}, &model.BillIncome{}, &model.BillExpend{})
|
||||||
|
|
||||||
// orm.RegisterModel(&model.PageShop{})
|
orm.RegisterModel(&model.NewConfig{})
|
||||||
// orm.RegisterModel(&model.VendorStoreSnapshot{})
|
|
||||||
// orm.RegisterModel(&model.PriceReferSnapshot{})
|
|
||||||
// orm.RegisterModel(&model.StorePriceScoreSnapshot{})
|
|
||||||
// orm.RegisterModel(&model.StoreSkuNamePrice{})
|
|
||||||
// orm.RegisterModel(&model.OrderSupplementFee{})
|
|
||||||
// orm.RegisterModel(&model.OperateEvent{})
|
|
||||||
// orm.RegisterModel(&model.OperateEventDetail{})
|
|
||||||
|
|
||||||
// orm.RegisterModel(&model.ActivityForSku{})
|
|
||||||
// orm.RegisterModel(&legacymodel.JxBadComments2{})
|
|
||||||
|
|
||||||
// if globals.EnablePendingChange {
|
|
||||||
// orm.RegisterModel(&model.StoreOpRequest{})
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 如下语句建表时要出错(INDEX名字太长了),暂时放一下,必须放最后一句
|
|
||||||
// orm.RegisterModel(&model.OrderFinancial{}, &model.AfsOrder{}, &model.OrderDiscountFinancial{}, &model.OrderSkuFinancial{})
|
|
||||||
// orm.RegisterModel(&model.PriceDefendOrder{})
|
|
||||||
// orm.RegisterModel(&model.Act{}, &model.ActOrderRule{}, &model.ActStoreSku{})
|
|
||||||
// orm.RegisterModel(&model.ActMap{}, &model.ActStoreSkuMap{})
|
|
||||||
// if globals.IsStoreSkuAct {
|
|
||||||
// orm.RegisterModel(&model.StoreSkuAct{})
|
|
||||||
// }
|
|
||||||
|
|
||||||
// orm.RegisterModel(&model.NewConfig{})
|
|
||||||
|
|
||||||
// orm.RegisterModel(&model.CasbinRule{})
|
|
||||||
// orm.RegisterModel(&model.SensitiveWord{})
|
|
||||||
// orm.RegisterModel(&model.StoreScore{})
|
|
||||||
// orm.RegisterModel(&model.StoreAlert{})
|
|
||||||
// orm.RegisterModel(&model.FoodRecipe{}, &model.FoodRecipeStep{}, &model.FoodRecipeItem{}, &model.FoodRecipeItemChoice{}, &model.FoodRecipeUser{})
|
|
||||||
// orm.RegisterModel(&model.DataResource{})
|
|
||||||
|
|
||||||
// orm.RegisterModel(&model.UserDeliveryAddress{})
|
|
||||||
// orm.RegisterModel(&model.UserCartItem{})
|
|
||||||
// orm.RegisterModel(&model.UserAgreement{})
|
|
||||||
// orm.RegisterModel(&model.UserMember{})
|
|
||||||
// orm.RegisterModel(&model.OrderPay{}, &model.OrderPayRefund{})
|
|
||||||
// orm.RegisterModel(&model.UserOrderSms{})
|
|
||||||
|
|
||||||
// orm.RegisterModel(&model.FakeJdThingMap{})
|
|
||||||
|
|
||||||
//权限
|
|
||||||
// orm.RegisterModel(&model.Role{})
|
|
||||||
// orm.RegisterModel(&model.UserRole{})
|
|
||||||
// orm.RegisterModel(&model.Menu{})
|
|
||||||
// orm.RegisterModel(&model.RoleMenu{})
|
|
||||||
// create table
|
// create table
|
||||||
orm.RunSyncdb("default", false, true)
|
orm.RunSyncdb("default", false, true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ func init() {
|
|||||||
&controllers.User2Controller{},
|
&controllers.User2Controller{},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
beego.NSNamespace("/order",
|
||||||
|
beego.NSInclude(
|
||||||
|
&controllers.OrderController{},
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
beego.AddNamespace(ns)
|
beego.AddNamespace(ns)
|
||||||
beego.AutoRouter(&controllers.TongLianController{})
|
beego.AutoRouter(&controllers.TongLianController{})
|
||||||
|
|||||||
Reference in New Issue
Block a user