-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adf80bf
commit 974072a
Showing
7 changed files
with
97 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package dto | ||
|
||
import ( | ||
"encoding/json" | ||
"reggie/internal/models/common" | ||
"time" | ||
) | ||
|
||
type OrdersPageQueryDTO struct { | ||
Page int `json:"page,omitempty"` | ||
PageSize int `json:"page_size,omitempty"` | ||
Number string `json:"number,omitempty"` | ||
Phone string `json:"phone,omitempty"` | ||
Status int `json:"status,omitempty"` | ||
BeginTime time.Time `json:"begin_time"` | ||
EndTime time.Time `json:"end_time"` | ||
UserId int64 `json:"user_id,omitempty"` | ||
} | ||
type tmpJSON OrdersPageQueryDTO | ||
type tmp struct { | ||
tmpJSON | ||
BeginTime common.DateTime `json:"begin_time"` | ||
EndTime common.DateTime `json:"end_time"` | ||
} | ||
|
||
func (o OrdersPageQueryDTO) MarshalJSON() ([]byte, error) { | ||
p := &tmp{ | ||
tmpJSON: (tmpJSON)(o), | ||
BeginTime: common.DateTime(o.BeginTime), | ||
EndTime: common.DateTime(o.EndTime), | ||
} | ||
marshal, err := json.Marshal(p) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return marshal, err | ||
} | ||
|
||
func (o *OrdersPageQueryDTO) UnmarshalJSON(b []byte) error { | ||
var t tmp | ||
err := json.Unmarshal(b, &t) | ||
t.tmpJSON.BeginTime, t.tmpJSON.EndTime = (time.Time)(t.BeginTime), (time.Time)(t.EndTime) | ||
if err != nil { | ||
return err | ||
} | ||
o = (*OrdersPageQueryDTO)(&t.tmpJSON) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package admin | ||
|
||
import ( | ||
"context" | ||
"github.com/cloudwego/hertz/pkg/app" | ||
"reggie/internal/models/dto" | ||
) | ||
|
||
// @Summary 订单搜索 | ||
func ConditionSearchOrder(ctx context.Context, c *app.RequestContext) { | ||
var oq dto.OrdersPageQueryDTO | ||
c.Bind(&oq) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package utils | ||
|
||
import "unsafe" | ||
|
||
func String2Bytes(s string) []byte { | ||
return *(*[]byte)(unsafe.Pointer(&s)) | ||
} | ||
func Bytes2String(b []byte) string { | ||
return *(*string)(unsafe.Pointer(&b)) | ||
} |