Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -8,7 +8,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/authz"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
@@ -167,6 +170,11 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
t1.operator_phone,
|
||||
t1.printer_disabled,
|
||||
|
||||
t1.market_man_role,
|
||||
t1.operator_role,
|
||||
t1.operator_role2,
|
||||
t1.printer_font_size,
|
||||
|
||||
city.name city_name,
|
||||
district.name district_name,
|
||||
CONCAT('[', GROUP_CONCAT(DISTINCT CONCAT('{"vendorStoreID":"', m1.vendor_store_id, '", "vendorID":', m1.vendor_id,
|
||||
@@ -319,7 +327,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
}
|
||||
|
||||
sql += sqlWhere + `
|
||||
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58
|
||||
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62
|
||||
ORDER BY t1.id DESC
|
||||
/*LIMIT ? OFFSET ?*/`
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
@@ -534,7 +542,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
|
||||
valid := dao.StrictMakeMapByStructObject(payload, store, userName)
|
||||
if globals.EnableWXAuth2 {
|
||||
if err = dao.ValidateRoles(db, utils.Interface2String(valid["marketManRole"]), utils.Interface2String(valid["OperatorRole"])); err != nil {
|
||||
if err = dao.ValidateRoles(db, utils.Interface2String(valid["marketManRole"]), utils.Interface2String(valid["operatorRole"]), utils.Interface2String(valid["operatorRole2"])); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
@@ -653,7 +661,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
globals.SugarLogger.Debugf("UpdateStore track:%s, before call SyncStore", ctx.GetTrackInfo())
|
||||
_, err = CurVendorSync.SyncStore(ctx, db, -1, store.ID, false, userName)
|
||||
if valid["tel1"] != nil {
|
||||
BindMobile2Store(ctx, utils.Interface2String(valid["tel1"]), storeID)
|
||||
AddStoreBossByMoble(ctx, utils.Interface2String(valid["tel1"]), storeID)
|
||||
}
|
||||
if syncStatus&model.SyncFlagStoreAddress != 0 && valid["tel1"] != nil || valid["payeeName"] != nil {
|
||||
updateCourierStores(ctx, storeID)
|
||||
@@ -716,7 +724,7 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if globals.EnableWXAuth2 {
|
||||
if err = dao.ValidateRoles(db, store.MarketManRole, store.OperatorRole); err != nil {
|
||||
if err = dao.ValidateRoles(db, store.MarketManRole, store.OperatorRole, store.OperatorRole2); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
@@ -749,7 +757,7 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
store.ID = existingID
|
||||
if err = dao.CreateEntity(db, store); err == nil {
|
||||
UpdateOrCreateCourierStores(ctx, store.ID, false, false, false)
|
||||
BindMobile2Store(ctx, storeExt.Tel1, storeExt.ID)
|
||||
AddStoreBossByMoble(ctx, storeExt.Tel1, storeExt.ID)
|
||||
return store.ID, err
|
||||
}
|
||||
return 0, err
|
||||
@@ -1739,3 +1747,23 @@ func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, isAsync, isContin
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func AddStoreBossByMoble(ctx *jxcontext.Context, mobile string, storeID int) (num int64, err error) {
|
||||
if mobile != "" {
|
||||
if globals.EnableWXAuth2 {
|
||||
db := dao.GetDB()
|
||||
userList, _, err2 := dao.GetUsers(db, 0, "", nil, "", mobile, 0, 0)
|
||||
globals.SugarLogger.Debugf("AddStoreBossByMoble mobile:%s, userList:%s", mobile, utils.Format4Output(userList, true))
|
||||
if err = err2; err == nil && len(userList) > 0 {
|
||||
if err = AddRoles4User(ctx, userList[0].GetID(), []*authz.RoleInfo{
|
||||
autils.NewRole(authz.StoreRoleBoss, storeID),
|
||||
}); err == nil {
|
||||
num = 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
num, err = BindMobile2Store(ctx, mobile, storeID)
|
||||
}
|
||||
}
|
||||
return num, err
|
||||
}
|
||||
|
||||
@@ -168,8 +168,9 @@ func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, shortRoleNameList
|
||||
sqlParams = append(sqlParams, mobile, mobile)
|
||||
}
|
||||
if len(shortRoleNameList) > 0 {
|
||||
sql += " OR t1.market_man_role IN (" + GenQuestionMarks(len(shortRoleNameList)) + ") OR t1.operator_role IN (" + GenQuestionMarks(len(shortRoleNameList)) + ")"
|
||||
sqlParams = append(sqlParams, shortRoleNameList, shortRoleNameList)
|
||||
questionMarks := GenQuestionMarks(len(shortRoleNameList))
|
||||
sql += " OR t1.market_man_role IN (" + questionMarks + ") OR t1.operator_role IN (" + questionMarks + ") OR t1.operator_role2 IN (" + questionMarks + ")"
|
||||
sqlParams = append(sqlParams, shortRoleNameList, shortRoleNameList, shortRoleNameList)
|
||||
}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " OR t1.id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
|
||||
@@ -435,11 +435,12 @@ func GetStoreList4Role(db *DaoDB, shortRoleName string) (storeList []*model.Stor
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store t1
|
||||
WHERE t1.deleted_at = ? AND (t1.market_man_role = ? OR t1.operator_role = ?)`
|
||||
WHERE t1.deleted_at = ? AND (t1.market_man_role = ? OR t1.operator_role = ? OR t1.operator_role2 = ?)`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
shortRoleName,
|
||||
shortRoleName,
|
||||
shortRoleName,
|
||||
}
|
||||
err = GetRows(db, &storeList, sql, sqlParams...)
|
||||
return storeList, err
|
||||
|
||||
@@ -256,6 +256,7 @@ type Store struct {
|
||||
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
|
||||
|
||||
PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机
|
||||
PrinterFontSize int8 `orm:"default(0)" json:"printerFontSize"` // 打印字体-1:小,0:正常,1:大
|
||||
PrinterVendorID int `orm:"column(printer_vendor_id);" json:"printerVendorID"`
|
||||
PrinterSN string `orm:"size(32);column(printer_sn);index" json:"printerSN"`
|
||||
PrinterKey string `orm:"size(64)" json:"printerKey"`
|
||||
@@ -299,7 +300,8 @@ type Store struct {
|
||||
|
||||
OperatorName string `orm:"size(8)" json:"operatorName"` // 运营人姓名
|
||||
OperatorPhone string `orm:"size(16)" json:"operatorPhone"` // 运营人电话
|
||||
OperatorRole string `orm:"size(32)" json:"operatorRole"` // 运营人组(角色)
|
||||
OperatorRole string `orm:"size(32)" json:"operatorRole"` // 京东运营人组(角色)
|
||||
OperatorRole2 string `orm:"size(32)" json:"operatorRole2"` // 非京东运营人组(角色)
|
||||
}
|
||||
|
||||
func (*Store) TableUnique() [][]string {
|
||||
@@ -309,7 +311,7 @@ func (*Store) TableUnique() [][]string {
|
||||
}
|
||||
|
||||
func (s *Store) IsPrinterDisabled() bool {
|
||||
return s.PrinterDisabled != 0
|
||||
return s.PrinterDisabled == 1
|
||||
}
|
||||
|
||||
func (s *Store) GetOpTimeList() (opTimeList []int16) {
|
||||
|
||||
1
business/partner/printer/feie/feie_test.go
Normal file
1
business/partner/printer/feie/feie_test.go
Normal file
@@ -0,0 +1 @@
|
||||
package feie
|
||||
Reference in New Issue
Block a user