huangjiajun 1 月之前
父節點
當前提交
d9358adc7a
共有 7 個文件被更改,包括 167 次插入0 次删除
  1. +69
    -0
      app/agent/hdl/hdl_store.go
  2. +1
    -0
      app/db/model/community_team_order.go
  3. +3
    -0
      app/hdl/hdl_order.go
  4. +3
    -0
      app/router/router.go
  5. +63
    -0
      app/store/hdl/hdl_store.go
  6. +27
    -0
      app/svc/svc_order.go
  7. +1
    -0
      app/svc/svc_store_order.go

+ 69
- 0
app/agent/hdl/hdl_store.go 查看文件

@@ -9,6 +9,7 @@ import (
"applet/app/svc"
"applet/app/utils"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"time"
)
@@ -160,6 +161,74 @@ func UserStoreOrder(c *gin.Context) {
}
e.OutSuc(c, res, nil)
}
func UserStoreOrderPay(c *gin.Context) {
var arg map[string]string
if err := c.ShouldBindJSON(&arg); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
user := svc.GetUser(c)
str := "ctpo.parent_uid=" + utils.IntToStr(user.Info.Uid) + " and ctpo.state=1"
if arg["uid"] != "" {
str += " and ctpo.uid=" + arg["uid"]
}
if arg["store_id"] != "" {
str += " and ctpo.store_uid=" + arg["store_id"]
}
if arg["store_name"] != "" {
str += " and cts.name like '%" + arg["store_name"] + "%'"
}
if arg["phone"] != "" {
str += " and u.phone like '%" + arg["phone"] + "%'"
}
if arg["oid"] != "" {
str += " and ctpo.oid like '%" + arg["oid"] + "%'"
}
if arg["start_time"] != "" {
str += " and ctpo.pay_at>='" + arg["start_time"] + "'"
}
if arg["end_time"] != "" {
str += " and ctpo.pay_at<='" + arg["end_time"] + "'"
}

sql := `select ctpo.pay_at,ctpo.oid,cts.name,u.phone,ctpo.uid,ctpo.amount,ctpo.agent_commission,ctpo.platform_commission from community_team_pay_order ctpo
LEFT JOIN user u on u.uid=ctpo.uid
LEFT JOIN community_team_store cts on cts.uid=ctpo.store_uid
where %s order by ctpo.pay_at desc %s`
size := utils.StrToInt(arg["size"])
start := (utils.StrToInt(arg["p"]) - 1) * size
sql = fmt.Sprintf(sql, str, "limit "+utils.IntToStr(start)+","+utils.IntToStr(size))
nativeString, _ := db.QueryNativeString(svc.MasterDb(c), sql)
list := make([]map[string]string, 0)
for _, v := range nativeString {
tmp := map[string]string{
"time": v["pay_at"],
"name": v["name"],
"amount": v["amount"],
"phone": v["phone"],
"uid": v["uid"],
"agent_commission": v["agent_commission"],
"oid": v["oid"],
}
list = append(list, tmp)
}
sql1 := `select COUNT(*) as count from community_team_pay_order ctpo
LEFT JOIN user u on u.uid=ctpo.uid
where %s `
sql = fmt.Sprintf(sql, str)
nativeString1, _ := db.QueryNativeString(svc.MasterDb(c), sql1)
total := 0
for _, v := range nativeString1 {
total = utils.StrToInt(v["count"])
}
res := map[string]interface{}{
"total": total,
"list": list,
}

e.OutSuc(c, res, nil)
return
}

// UserStoreOrderDetail 门店订单详情-订单管理共用一个
// @Summary 门店-门店订单详情


+ 1
- 0
app/db/model/community_team_order.go 查看文件

