aa
This commit is contained in:
@@ -34,39 +34,21 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DayTimeBegin time.Time
|
|
||||||
DayTimeEnd time.Time
|
|
||||||
WeekTimeBegin time.Time
|
|
||||||
WeekTimeEnd time.Time
|
|
||||||
|
|
||||||
JobTimerMap map[int64]*time.Timer
|
JobTimerMap map[int64]*time.Timer
|
||||||
JobAuditTimerMap map[int64]*time.Timer
|
JobAuditTimerMap map[int64]*time.Timer
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
DayTimeBegin = utils.Str2Time(utils.Time2Str(utils.Time2Date(time.Now())) + " 00:00:00")
|
|
||||||
DayTimeEnd = DayTimeBegin.AddDate(0, 0, 1)
|
|
||||||
WeekTimeBegin, WeekTimeEnd = getWeekTime()
|
|
||||||
|
|
||||||
JobTimerMap = make(map[int64]*time.Timer)
|
JobTimerMap = make(map[int64]*time.Timer)
|
||||||
JobAuditTimerMap = make(map[int64]*time.Timer)
|
JobAuditTimerMap = make(map[int64]*time.Timer)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getWeekTime() (weekTimeBegin, weekTimeEnd time.Time) {
|
|
||||||
offset := int(time.Now().Weekday() - 1)
|
|
||||||
if offset == -1 {
|
|
||||||
offset = -6
|
|
||||||
}
|
|
||||||
weekTimeBegin = time.Now().AddDate(0, 0, offset)
|
|
||||||
weekTimeEnd = weekTimeBegin.AddDate(0, 0, 7)
|
|
||||||
return weekTimeBegin, weekTimeEnd
|
|
||||||
}
|
|
||||||
|
|
||||||
func PublishJob(ctx *jxcontext.Context, jobExt *model.JobExt) (errCode string, err error) {
|
func PublishJob(ctx *jxcontext.Context, jobExt *model.JobExt) (errCode string, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
job = &model.Job{}
|
job = &model.Job{}
|
||||||
finishedAt time.Time
|
finishedAt time.Time
|
||||||
|
DayTimeBegin, DayTimeEnd = jxutils.GetDayTime()
|
||||||
)
|
)
|
||||||
//需根据任务类型做一些参数判断,比如门店商品链接,地址
|
//需根据任务类型做一些参数判断,比如门店商品链接,地址
|
||||||
// switch job.JobCategoryID {
|
// switch job.JobCategoryID {
|
||||||
@@ -234,9 +216,11 @@ func GetJobDetail(ctx *jxcontext.Context, jobID int, lng, lat float64) (job *dao
|
|||||||
|
|
||||||
func AcceptJob(ctx *jxcontext.Context, jobID int) (errCode string, err error) {
|
func AcceptJob(ctx *jxcontext.Context, jobID int) (errCode string, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
userID = ctx.GetUserID()
|
userID = ctx.GetUserID()
|
||||||
num int
|
num int
|
||||||
|
DayTimeBegin, DayTimeEnd = jxutils.GetDayTime()
|
||||||
|
WeekTimeBegin, WeekTimeEnd = jxutils.GetWeekTime()
|
||||||
)
|
)
|
||||||
job := &model.Job{}
|
job := &model.Job{}
|
||||||
job.ID = jobID
|
job.ID = jobID
|
||||||
@@ -778,6 +762,7 @@ func CancelJdDelivery(ctx *jxcontext.Context, vendorWaybillID, reason string) (e
|
|||||||
dOrder = &model.DeliveryOrder{
|
dOrder = &model.DeliveryOrder{
|
||||||
VendorWaybillID: vendorWaybillID,
|
VendorWaybillID: vendorWaybillID,
|
||||||
}
|
}
|
||||||
|
DayTimeBegin, DayTimeEnd = jxutils.GetDayTime()
|
||||||
)
|
)
|
||||||
err = dao.GetEntity(db, dOrder, "VendorWaybillID")
|
err = dao.GetEntity(db, dOrder, "VendorWaybillID")
|
||||||
userBill, err := dao.GetUserBill(db, ctx.GetUserID(), "")
|
userBill, err := dao.GetUserBill(db, ctx.GetUserID(), "")
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ import (
|
|||||||
|
|
||||||
func CreateOrder(ctx *jxcontext.Context, orderType int, way string, price int, lng, lat float64) (orderID, errCode string, err error) {
|
func CreateOrder(ctx *jxcontext.Context, orderType int, way string, price int, lng, lat float64) (orderID, errCode string, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
order *model.Order
|
order *model.Order
|
||||||
|
DayTimeBegin, DayTimeEnd = jxutils.GetDayTime()
|
||||||
)
|
)
|
||||||
if err = auth2.CheckWeixinminiAuthBind(ctx.GetUserID()); err != nil {
|
if err = auth2.CheckWeixinminiAuthBind(ctx.GetUserID()); err != nil {
|
||||||
return "", errCode, err
|
return "", errCode, err
|
||||||
|
|||||||
@@ -904,3 +904,19 @@ func GenRandomString(l int) string {
|
|||||||
}
|
}
|
||||||
return string(result)
|
return string(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetDayTime() (dayTimeBegin, dayTimeEnd time.Time) {
|
||||||
|
dayTimeBegin = utils.Str2Time(utils.Time2Str(utils.Time2Date(time.Now())) + " 00:00:00")
|
||||||
|
dayTimeEnd = dayTimeBegin.AddDate(0, 0, 1)
|
||||||
|
return dayTimeBegin, dayTimeEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetWeekTime() (weekTimeBegin, weekTimeEnd time.Time) {
|
||||||
|
offset := int(time.Now().Weekday() - 1)
|
||||||
|
if offset == -1 {
|
||||||
|
offset = -6
|
||||||
|
}
|
||||||
|
weekTimeBegin = time.Now().AddDate(0, 0, offset)
|
||||||
|
weekTimeEnd = weekTimeBegin.AddDate(0, 0, 7)
|
||||||
|
return weekTimeBegin, weekTimeEnd
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user