|
@@ -32,7 +32,8 @@ func CreateOrder(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
}
|
|
}
|
|
order.CreateTime = time.Now()
|
|
order.CreateTime = time.Now()
|
|
order.UpdateTime = time.Now()
|
|
order.UpdateTime = time.Now()
|
|
- return repo.RepoAddDoc(apictx.CreateRepoCtx(), "order", &order)
|
|
|
|
|
|
+
|
|
|
|
+ return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionOrder, &order)
|
|
}
|
|
}
|
|
|
|
|
|
func DeleteOrder(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
func DeleteOrder(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
@@ -41,13 +42,13 @@ func DeleteOrder(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
if id.IsZero() {
|
|
if id.IsZero() {
|
|
return nil, errors.New("id错误")
|
|
return nil, errors.New("id错误")
|
|
}
|
|
}
|
|
- return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), "order", _id)
|
|
|
|
|
|
+ return repo.RepoDeleteDoc(apictx.CreateRepoCtx(), repo.CollectionOrder, _id)
|
|
}
|
|
}
|
|
|
|
|
|
func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
func OrderList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
page, size, query := UtilQueryPageSize(c)
|
|
page, size, query := UtilQueryPageSize(c)
|
|
return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
|
|
return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
|
|
- CollectName: "order",
|
|
|
|
|
|
+ CollectName: repo.CollectionOrder,
|
|
Page: page,
|
|
Page: page,
|
|
Size: size,
|
|
Size: size,
|
|
Query: query,
|
|
Query: query,
|
|
@@ -64,7 +65,7 @@ func OrderDetail(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
query := repo.Map{"_id": id}
|
|
query := repo.Map{"_id": id}
|
|
order := &pay.Order{}
|
|
order := &pay.Order{}
|
|
found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
- CollectName: "order",
|
|
|
|
|
|
+ CollectName: repo.CollectionOrder,
|
|
Query: query,
|
|
Query: query,
|
|
}, order)
|
|
}, order)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -88,5 +89,5 @@ func UpdateOrder(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
if order.Id.IsZero() {
|
|
if order.Id.IsZero() {
|
|
return nil, errors.New("id错误")
|
|
return nil, errors.New("id错误")
|
|
}
|
|
}
|
|
- return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), "order", order.Id.Hex(), &order)
|
|
|
|
|
|
+ return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionOrder, order.Id.Hex(), &order)
|
|
}
|
|
}
|