aa
This commit is contained in:
@@ -176,7 +176,7 @@ func Init() {
|
|||||||
}, 5*time.Second, 10*time.Minute)
|
}, 5*time.Second, 10*time.Minute)
|
||||||
|
|
||||||
ScheduleTimerFuncByInterval(func() {
|
ScheduleTimerFuncByInterval(func() {
|
||||||
report.RefreshStoreManageState(jxcontext.AdminCtx)
|
report.RefreshStoreManageState(jxcontext.AdminCtx, nil)
|
||||||
}, 5*time.Second, 20*time.Minute)
|
}, 5*time.Second, 20*time.Minute)
|
||||||
|
|
||||||
ScheduleTimerFuncByInterval(func() {
|
ScheduleTimerFuncByInterval(func() {
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ func GetManageState(ctx *jxcontext.Context, cityCodes []int, vendorID int) (getM
|
|||||||
return getManageStateResult, err
|
return getManageStateResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func RefreshStoreManageState(ctx *jxcontext.Context) {
|
func RefreshStoreManageState(ctx *jxcontext.Context, storeIDs []int) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
vendorIDs = []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI}
|
vendorIDs = []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI}
|
||||||
@@ -398,8 +398,8 @@ func RefreshStoreManageState(ctx *jxcontext.Context) {
|
|||||||
task := tasksch.NewParallelTask("RefreshStoreManageState", tasksch.NewParallelConfig().SetParallelCount(3).SetIsContinueWhenError(true), ctx,
|
task := tasksch.NewParallelTask("RefreshStoreManageState", tasksch.NewParallelConfig().SetParallelCount(3).SetIsContinueWhenError(true), ctx,
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
vendorID := batchItemList[0].(int)
|
vendorID := batchItemList[0].(int)
|
||||||
storeMaps, err := dao.GetStoresMapList(db, []int{vendorID}, nil, []int{model.StoreStatusOpened, model.StoreStatusClosed, model.StoreStatusHaveRest}, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
|
storeMaps, err := dao.GetStoresMapList(db, []int{vendorID}, storeIDs, []int{model.StoreStatusOpened, model.StoreStatusClosed, model.StoreStatusHaveRest}, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
|
||||||
storeManageStates, err := dao.GetStoreManageStateSimple(db, nil, nil, vendorID)
|
storeManageStates, err := dao.GetStoreManageStateSimple(db, storeIDs, nil, vendorID)
|
||||||
var (
|
var (
|
||||||
storeMapsMap = make(map[int]*model.StoreMap)
|
storeMapsMap = make(map[int]*model.StoreMap)
|
||||||
storeManagesMap = make(map[int]*model.StoreManageState)
|
storeManagesMap = make(map[int]*model.StoreManageState)
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package tempop
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/md5"
|
|
||||||
"crypto/sha1"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
"git.rosy.net.cn/jx-callback/business/jxstore/report"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/permission"
|
|
||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -1954,41 +1951,42 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
|||||||
//`
|
//`
|
||||||
//weixinmsg.SmartMessageTemplateSend("oYN_usv1RPvrSxCvo1WsbwI8lZa0", weixinmsg.WX_NEWORDER_TEMPLATE_ID, "", weixinmsg.WX_MINI_TO_ORDER_PAGE_URL+fmt.Sprintf("?jxStoreId=%v&data=%v", storeID, data), nil)
|
//weixinmsg.SmartMessageTemplateSend("oYN_usv1RPvrSxCvo1WsbwI8lZa0", weixinmsg.WX_NEWORDER_TEMPLATE_ID, "", weixinmsg.WX_MINI_TO_ORDER_PAGE_URL+fmt.Sprintf("?jxStoreId=%v&data=%v", storeID, data), nil)
|
||||||
//加门店账号
|
//加门店账号
|
||||||
var (
|
//var (
|
||||||
db = dao.GetDB()
|
// db = dao.GetDB()
|
||||||
user = &model.User{}
|
// user = &model.User{}
|
||||||
)
|
//)
|
||||||
store, _ := dao.GetStoreDetail(db, 668023, model.VendorIDJX, "")
|
//store, _ := dao.GetStoreDetail(db, 668023, model.VendorIDJX, "")
|
||||||
if store.Tel1 != "" {
|
//if store.Tel1 != "" {
|
||||||
if user, _ = dao.GetUserByID(db, "mobile", store.Tel1); err == nil {
|
// if user, _ = dao.GetUserByID(db, "mobile", store.Tel1); err == nil {
|
||||||
if user != nil {
|
// if user != nil {
|
||||||
//bind
|
// //bind
|
||||||
if auths, _ := dao.GetUserBindAuthInfo(db, user.UserID, 0, []string{auth2.AuthTypePassword}, "", "", nil); len(auths) > 0 {
|
// if auths, _ := dao.GetUserBindAuthInfo(db, user.UserID, 0, []string{auth2.AuthTypePassword}, "", "", nil); len(auths) > 0 {
|
||||||
//已经有密码了?
|
// //已经有密码了?
|
||||||
auth := auths[0]
|
// auth := auths[0]
|
||||||
auth.AuthSecret2 = "AA0D5ABE801F11E98489525400AE46A6"
|
// auth.AuthSecret2 = "AA0D5ABE801F11E98489525400AE46A6"
|
||||||
auth.AuthSecret = fmt.Sprintf("%x", sha1.Sum([]byte(fmt.Sprintf("%x", md5.Sum([]byte(store.Tel1)))+auth.AuthSecret2)))
|
// auth.AuthSecret = fmt.Sprintf("%x", sha1.Sum([]byte(fmt.Sprintf("%x", md5.Sum([]byte(store.Tel1)))+auth.AuthSecret2)))
|
||||||
} else {
|
// } else {
|
||||||
auth := &model.AuthBind{
|
// auth := &model.AuthBind{
|
||||||
UserID: user.UserID,
|
// UserID: user.UserID,
|
||||||
Type: auth2.AuthTypePassword,
|
// Type: auth2.AuthTypePassword,
|
||||||
Status: model.YES,
|
// Status: model.YES,
|
||||||
AuthID: user.UserID,
|
// AuthID: user.UserID,
|
||||||
AuthSecret2: "AA0D5ABE801F11E98489525400AE46A6",
|
// AuthSecret2: "AA0D5ABE801F11E98489525400AE46A6",
|
||||||
AuthSecret: fmt.Sprintf("%x", sha1.Sum([]byte(fmt.Sprintf("%x", md5.Sum([]byte(store.Tel1)))+"AA0D5ABE801F11E98489525400AE46A6"))),
|
// AuthSecret: fmt.Sprintf("%x", sha1.Sum([]byte(fmt.Sprintf("%x", md5.Sum([]byte(store.Tel1)))+"AA0D5ABE801F11E98489525400AE46A6"))),
|
||||||
}
|
// }
|
||||||
dao.WrapAddIDCULDEntity(auth, "")
|
// dao.WrapAddIDCULDEntity(auth, "")
|
||||||
dao.CreateEntity(db, auth)
|
// dao.CreateEntity(db, auth)
|
||||||
}
|
// }
|
||||||
user.BindStoreID = store.ID
|
// user.BindStoreID = store.ID
|
||||||
user.BindStoreUser = store.Tel1
|
// user.BindStoreUser = store.Tel1
|
||||||
dao.UpdateEntity(db, user, "BindStoreID", "BindStoreUser")
|
// dao.UpdateEntity(db, user, "BindStoreID", "BindStoreUser")
|
||||||
permission.UpdateUserRole(ctx, []string{user.UserID}, []int{31})
|
// permission.UpdateUserRole(ctx, []string{user.UserID}, []int{31})
|
||||||
} else {
|
// } else {
|
||||||
//注册
|
// //注册
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
report.RefreshStoreManageState(ctx, []int{668023})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user