作者 tangxvhui

Merge branch 'test'

1 -# Config file for [Air](https://github.com/cosmtrek/air) in TOML format  
2 -  
3 -# Working directory  
4 -# . or absolute path, please note that the directories following must be under root.  
5 -root = "."  
6 -tmp_dir = "tmp"  
7 -  
8 -[build]  
9 -# Just plain old shell command. You could use `make` as well.  
10 -cmd = "go build -o ./tmp/main ."  
11 -# Binary file yields from `cmd`.  
12 -bin = "tmp/main"  
13 -# Customize binary.  
14 -full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"  
15 -# Watch these filename extensions.  
16 -include_ext = ["go", "tpl", "tmpl", "html"]  
17 -# Ignore these filename extensions or directories.  
18 -exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"]  
19 -# Watch these directories if you specified.  
20 -include_dir = []  
21 -# Exclude files.  
22 -exclude_file = []  
23 -# Exclude unchanged files.  
24 -exclude_unchanged = true  
25 -# This log file places in your tmp_dir.  
26 -log = "air.log"  
27 -# It's not necessary to trigger build each time file changes if it's too frequent.  
28 -delay = 1000 # ms  
29 -# Stop running old binary when build errors occur.  
30 -stop_on_error = true  
31 -# Send Interrupt signal before killing process (windows does not support this feature)  
32 -send_interrupt = false  
33 -# Delay after sending Interrupt signal  
34 -kill_delay = 500 # ms  
35 -  
36 -[log]  
37 -# Show log time  
38 -time = false  
39 -  
40 -[color]  
41 -# Customize each part's color. If no color found, use the raw app log.  
42 -main = "magenta"  
43 -watcher = "cyan"  
44 -build = "yellow"  
45 -runner = "green"  
46 -  
47 -[misc]  
48 -# Delete tmp directory on exit  
49 -clean_on_exit = true  
@@ -2,10 +2,11 @@ package service @@ -2,10 +2,11 @@ package service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 - "github.com/linmadan/egglib-go/core/application"  
6 "strconv" 5 "strconv"
7 "time" 6 "time"
8 7
  8 + "github.com/linmadan/egglib-go/core/application"
  9 +
