Commit 1a8193fd authored by chenweijian's avatar chenweijian

发送小助手消息

parent df1468ff
package msg
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/internal/enum/msg_e"
"git.hilo.cn/hilo-common/internal/model/msg_m"
"git.hilo.cn/hilo-common/internal/model/user_m"
"git.hilo.cn/hilo-common/resource/mysql"
)
// 发送小助手消息
func SendLittleAssistantMsg(model *domain.Model, userId mysql.ID, t msg_e.MsgUserRecordType, diamondIncome mysql.Str,
dayNum mysql.Str, propertyUrl mysql.Str, beanNum mysql.Str, groupCode mysql.Str, users ...*user_m.User) (err error) {
var user *user_m.User
if len(users) > 0 {
user = users[0]
} else {
user, err = user_m.GetUser(model, userId)
if err != nil {
model.Log.Errorf("SendLittleAssistantMsg GetUser userId:%v, err:%v", userId, err)
return err
}
}
if err = msg_m.NewUserRecord(model, user.ID, t, user.Nick, user.ID, diamondIncome, dayNum, propertyUrl, beanNum, groupCode).Persistent(); err != nil {
model.Log.Errorf("SendLittleAssistantMsg NewUserRecord err:%v", err)
return err
}
err = msg_m.SendEmasMsgAssistant(model, user.ExternalId, user.DeviceType)
if err != nil {
model.Log.Errorf("SendLittleAssistantMsg SendEmasMsgAssistant userId:%v, err:%v", userId, err)
return err
}
return nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment