This commit is contained in:
邹宗楠
2023-05-22 14:42:26 +08:00
parent d936e5fc54
commit 784d60912c
3 changed files with 20 additions and 24 deletions

View File

@@ -123,15 +123,13 @@ func (a *Auther) GetUserType() (userType int8) {
return model.UserTypeStoreBoss
}
func GetAPI(authType string) *weixinapi.API {
if authType == AuthTypeWeixin {
return api.WeixinPageAPI
func GetAPI(appID string) *weixinapi.API {
miniApi := api.WeixinMiniAPI
if len(appID) > 0 && appID == api.WeixinMiniAppID2 {
miniApi = api.WeixinMiniAPI2
}
if authType == AuthTypeWxApp {
return api.WeixinApp
if len(appID) > 0 && appID == api.WeixinMiniAppIDsc {
miniApi = api.WeixinMiniAPIsc
}
if authType == AuthTypeWxAppCaishi {
return api.WeixinApp2
}
return api.WeixinAPI
return miniApi
}

View File

@@ -128,18 +128,18 @@ func NotifyPickOrder(order *model.GoodsOrder) (err error) {
order.NotifyType = int(store.SMSNotify)
partner.CurOrderManager.UpdateOrderFields(order, []string{"NotifyType"})
//品牌余额, 一条5分
if order.CreateDeliveryType == model.YES { // 门店发单
noticeType := 0
switch feeType {
case model.BrandBillFeeTypeSms:
noticeType = partner.StoreAcctTypeExpendTextMessageNotify
case model.BrandBillFeeTypeVoice:
noticeType = partner.StoreAcctTypeExpendVoiceMessageNotify
}
err = partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(jxcontext.AdminCtx, store.ID, 5, noticeType, order.VendorOrderID, "", 0)
} else if order.CreateDeliveryType == model.NO { // 品牌发单
err = partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, store.BrandID, 5, model.BrandBillTypeExpend, feeType, order.VendorOrderID, "")
//if order.CreateDeliveryType == model.YES { // 门店发单
noticeType := 0
switch feeType {
case model.BrandBillFeeTypeSms:
noticeType = partner.StoreAcctTypeExpendTextMessageNotify
case model.BrandBillFeeTypeVoice:
noticeType = partner.StoreAcctTypeExpendVoiceMessageNotify
}
err = partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(jxcontext.AdminCtx, store.ID, 5, noticeType, order.VendorOrderID, "", 0)
/*} else if order.CreateDeliveryType == model.NO { // 品牌发单
err = partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, store.BrandID, 5, model.BrandBillTypeExpend, feeType, order.VendorOrderID, "")
}*/
return err
}
balance, _ := partner.CurStoreAcctManager.GetBrandBalance(store.BrandID)

View File

@@ -448,13 +448,11 @@ type DeliveryFee struct {
// GetPlatformDesiredFee 统计平台的订单的配送费信息
func GetPlatformDesiredFee(db *DaoDB, storeIDs []int, finishedAtBegin, finishedAtEnd time.Time) (fee []*DeliveryFee, err error) {
sql := `
SELECT sum(b.actual_fee) actual_fee,b.order_vendor_id vendor_id FROM goods_order t2
RIGHT JOIN waybill b ON t2.vendor_order_id = b.vendor_order_id AND b.status IN (?,?) AND b.vendor_order_id <> b.vendor_waybill_id
SELECT sum(b.desired_fee) actual_fee,b.order_vendor_id vendor_id FROM goods_order t2
RIGHT JOIN waybill b ON t2.vendor_order_id = b.vendor_order_id AND b.vendor_order_id <> b.vendor_waybill_id
WHERE t2.order_finished_at >= ? AND t2.order_finished_at <= ?
`
sqlParams := []interface{}{
model.WaybillStatusDelivered,
110,
finishedAtBegin,
finishedAtEnd,
}