9 "github.com/astaxie/beego/logs" 10 "github.com/astaxie/beego/logs"
10 11
11 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/event/subscriber" 12 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/event/subscriber"
@@ -20,7 +21,7 @@ import ( @@ -20,7 +21,7 @@ import (
20 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib" 21 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
21 ) 22 )
22 23
23 -//OrderService 自建订单,意向单,实发订单 24 +// OrderService 自建订单,意向单,实发订单
24 type OrderInfoService struct { 25 type OrderInfoService struct {
25 } 26 }
26 27
@@ -125,7 +126,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder @@ -125,7 +126,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder
125 return orderDataReturn, cnt, nil 126 return orderDataReturn, cnt, nil
126 } 127 }
127 128
128 -//GetOrderDetail 获取订单详情 129 +// GetOrderDetail 获取订单详情
129 func (service OrderInfoService) GetOrderDetail(getOrderQuery query.GetOrderQuery) (*domain.OrderBase, error) { 130 func (service OrderInfoService) GetOrderDetail(getOrderQuery query.GetOrderQuery) (*domain.OrderBase, error) {
130 //实际业务 131 //实际业务
131 transactionContext, err := factory.CreateTransactionContext(nil) 132 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -352,7 +353,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( @@ -352,7 +353,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
352 return newOrder, nil 353 return newOrder, nil
353 } 354 }
354 355
355 -//DeleteOrder 删除订单 356 +// DeleteOrder 删除订单
356 func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) error { 357 func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) error {
357 var ( 358 var (
358 transactionContext, _ = factory.CreateTransactionContext(nil) 359 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -393,7 +394,7 @@ func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) erro @@ -393,7 +394,7 @@ func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) erro
393 return nil 394 return nil
394 } 395 }
395 396
396 -//UpdateOrderData 编辑订单 397 +// UpdateOrderData 编辑订单
397 func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) (*domain.OrderBase, error) { 398 func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) (*domain.OrderBase, error) {
398 var ( 399 var (
399 transactionContext, _ = factory.CreateTransactionContext(nil) 400 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -581,7 +582,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) @@ -581,7 +582,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
581 return oldOrderData, nil 582 return oldOrderData, nil
582 } 583 }
583 584
584 -//deleteOldOrderGoods 新旧商品列表对比 585 +// deleteOldOrderGoods 新旧商品列表对比
585 func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, oldGoods []domain.OrderGood) (goodIds []int64) { 586 func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, oldGoods []domain.OrderGood) (goodIds []int64) {
586 for _, old := range oldGoods { 587 for _, old := range oldGoods {
587 var hasIn bool 588 var hasIn bool
@@ -598,7 +599,7 @@ func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, @@ -598,7 +599,7 @@ func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood,
598 return 599 return
599 } 600 }
600 601
601 -//DisableOrEnable 开启关闭订单 602 +// DisableOrEnable 开启关闭订单
602 func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) error { 603 func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) error {
603 var ( 604 var (
604 transactionContext, _ = factory.CreateTransactionContext(nil) 605 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -642,7 +643,7 @@ func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) @@ -642,7 +643,7 @@ func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand)
642 return nil 643 return nil
643 } 644 }
644 645
645 -//PageListOrderBouns 获取订单的分红列表 646 +// PageListOrderBouns 获取订单的分红列表
646 func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) { 647 func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) {
647 transactionContext, err := factory.CreateTransactionContext(nil) 648 transactionContext, err := factory.CreateTransactionContext(nil)
648 if err != nil { 649 if err != nil {
@@ -692,6 +693,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -692,6 +693,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
692 PartnerInfo: domain.Partner{ 693 PartnerInfo: domain.Partner{
693 Id: orderModel.PartnerId, 694 Id: orderModel.PartnerId,
694 }, 695 },
  696 + SaleDate: orderModel.SaleDate,
695 BonusStatus: orderModel.BonusStatus, 697 BonusStatus: orderModel.BonusStatus,
696 CompanyId: orderModel.CompanyId, 698 CompanyId: orderModel.CompanyId,
697 } 699 }
@@ -726,10 +728,11 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -726,10 +728,11 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
726 goods []domain.OrderGood 728 goods []domain.OrderGood
727 hasBonusPercent bool 729 hasBonusPercent bool
728 ) 730 )
729 - goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id}) 731 + goods, _, _ = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id})
730 for ii := range goods { 732 for ii := range goods {
731 if goods[ii].PartnerBonusPercent >= 0 { 733 if goods[ii].PartnerBonusPercent >= 0 {
732 hasBonusPercent = true 734 hasBonusPercent = true
  735 + break
733 } 736 }
734 } 737 }
735 listIndex := listOrderQuery.Offset + (1 + i) 738 listIndex := listOrderQuery.Offset + (1 + i)
@@ -738,6 +741,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -738,6 +741,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
738 "createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"), 741 "createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"),
739 "updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"), 742 "updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"),
740 "id": fmt.Sprint(orders[i].Id), 743 "id": fmt.Sprint(orders[i].Id),
  744 + "saleDate": orders[i].SaleDate.Local().Format("2006-01-02"),
