create_group.go 647 Bytes
Newer Older
chenweijian's avatar
chenweijian committed
1 2 3 4 5 6
package group_cron

import (
	"git.hilo.cn/hilo-common/domain"
	"git.hilo.cn/hilo-common/resource/config"
	"github.com/robfig/cron"
chenweijian's avatar
chenweijian committed
7
	"hilo-group/_const/enum/group_e"
chenweijian's avatar
chenweijian committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
	"hilo-group/domain/service/group_s"
)

func CreateGroup() {
	if !config.IsMaster() {
		return
	}
	c := cron.New()
	spec := "0 6 15 3 8 ?"
	_ = c.AddFunc(spec, func() {
		var model = domain.CreateModelNil()
		userId := uint64(7687)
		if config.AppIsRelease() {
			userId = 41
		}
chenweijian's avatar
chenweijian committed
23
		err := group_s.NewGroupService(model.MyContext).CreateGroupMulByUid(userId, 10, group_e.TwoMicNumType)
chenweijian's avatar
chenweijian committed
24 25 26 27 28 29 30
		if err != nil {
			model.Log.Errorf("CreateGroupMulByUid fail:%v", err)
		}
	})

	c.Start()
}