diff --git a/controllers/client/order_entry.go b/controllers/client/order_entry.go index 5f939a1..2d7faca 100644 --- a/controllers/client/order_entry.go +++ b/controllers/client/order_entry.go @@ -435,10 +435,6 @@ func (t *OrderEntryCtl) ManualOrder() { t.SUCCESS("成功录入订单") } -// 订单列表 -func (t *OrderEntryCtl) ListOrder() { - -} func (t *OrderEntryCtl) DeleteOrder() { orderId := t.MustGetInt("order_id") order := new(models.CustomerOrder) @@ -512,7 +508,7 @@ func (t *OrderEntryCtl) EntryOrders() { " o.receiver as receiver, o.phone as phone, o.address as address, o.buyer_id as user_id, o.order_entry_person_name as entry_name, "+ " o.total_amount as order_money, DATE_FORMAT(o.created_at, '%Y-%m-%d %H:%i:%S') AS order_time"). Where("o.activity_id=? and o.rehearsal_id=? and o.order_entry_person_id=? and o.arch_id=?", - activity.Id, activity.RehearsalId, uid, activity.ArchId).Find(&list) + activity.Id, activity.RehearsalId, uid, activity.ArchId).Desc("o.id").Find(&list) t.CheckErr(err) orderIds := make([]int, 0) for _, v := range list { diff --git a/main.go b/main.go index c4ebc05..d731077 100644 --- a/main.go +++ b/main.go @@ -6,12 +6,11 @@ import ( "hudongzhuanjia/controllers/client" "hudongzhuanjia/controllers/common" "hudongzhuanjia/controllers/pc" - "hudongzhuanjia/utils/define" //_ "net/http/pprof" ) func main() { - define.SetDebug(true) + //define.SetDebug(true) // pc core.GetInstanceRouterManage().Registered(new(pc.WsCtl)) // 用户 diff --git a/models/customer_order.go b/models/customer_order.go index a94d147..dde2fc3 100644 --- a/models/customer_order.go +++ b/models/customer_order.go @@ -102,7 +102,11 @@ func (t *CustomerOrder) SumCustomerOrder(activityId, rehearsalId, archId interfa res := make([]map[string]string, 0) err := core.GetXormAuto().Table(t).Select("order_entry_person_id, order_entry_person_name, COALESCE(SUM(goods_num), 0) as num"). NoAutoCondition().Where("is_delete=0 and activity_id=? and rehearsal_id=? and arch_id=?", +<<<<<<< Updated upstream activityId, rehearsalId, archId).GroupBy("order_entry_person_id,order_entry_person_name").Limit(limit). +======= + activityId, rehearsalId, archId).GroupBy("order_entry_person_id, order_entry_person_name").Limit(limit). +>>>>>>> Stashed changes Desc("num").Find(&res) return res, err } diff --git a/services/lottery/order_special.go b/services/lottery/order_special.go index 6ed8e33..5419758 100644 --- a/services/lottery/order_special.go +++ b/services/lottery/order_special.go @@ -66,7 +66,7 @@ func GetSpecialOrderWinnersResult(ruleId, rehearsalId, archId interface{}) (resu err = core.GetXormAuto().Table(&models.OrderDrawRecord{}).Alias("r"). Select("r.order_entry_person_name as entry_person_name, r.user_id, o.receiver as user_name, "+ " o.phone as user_phone, r.prize_name").Join("LEFT", - (&models.CustomerOrder{}).Alias("o"), "o.id=r.customer_order_id and u.is_delete=0"). + (&models.CustomerOrder{}).Alias("o"), "o.id=r.customer_order_id and o.is_delete=0"). Where("r.is_delete=0 and r.order_draw_rule_id=? and r.rehearsal_id=? and r.arch_id=?", ruleId, rehearsalId, archId).Find(&result) return diff --git a/utils/utils_test.go b/utils/utils_test.go index 1a2a5d6..79abc6f 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -2,9 +2,12 @@ package utils import ( "fmt" + "github.com/kirinlabs/HttpRequest" "github.com/shopspring/decimal" . "github.com/smartystreets/goconvey/convey" + "go.uber.org/atomic" "testing" + "time" ) func TestQrcode2Base64(t *testing.T) { @@ -75,3 +78,48 @@ func TestCountDownFormat(t *testing.T) { fmt.Println(a.Float64()) } + +func login() string { + loginUrl := "https://api.ouxuanhudong.com/PcClient/Client/UserCtl/entryLogin?activity_id=410&account=18926327519&password=123456" + resp, _ := HttpRequest.NewRequest().Get(loginUrl) + var body = make(map[string]interface{}, 0) + resp.Json(&body) + token := "" + if data, ok := body["data"].(map[string]interface{}); ok { + if people, ok := data["people"].(map[string]interface{}); ok { + token = people["token"].(string) + } + } + //fmt.Println(token) + return token +} + +var incr = new(atomic.Int32) + +func order(token string) { + orderUrl := "https://api.ouxuanhudong.com/PcClient/Client/OrderEntryCtl/manualOrder" + resp, _ := HttpRequest.NewRequest().Post(orderUrl, map[string]interface{}{ + "name": "1222", + "phone": "22222222", + "goods": `[{"good_id":92,"good_num":1}]`, + "token": token, + }) + var data = make(map[string]interface{}) + resp.Json(&data) + //fmt.Println(data) + incr.Add(1) +} + +func TestRequest(t *testing.T) { + var now = time.Now() + tr := time.NewTicker(1 * time.Second) + for { + select { + case <-tr.C: + fmt.Println(incr) + fmt.Println(time.Now().Sub(now).Seconds()) + default: + go order(login()) + } + } +}