create_group.go 654 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
	"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() {
chenweijian's avatar
chenweijian committed
21
			userId = 8350311
chenweijian's avatar
chenweijian committed
22
		}
chenweijian's avatar
chenweijian committed
23
		err := group_s.NewGroupService(model.MyContext).CreateGroupMulByUid(userId, 1000, 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()
}