func (p *Login) createNewSession(login *entity.Login, tx *sql.Tx, ctx *df.Context) *entity.Session { uuid := uuid.New() session := entity.CreateSession() session.SetUuid(uuid) session.SetLoginId(df.CreateNullInt64(login.GetId())) bhv.SessionBhv_I.Insert(session, tx, ctx) return session }
func CreateScript(login *entity.Login, script []string) []string { slist := new(df.StringList) slist.Add("<script>") slist.Add("if (!(window[\"$c\"] != null)) {window[\"$c\"] = {};}") slist.Add("$c.login = {};") slist.Add("$c.login.uid = " + strconv.Itoa(int(login.GetId())) + ";") slist.Add("$c.login.name = '" + login.GetName() + "';") for _, s := range script { slist.Add(s) } slist.Add("</script>\n") return slist.GetAsArray() }
func (p *Login) getDelFlagMaxValue(entityx *entity.Login) int64 { cb := cb.CreateLoginCB() cb.Query().SetLoginId_Equal(entityx.GetLoginId()) cb.Query().AddOrderBy_DelFlag_Desc() cb.FetchFirst(1) res, err := bhv.LoginBhv_I.SelectList(cb, p.tx) if err != nil { panic(err.Error()) } if res.AllRecordCount == 1 { return (res.List.Get(0)).(*entity.Login).GetDelFlag() } panic("DelFlag Max not found") return 1 }
func (p *Login) DupCheck(entity *entity.Login) bool { cbx := cb.CreateLoginCB() cbx.Query().SetDelFlag_Equal(0) cbx.Query().SetLoginId_Equal(entity.GetLoginId()) res, err := bhv.LoginBhv_I.SelectList(cbx, p.tx) if err != nil { panic(err.Error()) } return res.AllRecordCount > 0 }
func (p *Login) createLoginInfo(login *entity.Login) map[string]interface{} { rmap := make(map[string]interface{}) rmap["uid"] = login.GetId() rmap["name"] = login.GetName() return rmap }
func (p *Login) convertPassword(entity *entity.Login) { if entity.IsModifiedProperty("password") { entity.SetPassword(dfweb.CreateMd5(entity.GetPassword())) } }
func CreateContextFromLogin(proc string, login *entity.Login) *df.Context { ctx := df.CreateContext() ctx.Put("Process", proc) ctx.Put("User", login.GetLoginId()) return ctx }