741 "shipmentsId": orders[i].DeliveryCode, 745 "shipmentsId": orders[i].DeliveryCode,
742 "partner": orders[i].PartnerInfo.PartnerName, 746 "partner": orders[i].PartnerInfo.PartnerName,
743 "dividendsReceivable": fmt.Sprint(orders[i].GetCurrentPartnerBonus()), 747 "dividendsReceivable": fmt.Sprint(orders[i].GetCurrentPartnerBonus()),
@@ -764,7 +768,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -764,7 +768,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
764 return resp, cnt, nil 768 return resp, cnt, nil
765 } 769 }
766 770
767 -//PayPartnerBonusWithOrderBestshop 支付分红 771 +// PayPartnerBonusWithOrderBestshop 支付分红
768 func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adminId int64) error { 772 func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adminId int64) error {
769 var ( 773 var (
770 transactionContext, _ = factory.CreateTransactionContext(nil) 774 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -799,7 +803,7 @@ func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adm @@ -799,7 +803,7 @@ func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adm
799 return nil 803 return nil
800 } 804 }
801 805
802 -//UpdateOrderRemarkBonus 订单分红详情,更新备注 806 +// UpdateOrderRemarkBonus 订单分红详情,更新备注
803 func (service OrderInfoService) UpdateOrderRemarkBonus(orderId int64, adminId int64, remark string) error { 807 func (service OrderInfoService) UpdateOrderRemarkBonus(orderId int64, adminId int64, remark string) error {
804 var ( 808 var (
805 transactionContext, _ = factory.CreateTransactionContext(nil) 809 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -878,6 +882,7 @@ func (service OrderInfoService) ListOrderBonusForExcel(listOrderQuery query.List @@ -878,6 +882,7 @@ func (service OrderInfoService) ListOrderBonusForExcel(listOrderQuery query.List
878 "delivery_code": result[i].DeliveryCode, 882 "delivery_code": result[i].DeliveryCode,
879 "partner_name": result[i].PartnerName, 883 "partner_name": result[i].PartnerName,
880 "bonus_status": "", 884 "bonus_status": "",
  885 + "sale_date": result[i].SaleDate,
881 "update_time": result[i].UpdateTime, 886 "update_time": result[i].UpdateTime,
882 "create_time": result[i].CreateTime, 887 "create_time": result[i].CreateTime,
883 "partner_bonus": fmt.Sprintf("%10.2f", result[i].PartnerBonus), 888 "partner_bonus": fmt.Sprintf("%10.2f", result[i].PartnerBonus),
@@ -910,6 +915,7 @@ func (service OrderInfoService) ListOrderBonusForExcel(listOrderQuery query.List @@ -910,6 +915,7 @@ func (service OrderInfoService) ListOrderBonusForExcel(listOrderQuery query.List
910 [2]string{"partner_name", "合伙人"}, 915 [2]string{"partner_name", "合伙人"},
911 [2]string{"bonus_status", "支付状态"}, 916 [2]string{"bonus_status", "支付状态"},
912 [2]string{"create_time", "创建时间"}, 917 [2]string{"create_time", "创建时间"},
  918 + [2]string{"sale_date", "销售时间"},
913 [2]string{"partner_bonus", "应收分红"}, 919 [2]string{"partner_bonus", "应收分红"},
914 [2]string{"partner_bonus_has", "已收分红"}, 920 [2]string{"partner_bonus_has", "已收分红"},
915 [2]string{"partner_bonus_not", "未收分红"}, 921 [2]string{"partner_bonus_not", "未收分红"},
@@ -23,12 +23,12 @@ func NewOrderBaseDao(transactionContext *transaction.TransactionContext) (*Order @@ -23,12 +23,12 @@ func NewOrderBaseDao(transactionContext *transaction.TransactionContext) (*Order
23 } 23 }
24 } 24 }
25 25
26 -//CheckOrderUnique 检查订单的是否已存在  
27 -//@companyId 公司id  
28 -//@orderCode 订单号  
29 -//@deliveryCode 发货单号  
30 -//@partnerCategoryCode 合伙人类型编号  
31 -//@goodNames 货品名称列表 26 +// CheckOrderUnique 检查订单的是否已存在
  27 +// @companyId 公司id
  28 +// @orderCode 订单号
  29 +// @deliveryCode 发货单号
  30 +// @partnerCategoryCode 合伙人类型编号
  31 +// @goodNames 货品名称列表
32 func (dao OrderBaseDao) CheckOrderExist(companyId int64, orderCode string, 32 func (dao OrderBaseDao) CheckOrderExist(companyId int64, orderCode string,
33 deliveryCode string, partnerCategory int64, partnerId int64, notId int64, goodNames []string) (bool, error) { 33 deliveryCode string, partnerCategory int64, partnerId int64, notId int64, goodNames []string) (bool, error) {
34 tx := dao.transactionContext.GetDB() 34 tx := dao.transactionContext.GetDB()
@@ -45,12 +45,12 @@ func (dao OrderBaseDao) CheckOrderExist(companyId int64, orderCode string, @@ -45,12 +45,12 @@ func (dao OrderBaseDao) CheckOrderExist(companyId int64, orderCode string,
45 return ok, err 45 return ok, err
46 } 46 }
47 47
48 -//OrderBonusListByCondition 根据条件获取订单分红列表  
49 -//@param orderType 订单类型  
50 -//@param partnerOrCode 合伙人姓名或订单号或发货单号  
51 -//@param companyId 公司id  
52 -//@param partnerCategory 合伙人类型  
53 -//@param createTime 创建时间 48 +// OrderBonusListByCondition 根据条件获取订单分红列表
  49 +// @param orderType 订单类型
  50 +// @param partnerOrCode 合伙人姓名或订单号或发货单号
  51 +// @param companyId 公司id
  52 +// @param partnerCategory 合伙人类型
  53 +// @param createTime 创建时间
54 func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int, partnerOrCode string, 54 func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int, partnerOrCode string,
55 partnerCategory int, createTime [2]string, limit, offset int) ([]models.OrderBase, int, error) { 55 partnerCategory int, createTime [2]string, limit, offset int) ([]models.OrderBase, int, error) {
56 tx := dao.transactionContext.GetDB() 56 tx := dao.transactionContext.GetDB()
@@ -90,7 +90,7 @@ func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int @@ -90,7 +90,7 @@ func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int
90 return orders, cnt, err 90 return orders, cnt, err
91 } 91 }
92 92
93 -//CustomOrderBonusForExcel 导出分红列表所用的结构 93 +// CustomOrderBonusForExcel 导出分红列表所用的结构
94 type CustomOrderBonusForExcel struct { 94 type CustomOrderBonusForExcel struct {
95 OrderId int64 95 OrderId int64
96 OrderType int 96 OrderType int
@@ -99,6 +99,7 @@ type CustomOrderBonusForExcel struct { @@ -99,6 +99,7 @@ type CustomOrderBonusForExcel struct {
99 DeliveryCode string 99 DeliveryCode string
100 UpdateTime string 100 UpdateTime string
101 CreateTime string 101 CreateTime string
  102 + SaleDate string
102 PartnerBonus float64 103 PartnerBonus float64
103 PartnerBonusHas float64 104 PartnerBonusHas float64
104 PartnerBonusNot float64 105 PartnerBonusNot float64
@@ -107,13 +108,13 @@ type CustomOrderBonusForExcel struct { @@ -107,13 +108,13 @@ type CustomOrderBonusForExcel struct {
107 PartnerName string 108 PartnerName string
108 } 109 }
109 110
110 -//OrderBonusListForExcel 导出分红列表所用  
111 -//@param companyId 公司id  
112 -//@param orderType 订单类型  
113 -//@param partnerOrCode 合伙人姓名或订单号或发货单号  
114 -//@param partnerCategory 合伙人类型id  
115 -//@param createTime 订单的创建时间范围"[开始时间,结束时间]" 时间格式"2006-01-02 15:04:05+07"  
116 -//@return result 查询结果数据 111 +// OrderBonusListForExcel 导出分红列表所用
  112 +// @param companyId 公司id
  113 +// @param orderType 订单类型
  114 +// @param partnerOrCode 合伙人姓名或订单号或发货单号
  115 +// @param partnerCategory 合伙人类型id
  116 +// @param createTime 订单的创建时间范围"[开始时间,结束时间]" 时间格式"2006-01-02 15:04:05+07"
  117 +// @return result 查询结果数据
117 func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, partnerOrCode string, 118 func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, partnerOrCode string,
118 partnerCategory int, createTime [2]string) (result []CustomOrderBonusForExcel, err error) { 119 partnerCategory int, createTime [2]string) (result []CustomOrderBonusForExcel, err error) {
119 //导出分红列表所用的sql 120 //导出分红列表所用的sql
@@ -123,8 +124,9 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p @@ -123,8 +124,9 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p
123 t1.order_code, 124 t1.order_code,
124 t1.delivery_code, 125 t1.delivery_code,
125 t1.bonus_status, 126 t1.bonus_status,
126 - to_char(t1.update_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') AS update_time,  
127 - to_char(t1.create_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') AS create_time, 127 + to_char(t1.update_time AT TIME ZONE 'PRC' ,'YYYY-MM-DD HH24:MI:SS') AS update_time,
  128 + to_char(t1.create_time AT TIME ZONE 'PRC' ,'YYYY-MM-DD HH24:MI:SS') AS create_time,
  129 + to_char(t1.sale_date AT TIME ZONE 'PRC' ,'YYYY-MM-DD') AS sale_date,
128 (CASE 130 (CASE
129 WHEN t1.use_partner_bonus>0 131 WHEN t1.use_partner_bonus>0
130 THEN 132 THEN
@@ -183,13 +185,13 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p @@ -183,13 +185,13 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p
183 return result, nil 185 return result, nil
184 } 186 }
185 187
186 -//OrderListByCondition 获取实际订单列表  
187 -//@param companyId 公司id  
188 -//@param orderType 订单类型  
189 -//@param partnerOrCode 合伙人姓名或订单号或发货单号  
190 -//@param partnerCategory 合伙人类型id  
191 -//@param updateTime 订单更新时间范围"[开始时间,结束时间]",时间格式"2006-01-02 15:04:05+07"  
192 -//@param createTime 订单的创建时间范围"[开始时间,结束时间]" 时间格式"2006-01-02 15:04:05+07" 188 +// OrderListByCondition 获取实际订单列表
  189 +// @param companyId 公司id
  190 +// @param orderType 订单类型
  191 +// @param partnerOrCode 合伙人姓名或订单号或发货单号
  192 +// @param partnerCategory 合伙人类型id
  193 +// @param updateTime 订单更新时间范围"[开始时间,结束时间]",时间格式"2006-01-02 15:04:05+07"
  194 +// @param createTime 订单的创建时间范围"[开始时间,结束时间]" 时间格式"2006-01-02 15:04:05+07"
193 func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, partnerName string, orderCode string, deliveryCode string, 195 func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, partnerName string, orderCode string, deliveryCode string,
194 updateTime [2]string, createTime [2]string, saleDate [2]string, partnerCategory int, partnerCategoryName string, limit, offset int) ([]models.OrderBase, int, error) { 196 updateTime [2]string, createTime [2]string, saleDate [2]string, partnerCategory int, partnerCategoryName string, limit, offset int) ([]models.OrderBase, int, error) {
195 tx := dao.transactionContext.GetDB() 197 tx := dao.transactionContext.GetDB()
@@ -252,7 +254,7 @@ func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, par @@ -252,7 +254,7 @@ func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, par
252 254
253 } 255 }
254 256
255 -//CustomOrderListForExcel 导出实际订单列表所用的结构 257 +// CustomOrderListForExcel 导出实际订单列表所用的结构
256 type CustomOrderListForExcel struct { 258 type CustomOrderListForExcel struct {
257 OrderCode string //订单编号 259 OrderCode string //订单编号
258 DeliveryCode string //发货编号 260 DeliveryCode string //发货编号
@@ -72,13 +72,24 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int @@ -72,13 +72,24 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int
72 if data == nil { 72 if data == nil {
73 data = []interface{}{} 73 data = []interface{}{}
74 } 74 }
  75 + // controller.Data["json"] = protocol.ResponseData{
  76 + // Code: 0,
  77 + // Msg: "ok",
  78 + // Data: map[string]map[string]interface{}{
  79 + // "gridResult": map[string]interface{}{
  80 + // "lists": data,
  81 + // "totalRow": totalRow,
  82 + // "pageNumber": pageNumber,
  83 + // },
  84 + // },
  85 + // }
75 controller.Data["json"] = protocol.ResponseData{ 86 controller.Data["json"] = protocol.ResponseData{
76 Code: 0, 87 Code: 0,
77 Msg: "ok", 88 Msg: "ok",
78 Data: map[string]map[string]interface{}{ 89 Data: map[string]map[string]interface{}{
79 - "gridResult": map[string]interface{}{  
80 - "lists": data,  
81 - "totalRow": totalRow, 90 + "grid": {
  91 + "list": data,
  92 + "total": totalRow,
82 "pageNumber": pageNumber, 93 "pageNumber": pageNumber,
83 }, 94 },
84 }, 95 },
@@ -86,7 +97,7 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int @@ -86,7 +97,7 @@ func (controller BaseController) ResponsePageList(data interface{}, totalRow int
86 controller.ServeJSON() 97 controller.ServeJSON()
87 } 98 }
88 99
89 -//Finish 重写 beego.Controller 的Finish 方法 100 +// Finish 重写 beego.Controller 的Finish 方法
90 func (controller *BaseController) Finish() { 101 func (controller *BaseController) Finish() {
91 strByte, _ := json.Marshal(controller.Data["json"]) 102 strByte, _ := json.Marshal(controller.Data["json"])
92 length := len(strByte) 103 length := len(strByte)
@@ -97,7 +108,7 @@ func (controller *BaseController) Finish() { @@ -97,7 +108,7 @@ func (controller *BaseController) Finish() {
97 } 108 }
98 } 109 }
99 110
100 -////Prepare 重写 beego.Controller 的Prepare方法 111 +// //Prepare 重写 beego.Controller 的Prepare方法
101 func (controller *BaseController) Prepare() { 112 func (controller *BaseController) Prepare() {
102 logs.Info("====>Recv Request:", controller.Ctx.Input.URI()) 113 logs.Info("====>Recv Request:", controller.Ctx.Input.URI())
103 if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() { 114 if controller.Ctx.Input.IsPost() || controller.Ctx.Input.IsPut() {