Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-09-09 15:38:32 +08:00
27 changed files with 334 additions and 126 deletions

View File

@@ -16,12 +16,12 @@ const (
type AuthBind struct {
ModelIDCULD
UserID string `orm:"size(48);column(user_id)" json:"userID"`
AuthID string `orm:"size(48);column(auth_id)" json:"authID"`
BindType int8 `json:"bindType"`
Type string `orm:"size(16)" json:"type"`
Status int8 `json:"status"`
AuthID string `orm:"size(48);column(auth_id)" json:"authID"`
UserID string `orm:"size(48);column(user_id);index" json:"userID"`
Status int8 `json:"status"`
AuthID2 string `orm:"size(48);column(auth_id2);index" json:"authID2"`
AuthSecret string `orm:"size(48)" json:"-"`
AuthSecret2 string `orm:"size(48)" json:"-"`
@@ -31,7 +31,7 @@ type AuthBind struct {
func (*AuthBind) TableUnique() [][]string {
return [][]string{
[]string{"UserID", "Type", "DeletedAt"},
[]string{"AuthID", "Type", "DeletedAt"},
// []string{"UserID", "Type", "DeletedAt"}, // 这个其实UserID是属性而不是key
[]string{"AuthID", "Type", "BindType", "DeletedAt"},
}
}

View File

@@ -7,41 +7,27 @@ import (
"git.rosy.net.cn/jx-callback/business/model"
)
func GetAuthBind(db *DaoDB, userID string, bindType int, authType, authID string) (authBind *model.AuthBind, err error) {
if userID == "" && authID == "" {
return nil, errors.New("userID, authID, authID2不能全为空")
func GetAuthBind(db *DaoDB, bindType int, authType, authID string) (authBind *model.AuthBind, err error) {
if bindType == model.AuthBindTypeAll || authType == "" || authID == "" {
return nil, errors.New("bindType不是能all, authType和authID都要有值")
}
sql := `
SELECT *
FROM auth_bind t1
WHERE t1.deleted_at = ? AND t1.status = ?
`
WHERE t1.deleted_at = ? AND t1.status = ? AND t1.bind_type = ? AND t1.type = ? AND t1.auth_id = ?`
sqlParams := []interface{}{
utils.DefaultTimeValue,
model.AuthBindStatusNormal,
}
if userID != "" {
sql += " AND t1.user_id = ?"
sqlParams = append(sqlParams, userID)
}
if bindType != model.AuthBindTypeAll {
sql += " AND t1.bind_type = ?"
sqlParams = append(sqlParams, bindType)
}
if authType != "" {
sql += " AND t1.type = ?"
sqlParams = append(sqlParams, authType)
}
if authID != "" {
sql += " AND t1.auth_id = ?"
sqlParams = append(sqlParams, authID)
bindType,
authType,
authID,
}
// globals.SugarLogger.Debugf("GetAuthBind sql:%s, sqlParams:%s", sql, utils.Format4Output(sqlParams, false))
err = GetRow(db, &authBind, sql, sqlParams...)
return authBind, err
}
func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, authID2 string, typeList []string) (authList []*model.AuthBind, err error) {
func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []string, authID, authID2 string) (authList []*model.AuthBind, err error) {
sql := `
SELECT *
FROM auth_bind t1
@@ -58,14 +44,18 @@ func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, authID2 string,
sql += " AND t1.bind_type = ?"
sqlParams = append(sqlParams, bindType)
}
if authID2 != "" {
sql += " AND t1.auth_id2 = ?"
sqlParams = append(sqlParams, authID2)
}
if len(typeList) > 0 {
sql += " AND t1.type IN (" + GenQuestionMarks(len(typeList)) + ")"
sqlParams = append(sqlParams, typeList)
}
if authID != "" {
sql += " AND t1.auth_id = ?"
sqlParams = append(sqlParams, authID)
}
if authID2 != "" {
sql += " AND t1.auth_id2 = ?"
sqlParams = append(sqlParams, authID2)
}
err = GetRows(db, &authList, sql, sqlParams...)
return authList, err

View File

@@ -27,6 +27,7 @@ type GoodsOrder struct {
SalePrice int64 `json:"salePrice"` // 售卖价
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
TotalShopMoney int64 `json:"totalShopMoney"` // 应结金额-第三方平台结算给京西的金额(包括了所有的补贴,扣除)
DiscountMoney int64 `json:"discountMoney"` // 订单总优惠金额
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴1+
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 商户承担的远距离配送费(当前只有京东到家有值)
WaybillTipMoney int64 `json:"waybillTipMoney"` // 京西加的平台配送小费
@@ -55,6 +56,7 @@ type GoodsOrder struct {
DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"`
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排
AdjustCount int8 `json:"adjustCount"` // 调整单(次数)
DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送
DuplicatedCount int `json:"-"` // 重复新订单消息数这个一般不是由于消息重发造成的消息重发由OrderStatus过滤一般是业务逻辑造成的
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)