|
|
|
@@ -42,6 +42,7 @@ type StoreExt struct {
|
|
|
|
|
|
|
|
|
|
|
|
MarketManName string `orm:"size(8)" json:"marketManName"` // 市场负责人姓名
|
|
|
|
MarketManName string `orm:"size(8)" json:"marketManName"` // 市场负责人姓名
|
|
|
|
OperatorName string `orm:"size(8)" json:"operatorName"` // 运营人姓名
|
|
|
|
OperatorName string `orm:"size(8)" json:"operatorName"` // 运营人姓名
|
|
|
|
|
|
|
|
OperatorName2 string `orm:"size(8)" json:"operatorName2"` // 非京东运营人姓名
|
|
|
|
|
|
|
|
|
|
|
|
FloatLng float64 `json:"lng"`
|
|
|
|
FloatLng float64 `json:"lng"`
|
|
|
|
FloatLat float64 `json:"lat"`
|
|
|
|
FloatLat float64 `json:"lat"`
|
|
|
|
@@ -120,6 +121,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
LEFT JOIN user mm ON mm.mobile <> '' AND mm.mobile = t1.market_man_phone AND mm.deleted_at = ?
|
|
|
|
LEFT JOIN user mm ON mm.mobile <> '' AND mm.mobile = t1.market_man_phone AND mm.deleted_at = ?
|
|
|
|
LEFT JOIN user om ON om.mobile <> '' AND om.mobile = t1.operator_phone AND om.deleted_at = ?
|
|
|
|
LEFT JOIN user om ON om.mobile <> '' AND om.mobile = t1.operator_phone AND om.deleted_at = ?
|
|
|
|
|
|
|
|
LEFT JOIN user om2 ON om2.mobile <> '' AND om2.mobile = t1.operator_phone2 AND om2.deleted_at = ?
|
|
|
|
`
|
|
|
|
`
|
|
|
|
sqlFromParams = []interface{}{
|
|
|
|
sqlFromParams = []interface{}{
|
|
|
|
utils.DefaultTimeValue,
|
|
|
|
utils.DefaultTimeValue,
|
|
|
|
@@ -128,6 +130,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
|
|
|
// utils.DefaultTimeValue,
|
|
|
|
// utils.DefaultTimeValue,
|
|
|
|
utils.DefaultTimeValue,
|
|
|
|
utils.DefaultTimeValue,
|
|
|
|
utils.DefaultTimeValue,
|
|
|
|
utils.DefaultTimeValue,
|
|
|
|
|
|
|
|
utils.DefaultTimeValue,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sqlWhere := `
|
|
|
|
sqlWhere := `
|
|
|
|
WHERE t1.deleted_at = ?
|
|
|
|
WHERE t1.deleted_at = ?
|
|
|
|
@@ -174,20 +177,21 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if keyword != "" {
|
|
|
|
if keyword != "" {
|
|
|
|
keywordLike := "%" + keyword + "%"
|
|
|
|
keywordLike := "%" + keyword + "%"
|
|
|
|
sqlWhere += ` AND (t1.name LIKE ? OR t1.tel1 LIKE ? OR t1.tel2 LIKE ? OR t1.operator_phone LIKE ? OR t1.market_man_phone LIKE ?
|
|
|
|
sqlWhere += ` AND (t1.name LIKE ? OR t1.tel1 LIKE ? OR t1.tel2 LIKE ? OR t1.operator_phone LIKE ? OR t1.operator_phone2 LIKE ? OR t1.market_man_phone LIKE ?
|
|
|
|
OR t1.last_operator LIKE ? OR city.name LIKE ? OR t1.address LIKE ? OR t1.printer_sn LIKE ? OR t1.licence_code LIKE ? OR t1.id_code LIKE ?`
|
|
|
|
OR t1.last_operator LIKE ? OR city.name LIKE ? OR t1.address LIKE ? OR t1.printer_sn LIKE ? OR t1.licence_code LIKE ? OR t1.id_code LIKE ?`
|
|
|
|
sqlWhereParams = append(sqlWhereParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
|
|
|
|
sqlWhereParams = append(sqlWhereParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike,
|
|
|
|
|
|
|
|
keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
|
|
|
|
|
|
|
|
|
|
|
|
if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil {
|
|
|
|
if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil {
|
|
|
|
// if !globals.DisableWXAuth1 && jxutils.IsLegalMobileNumber(keywordInt64) {
|
|
|
|
if true { // jxutils.IsLegalMobileNumber(keywordInt64) {
|
|
|
|
// sql += `
|
|
|
|
sqlWhere += ` OR (
|
|
|
|
// LEFT JOIN weixins wx1 ON t1.id = wx1.jxstoreid AND wx1.parentid = -1 AND wx1.tel = ?
|
|
|
|
SELECT COUNT(*)
|
|
|
|
// LEFT JOIN weixins wx2 ON t1.id = wx2.jxstoreid AND wx2.parentid = -1
|
|
|
|
FROM casbin_rule t11
|
|
|
|
// LEFT JOIN weixins wx3 ON wx3.parentid = wx2.id AND wx3.tel = ?
|
|
|
|
JOIN user t12 ON t12.user_id = t11.v0 AND t12.mobile LIKE ?
|
|
|
|
// `
|
|
|
|
WHERE t11.v1 <> '' AND (t11.v1 = CONCAT(?, t1.id) OR t11.v1 = t1.market_man_role OR t11.v1 = t1.operator_role OR t11.v1 = t1.operator_role2)
|
|
|
|
// sqlParams = append(sqlParams, keywordInt64, keywordInt64)
|
|
|
|
) > 0`
|
|
|
|
// sqlWhere += " OR wx1.id IS NOT NULL OR wx3.id IS NOT NULL"
|
|
|
|
sqlWhereParams = append(sqlWhereParams, keyword+"%", autils.NewStoreBossRole(-1).GetFullName()) // 必须要前缀,不然不能用过些会很慢
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
sqlWhere += " OR t1.id = ? OR t1.city_code = ? OR t1.district_code = ?"
|
|
|
|
sqlWhere += " OR t1.id = ? OR t1.city_code = ? OR t1.district_code = ?"
|
|
|
|
sqlWhereParams = append(sqlWhereParams, keywordInt64, keywordInt64, keywordInt64)
|
|
|
|
sqlWhereParams = append(sqlWhereParams, keywordInt64, keywordInt64, keywordInt64)
|
|
|
|
if jxutils.GuessVendorIDFromVendorStoreID(keywordInt64) != model.VendorIDUnknown {
|
|
|
|
if jxutils.GuessVendorIDFromVendorStoreID(keywordInt64) != model.VendorIDUnknown {
|
|
|
|
@@ -195,7 +199,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
|
|
|
OR (SELECT COUNT(*) FROM store_map tsm WHERE t1.id = tsm.store_id AND tsm.deleted_at = ? AND tsm.vendor_store_id = ?) > 0
|
|
|
|
OR (SELECT COUNT(*) FROM store_map tsm WHERE t1.id = tsm.store_id AND tsm.deleted_at = ? AND tsm.vendor_store_id = ?) > 0
|
|
|
|
OR (SELECT COUNT(*) FROM store_courier_map tsm WHERE t1.id = tsm.store_id AND tsm.deleted_at = ? AND tsm.vendor_store_id = ?) > 0
|
|
|
|
OR (SELECT COUNT(*) FROM store_courier_map tsm WHERE t1.id = tsm.store_id AND tsm.deleted_at = ? AND tsm.vendor_store_id = ?) > 0
|
|
|
|
`
|
|
|
|
`
|
|
|
|
sqlWhereParams = append(sqlWhereParams, utils.DefaultTimeValue, keywordInt64, utils.DefaultTimeValue, keywordInt64)
|
|
|
|
sqlWhereParams = append(sqlWhereParams, utils.DefaultTimeValue, keyword, utils.DefaultTimeValue, keyword)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sqlWhere += ")"
|
|
|
|
sqlWhere += ")"
|
|
|
|
@@ -308,6 +312,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
|
|
|
IF(mm.name <> '', mm.name, mm.user_id2) market_man_name,
|
|
|
|
IF(mm.name <> '', mm.name, mm.user_id2) market_man_name,
|
|
|
|
bank.value payee_bank_name,
|
|
|
|
bank.value payee_bank_name,
|
|
|
|
IF(om.name <> '', om.name, om.user_id2) operator_name,
|
|
|
|
IF(om.name <> '', om.name, om.user_id2) operator_name,
|
|
|
|
|
|
|
|
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2,
|
|
|
|
province.code province_code,
|
|
|
|
province.code province_code,
|
|
|
|
province.name province_name,
|
|
|
|
province.name province_name,
|
|
|
|
city.name city_name,
|
|
|
|
city.name city_name,
|
|
|
|
@@ -323,6 +328,9 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
|
|
|
offset = jxutils.FormalizePageOffset(offset)
|
|
|
|
offset = jxutils.FormalizePageOffset(offset)
|
|
|
|
pageSize = jxutils.FormalizePageSize(pageSize)
|
|
|
|
pageSize = jxutils.FormalizePageSize(pageSize)
|
|
|
|
mapLimit := false
|
|
|
|
mapLimit := false
|
|
|
|
|
|
|
|
// globals.SugarLogger.Debug(sql)
|
|
|
|
|
|
|
|
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
|
|
|
|
|
|
|
|
|
|
|
|
if err = dao.GetRows(db, &storeList, sql, sqlParams...); err == nil {
|
|
|
|
if err = dao.GetRows(db, &storeList, sql, sqlParams...); err == nil {
|
|
|
|
// 地图区域限制过滤
|
|
|
|
// 地图区域限制过滤
|
|
|
|
if mapLongitude2, ok := params["mapLongitude"].(string); ok {
|
|
|
|
if mapLongitude2, ok := params["mapLongitude"].(string); ok {
|
|
|
|
@@ -1546,7 +1554,7 @@ func getAllUsers4Store(ctx *jxcontext.Context, db *dao.DaoDB, store *model.Store
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接电话信息相关人员
|
|
|
|
// 直接电话信息相关人员
|
|
|
|
for _, mobile := range []string{store.Tel1, store.Tel2, store.MarketManPhone, store.OperatorPhone} {
|
|
|
|
for _, mobile := range []string{store.Tel1, store.Tel2, store.MarketManPhone, store.OperatorPhone, store.OperatorPhone2} {
|
|
|
|
if mobile != "" {
|
|
|
|
if mobile != "" {
|
|
|
|
if user, err2 := dao.GetUserByID(db, "mobile", mobile); err2 == nil {
|
|
|
|
if user, err2 := dao.GetUserByID(db, "mobile", mobile); err2 == nil {
|
|
|
|
if userMap[user.GetID()] == 0 {
|
|
|
|
if userMap[user.GetID()] == 0 {
|
|
|
|
|