@@ -14,6 +14,7 @@ type CommunityTeamOrder struct {
CouponId int `json:"coupon_id" xorm:"default 0 comment('') INT(11)"`
Address string `json:"address" xorm:"comment('详细地址') VARCHAR(255)"`
Commission string `json:"commission" xorm:"default 0.00 comment('分佣(元)') DECIMAL(20,2)"`
TableNum string `json:"table_num" xorm:"default 0.00 comment('分佣(元)') varchar(255)"`
AgentCommission string `json:"agent_commission" xorm:"default 0.00 comment('分佣(元)') DECIMAL(20,2)"`
PlatformCommission string `json:"platform_commission" xorm:"default 0.00 comment('分佣(元)') DECIMAL(20,2)"`
CreateAt time.Time `json:"create_at" xorm:"DATETIME"`


+ 3
- 0
app/hdl/hdl_order.go 查看文件

@@ -14,6 +14,9 @@ func OrderCreate(c *gin.Context) {
func PayOrderCreate(c *gin.Context) {
svc.PayOrderCreate(c)
}
func PayOrderList(c *gin.Context) {
svc.PayOrderList(c)
}
func OrderCoupon(c *gin.Context) {
svc.OrderCoupon(c)
}


+ 3
- 0
app/router/router.go 查看文件

@@ -67,6 +67,7 @@ func routeCommunityTeamAgent(r *gin.RouterGroup) {
r.POST("/store/list", agentHdl.UserStoreList)
r.POST("/store/save", agentHdl.UserStoreSave)
r.POST("/store/order", agentHdl.UserStoreOrder)
r.POST("/store/order/pay", agentHdl.UserStoreOrderPay)
r.POST("/store/order/detail", agentHdl.UserStoreOrderDetail)
r.POST("/store/total", agentHdl.UserStoreTotal)

@@ -109,6 +110,7 @@ func routeCommunityTeamOwnStore(r *gin.RouterGroup) {
r.GET("/audit/info", storeHdl.AuditInfo)
r.POST("/audit/doing", storeHdl.AuditDoing)
r.POST("/store/order", storeHdl.UserStoreOrder)
r.POST("/store/order/pay", storeHdl.UserStoreOrderPay)
r.POST("/store/order/detail", storeHdl.UserStoreOrderDetail)
r.POST("/store/order/confirm", storeHdl.StoreOrderConfirm)
r.GET("/store/amount/base", storeHdl.StoreAmountBase)
@@ -170,6 +172,7 @@ func routeCommunityTeam(r *gin.RouterGroup) {
r.GET("/order/cate", hdl.OrderCate)
r.POST("/pay/:payMethod/:orderType", hdl.Pay)
r.POST("/pay/order/create", hdl.PayOrderCreate)
r.POST("/pay/order/list", hdl.PayOrderList)
r.POST("/store/order/list", hdl.StoreOrderList)
r.POST("/store/order/detail", hdl.StoreOrderDetail)
r.POST("/store/order/confirm", hdl.StoreOrderConfirm)


+ 63
- 0
app/store/hdl/hdl_store.go 查看文件

@@ -9,6 +9,7 @@ import (
"applet/app/svc"
"applet/app/utils"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"github.com/tidwall/gjson"
"time"
@@ -133,6 +134,7 @@ func UserStoreOrder(c *gin.Context) {
"agent_commission": v.AgentCommission,
"platform_commission": v.PlatformCommission,
"commission": v.Commission,
"table_num": v.TableNum,
"state": utils.IntToStr(v.State),
"create_at": v.CreateAt.Format("2006-01-02 15:04:05"),
"confirm_at": utils.Int64ToStr(v.Oid),
@@ -164,6 +166,67 @@ func UserStoreOrder(c *gin.Context) {
}
e.OutSuc(c, res, nil)
}
func UserStoreOrderPay(c *gin.Context) {
var arg map[string]string
if err := c.ShouldBindJSON(&arg); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
user := svc.GetUser(c)
str := "ctpo.store_uid=" + utils.IntToStr(user.Info.Uid) + " and ctpo.state=1"
if arg["uid"] != "" {
str += " and ctpo.uid=" + arg["uid"]
}
if arg["phone"] != "" {
str += " and u.phone like '%" + arg["phone"] + "%'"
}
if arg["oid"] != "" {
str += " and ctpo.oid like '%" + arg["oid"] + "%'"
}
if arg["start_time"] != "" {
str += " and ctpo.pay_at>='" + arg["start_time"] + "'"
}
if arg["end_time"] != "" {
str += " and ctpo.pay_at<='" + arg["end_time"] + "'"
}

sql := `select ctpo.pay_at,ctpo.oid,u.phone,ctpo.uid,ctpo.amount,ctpo.agent_commission,ctpo.platform_commission from community_team_pay_order ctpo
LEFT JOIN user u on u.uid=ctpo.uid
where %s order by ctpo.pay_at desc %s`
size := utils.StrToInt(arg["size"])
start := (utils.StrToInt(arg["p"]) - 1) * size
sql = fmt.Sprintf(sql, str, "limit "+utils.IntToStr(start)+","+utils.IntToStr(size))
nativeString, _ := db.QueryNativeString(svc.MasterDb(c), sql)
list := make([]map[string]string, 0)
for _, v := range nativeString {
tmp := map[string]string{
"time": v["pay_at"],
"amount": v["amount"],
"phone": v["phone"],
"uid": v["uid"],
"agent_commission": v["agent_commission"],
"platform_commission": v["platform_commission"],
"oid": v["oid"],
}
list = append(list, tmp)
}
sql1 := `select COUNT(*) as count from community_team_pay_order ctpo
LEFT JOIN user u on u.uid=ctpo.uid
where %s `
sql = fmt.Sprintf(sql, str)
nativeString1, _ := db.QueryNativeString(svc.MasterDb(c), sql1)
total := 0
for _, v := range nativeString1 {
total = utils.StrToInt(v["count"])
}
res := map[string]interface{}{
"total": total,
"list": list,
}

e.OutSuc(c, res, nil)
return
}

// UserStoreOrderDetail 门店订单详情-订单管理共用一个
// @Summary 门店-门店订单详情


+ 27
- 0
app/svc/svc_order.go 查看文件

@@ -471,6 +471,33 @@ func OrderConfirm(c *gin.Context) {
e.OutSuc(c, "success", nil)
return
}
func PayOrderList(c *gin.Context) {
var arg map[string]string
if err := c.ShouldBindJSON(&arg); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
sql := `select ctpo.pay_at,ctpo.oid,cts.name,ctpo.amount from community_team_pay_order ctpo
LEFT JOIN community_team_store cts on cts.uid=ctpo.store_uid
where ctpo.uid=%d and ctpo.state=1 order by ctpo.pay_at desc %s`
size := 10
start := (utils.StrToInt(arg["p"]) - 1) * size
user := GetUser(c)
sql = fmt.Sprintf(sql, user.Info.Uid, "limit "+utils.IntToStr(start)+","+utils.IntToStr(size))
nativeString, _ := db.QueryNativeString(MasterDb(c), sql)
list := make([]map[string]string, 0)
for _, v := range nativeString {
tmp := map[string]string{
"time": v["pay_at"],
"name": v["name"],
"amount": v["amount"],
"oid": v["oid"],
}
list = append(list, tmp)
}
e.OutSuc(c, list, nil)
return
}
func PayOrderCreate(c *gin.Context) {
var arg map[string]string
if err := c.ShouldBindJSON(&arg); err != nil {


+ 1
- 0
app/svc/svc_store_order.go 查看文件

@@ -104,6 +104,7 @@ func StoreOrderList(c *gin.Context) {
"commission": v.Commission,
"username": nickname,
"head_img": headImg,
"table_num": v.TableNum,
"amount": v.Amount,
"num": utils.IntToStr(v.Num),
"down_time": downTime,


Loading…
取消
儲存