aa
This commit is contained in:
@@ -1571,8 +1571,10 @@ func (s *DefScheduler) ProxyCancelWaybill(order *model.GoodsOrder, bill *model.W
|
|||||||
if err = s.CancelWaybill(bill, cancelReasonID, cancelReason); err != nil {
|
if err = s.CancelWaybill(bill, cancelReasonID, cancelReason); err != nil {
|
||||||
partner.CurOrderManager.OnOrderMsg(order, "取消三方运单失败", err.Error())
|
partner.CurOrderManager.OnOrderMsg(order, "取消三方运单失败", err.Error())
|
||||||
} else {
|
} else {
|
||||||
if storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, order.VendorOrgCode); storeDetail != nil {
|
if cancelReasonID != partner.CancelWaybillReasonNotAcceptIntime {
|
||||||
s.reverseBrandAccount(storeDetail, bill)
|
if storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, order.VendorOrgCode); storeDetail != nil {
|
||||||
|
s.reverseBrandAccount(storeDetail, bill)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package secretNumber
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
"github.com/alibabacloud-go/dyplsapi-20170525/client"
|
"github.com/alibabacloud-go/dyplsapi-20170525/client"
|
||||||
"github.com/alibabacloud-go/tea/tea"
|
"github.com/alibabacloud-go/tea/tea"
|
||||||
@@ -193,3 +195,48 @@ func UnbindSubscription(poolKey, subsId, phoneNoX string) (err error) {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SecretNumberMsgRes struct {
|
||||||
|
PhoneNo string `json:"phone_no"`
|
||||||
|
PoolKey string `json:"pool_key"`
|
||||||
|
City string `json:"city"`
|
||||||
|
SubID int64 `json:"sub_id"`
|
||||||
|
UnconnectedCause int `json:"unconnected_cause"`
|
||||||
|
CallTime string `json:"call_time"`
|
||||||
|
CallOutTime string `json:"call_out_time"`
|
||||||
|
PeerNo string `json:"peer_no"`
|
||||||
|
CalledDisplayNo string `json:"called_display_no"`
|
||||||
|
ReleaseDir int `json:"release_dir"`
|
||||||
|
RingTime string `json:"ring_time"`
|
||||||
|
CallID string `json:"call_id"`
|
||||||
|
StartTime string `json:"start_time"`
|
||||||
|
CallStatus string `json:"call_status"`
|
||||||
|
FreeRingTime string `json:"free_ring_time"`
|
||||||
|
PartnerKey string `json:"partner_key"`
|
||||||
|
ControlMsg string `json:"control_msg"`
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
SecretNo string `json:"secret_no"`
|
||||||
|
CallType int `json:"call_type"`
|
||||||
|
ReleaseCause int `json:"release_cause"`
|
||||||
|
ControlType string `json:"control_type"`
|
||||||
|
ReleaseTime string `json:"release_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CallbackBrandBill(res *SecretNumberMsgRes) (err error) {
|
||||||
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
)
|
||||||
|
if brands, _ := dao.GetBrands(db, "", 0, res.PoolKey); len(brands) > 0 {
|
||||||
|
if brandID := brands[0].ID; brandID != 0 {
|
||||||
|
price := utils.Float64TwoInt(utils.Str2Time(res.ReleaseTime).Sub(utils.Str2Time(res.StartTime)).Minutes()+1) * 6
|
||||||
|
if err = partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, brandID, price, model.BrandBillTypeExpend, model.BrandBillFeeTypeSecretNumber, ""); err == nil {
|
||||||
|
//计算余额,小于10就解绑
|
||||||
|
balance, _ := partner.CurStoreAcctManager.GetBrandBalance(brandID)
|
||||||
|
if balance < model.BrandBalanceLimit {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/secretNumber"
|
"git.rosy.net.cn/jx-callback/business/jxstore/secretNumber"
|
||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@@ -990,7 +990,7 @@ func GetStoreAuditPage(db *DaoDB, statuss []int, keyword string, applyTimeStart,
|
|||||||
return pagedInfo, err
|
return pagedInfo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetBrands(db *DaoDB, name string, brandID int) (brands []*model.Brand, err error) {
|
func GetBrands(db *DaoDB, name string, brandID int, poolKey string) (brands []*model.Brand, err error) {
|
||||||
sql := `
|
sql := `
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM brand
|
FROM brand
|
||||||
@@ -1007,6 +1007,10 @@ func GetBrands(db *DaoDB, name string, brandID int) (brands []*model.Brand, err
|
|||||||
sql += " AND id = ?"
|
sql += " AND id = ?"
|
||||||
sqlParams = append(sqlParams, brandID)
|
sqlParams = append(sqlParams, brandID)
|
||||||
}
|
}
|
||||||
|
if poolKey != "" {
|
||||||
|
sql += " AND secret_number_pool_key = ?"
|
||||||
|
sqlParams = append(sqlParams, poolKey)
|
||||||
|
}
|
||||||
err = GetRows(db, &brands, sql, sqlParams)
|
err = GetRows(db, &brands, sql, sqlParams)
|
||||||
return brands, err
|
return brands, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,12 @@ const (
|
|||||||
BrandBillTypeIncome = 1 //收入
|
BrandBillTypeIncome = 1 //收入
|
||||||
BrandBillTypeExpend = 2 //支出
|
BrandBillTypeExpend = 2 //支出
|
||||||
|
|
||||||
BrandBillFeeTypeSys = 1 //系统划入
|
BrandBillFeeTypeSys = 1 //系统划入
|
||||||
BrandBillFeeTypeCharge = 2 //人工充值
|
BrandBillFeeTypeCharge = 2 //人工充值
|
||||||
BrandBillFeeTypeSms = 3 //短信费用
|
BrandBillFeeTypeSms = 3 //短信费用
|
||||||
BrandBillFeeTypeVoice = 4 //语音费用
|
BrandBillFeeTypeVoice = 4 //语音费用
|
||||||
BrandBillFeeTypeDelivery = 5 //三方配送费
|
BrandBillFeeTypeDelivery = 5 //三方配送费
|
||||||
|
BrandBillFeeTypeSecretNumber = 6 //隐私号电话
|
||||||
|
|
||||||
BrandOpenMTPS = 1 //品牌开关标志, 美团配送
|
BrandOpenMTPS = 1 //品牌开关标志, 美团配送
|
||||||
BrandOpenDaDa = 2 //达达
|
BrandOpenDaDa = 2 //达达
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"encoding/json"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxstore/secretNumber"
|
||||||
"github.com/astaxie/beego/server/web"
|
"github.com/astaxie/beego/server/web"
|
||||||
|
"io/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AliApiController struct {
|
type AliApiController struct {
|
||||||
@@ -16,7 +18,16 @@ type CallBack struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *AliApiController) SecretNumberMsg() {
|
func (c *AliApiController) SecretNumberMsg() {
|
||||||
fmt.Println(utils.Format4Output(c.Ctx.Request, true))
|
data, _ := ioutil.ReadAll(c.Ctx.Request.Body)
|
||||||
|
values, _ := utils.HTTPBody2Values(data, false)
|
||||||
|
mapData := utils.URLValues2Map(values)
|
||||||
|
//东西在key上
|
||||||
|
var res *secretNumber.SecretNumberMsgRes
|
||||||
|
for k, _ := range mapData {
|
||||||
|
if err := json.Unmarshal([]byte(k), &res); err == nil {
|
||||||
|
secretNumber.CallbackBrandBill(res)
|
||||||
|
}
|
||||||
|
}
|
||||||
c.Data["json"] = &CallBack{
|
c.Data["json"] = &CallBack{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
Msg: "成功",
|
Msg: "成功",
|
||||||
|
|||||||
Reference in New Issue
Block a user