调整依赖结构,jxutils不依赖于dao,dao依赖于jxutils
This commit is contained in:
@@ -15,12 +15,9 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/baseapi/utils/routinepool"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"git.rosy.net.cn/jx-callback/globals/api2"
|
||||
"github.com/qiniu/api.v7/storage"
|
||||
)
|
||||
|
||||
@@ -457,69 +454,6 @@ func Strings2Objs(strAndObjAddPairs ...interface{}) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err error) {
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
openIDs := []string{}
|
||||
storeID := 0
|
||||
remark := ""
|
||||
|
||||
// if !globals.DisableWXAuth1 {
|
||||
// wxinfo, err := dao.GetUserStoreInfo(db, "tel", mobile)
|
||||
// if err == nil {
|
||||
// openIDs = []string{wxinfo.OpenID}
|
||||
// storeID = wxinfo.JxStoreID
|
||||
// }
|
||||
// }
|
||||
if globals.EnableWXAuth2 {
|
||||
userID := ""
|
||||
if mobileIsUerID {
|
||||
userID = mobile
|
||||
} else {
|
||||
userList, _, err2 := dao.GetUsers(db, model.UserTypeStoreBoss, "", nil, "", mobile, 0, -1)
|
||||
if err = err2; len(userList) > 0 {
|
||||
userID = userList[0].GetID()
|
||||
}
|
||||
}
|
||||
if userID != "" {
|
||||
authBindList, err2 := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", "")
|
||||
if err = err2; err == nil {
|
||||
for _, v := range authBindList {
|
||||
openIDs = append(openIDs, v.AuthID)
|
||||
}
|
||||
}
|
||||
roleList, err2 := api2.RoleMan.GetUserRoleList(userID)
|
||||
if err = err2; err == nil && len(roleList) > 0 {
|
||||
storeID = roleList[0].StoreID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(openIDs) > 0 {
|
||||
if storeID > 0 {
|
||||
store := &model.Store{}
|
||||
store.ID = storeID
|
||||
if err = dao.GetEntity(db, store); err == nil {
|
||||
city := &model.Place{
|
||||
Code: store.CityCode,
|
||||
}
|
||||
if err = dao.GetEntity(db, city, "Code"); err == nil {
|
||||
remark = city.Name + "-" + store.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
if globals.EnableStoreWrite {
|
||||
for _, openID := range openIDs {
|
||||
err = api.WeixinAPI.CBUpdateRemark(openID, remark)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func RefreshOrderSkuRelated(order *model.GoodsOrder) *model.GoodsOrder {
|
||||
order.SkuCount = 0
|
||||
order.GoodsCount = 0
|
||||
@@ -723,14 +657,6 @@ func GetRealMobile4Order(order *model.GoodsOrder) (mobileNumber string) {
|
||||
return mobileNumber
|
||||
}
|
||||
|
||||
func GetAuthType4Vendor(vendorID int) (authType string) {
|
||||
authType = dao.ConvertJsonFieldPrefix(model.VendorNames[vendorID])
|
||||
if authType != "" {
|
||||
authType = "vendor." + authType
|
||||
}
|
||||
return authType
|
||||
}
|
||||
|
||||
func GuessDataResourceVendor(resourceURL string) (vendorID int) {
|
||||
vendorID = -1
|
||||
for tmpVendorID, urlList := range resourceTypeMap {
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"github.com/boombuler/barcode"
|
||||
"github.com/boombuler/barcode/code128"
|
||||
@@ -370,11 +369,19 @@ func IsEmptyID(id int64) bool {
|
||||
}
|
||||
|
||||
func FormalizePageSize(pageSize int) int {
|
||||
return dao.FormalizePageSize(pageSize)
|
||||
if pageSize == 0 {
|
||||
return model.DefPageSize
|
||||
} else if pageSize < 0 {
|
||||
return model.UnlimitedPageSize
|
||||
}
|
||||
return pageSize
|
||||
}
|
||||
|
||||
func FormalizePageOffset(pageSize int) int {
|
||||
return dao.FormalizePageOffset(pageSize)
|
||||
func FormalizePageOffset(offset int) int {
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
return offset
|
||||
}
|
||||
|
||||
func FormalizeName(name string) string {
|
||||
|
||||
Reference in New Issue
Block a user