upcrm

package
v0.0.0-...-83adff0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//PayStateUnpay not pay
	PayStateUnpay = 0
	//PayStatePayed payed
	PayStatePayed = 1
)

Variables

View Source
var (
	Day   = time.Hour * 24
	Day3  = Day * 3
	Week  = Day * 7
	Week3 = Week * 3
)

var days

View Source
var (
	//NeedCheckTaskType task type
	NeedCheckTaskType = []int8{
		signmodel.TaskTypeWeek,
		signmodel.TaskTypeMonth,
		signmodel.TaskTypeQuarter,
	}
)

Functions

func GetTaskDuration

func GetTaskDuration(date time.Time, taskType int8) (startDate, endDate time.Time)

GetTaskDuration this will return task duration, [startDate, endDate)

func GetTaskExpireLimit

func GetTaskExpireLimit(today time.Time, taskType int8) (minDate, maxDate time.Time)

GetTaskExpireLimit this will return generate date range that needs to send email

Types

type Dao

type Dao struct {
	// contains filtered or unexported fields
}

Dao upcrm dao

func New

func New(c *conf.Config) *Dao

New new dao

func (*Dao) CheckUpHasValidContract

func (d *Dao) CheckUpHasValidContract(mid int64, date time.Time) (exist bool, err error)

CheckUpHasValidContract check if has valid contract

func (*Dao) Close

func (d *Dao) Close()

Close close resource.

func (*Dao) FinishTask

func (d *Dao) FinishTask(taskType int, now time.Time, state int) (affectedRow int64, err error)

FinishTask finish task

func (*Dao) GetContract

func (d *Dao) GetContract(signID []uint32) (result []signmodel.SignContract, err error)

GetContract get get sign id

func (*Dao) GetDb

func (d *Dao) GetDb() *gorm.DB

GetDb get current gorm db

func (*Dao) GetDuePay

func (d *Dao) GetDuePay(now time.Time, expireAfterDays int) (result []*PayWithAdmin, err error)

GetDuePay check due

func (*Dao) GetDueSignUp

func (d *Dao) GetDueSignUp(now time.Time, expireAfterDays int) (result []*SignWithName, err error)

GetDueSignUp check due expireAfterDays : how many days to expire

func (*Dao) GetDueTask

func (d *Dao) GetDueTask(now time.Time) (result []*TaskWithAdmin, err error)

GetDueTask get due tasks

func (*Dao) GetPay

func (d *Dao) GetPay(signID []uint32) (result []signmodel.SignPay, err error)

GetPay get get sign id

func (*Dao) GetSignUpByID

func (d *Dao) GetSignUpByID(signID []uint32, order string, offset int, limit int, query interface{}, args ...interface{}) (result []signmodel.SignUp, err error)

GetSignUpByID signid 可以是nil,如果是nil,则会取所有的信息 query, args, 额外的查询条件

func (*Dao) GetSignUpCount

func (d *Dao) GetSignUpCount(query string, args ...interface{}) (count int)

GetSignUpCount get sign up's count

func (*Dao) GetTask

func (d *Dao) GetTask(signID []uint32, state ...int) (result []signmodel.SignTask, err error)

GetTask get task by sign id and state

func (*Dao) InsertContractInfo

func (d *Dao) InsertContractInfo(info interface{}) (affectedRow int64, err error)

InsertContractInfo insert contract

func (*Dao) InsertPayInfo

func (d *Dao) InsertPayInfo(info *signmodel.SignPay) (affectedRow int64, err error)

InsertPayInfo inert pay

func (*Dao) InsertSignUp

func (d *Dao) InsertSignUp(up *signmodel.SignUp) (affectedRow int64, err error)

InsertSignUp insert sign up up : sign up

func (*Dao) InsertTaskInfo

func (d *Dao) InsertTaskInfo(info *signmodel.SignTask) (affectedRow int64, err error)

InsertTaskInfo insert task

func (*Dao) PayComplete

func (d *Dao) PayComplete(ids []uint32) (affectedRow int64, err error)

PayComplete finish pay by pay id

func (*Dao) Ping

func (d *Dao) Ping(c context.Context) (err error)

Ping ping success.

func (*Dao) QueryUpBaseInfo

func (d *Dao) QueryUpBaseInfo(mid int64, fields string) (result upcrmmodel.UpBaseInfo, err error)

QueryUpBaseInfo query db

func (*Dao) QueryUpBaseInfoBatchByID

func (d *Dao) QueryUpBaseInfoBatchByID(fields string, id ...int64) (result []upcrmmodel.UpBaseInfo, err error)

QueryUpBaseInfoBatchByID query db

func (*Dao) QueryUpBaseInfoBatchByMid

func (d *Dao) QueryUpBaseInfoBatchByMid(fields string, mid ...int64) (result []upcrmmodel.UpBaseInfo, err error)

QueryUpBaseInfoBatchByMid query db

func (*Dao) SetHTTPClient

func (d *Dao) SetHTTPClient(client *bm.Client)

SetHTTPClient set http client

func (*Dao) StartTask

func (d *Dao) StartTask(taskType int, now time.Time) (affectedRow int64, err error)

StartTask start task

func (*Dao) UpdateEmailState

func (d *Dao) UpdateEmailState(table string, ids []uint32, state int8) (affectedRow int64, err error)

UpdateEmailState update email send state state : @

type PayWithAdmin

type PayWithAdmin struct {
	signmodel.SignPay
	Name      string
	AdminID   int
	AdminName string
}

PayWithAdmin pay with name, used to send mail

func (*PayWithAdmin) GetEndDate

func (s *PayWithAdmin) GetEndDate() string

GetEndDate used for template

func (*PayWithAdmin) GetPayValue

func (s *PayWithAdmin) GetPayValue() float64

GetPayValue for template

type SignWithName

type SignWithName struct {
	signmodel.SignUp
	Name string
}

SignWithName sign with name, used to send mail

func (*SignWithName) GetEndDate

func (s *SignWithName) GetEndDate() string

GetEndDate used for template

type TaskWithAdmin

type TaskWithAdmin struct {
	signmodel.SignTaskHistory
	Name      string
	AdminID   int
	AdminName string
}

TaskWithAdmin task with admin

func (*TaskWithAdmin) EndDate

func (s *TaskWithAdmin) EndDate() xtime.Time

EndDate used for template

func (*TaskWithAdmin) TypeDesc

func (s *TaskWithAdmin) TypeDesc() string

TypeDesc descrption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL