package entity import ( "errors" . "app.yhyue.com/moapp/jybase/common" . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/db" ) var Base_resource_use = base_resource_use{} //资源充值/消耗表 type base_resource_use struct { Id int Appid string Ent_id int64 //企业id User_id int64 //用户id Function_code string //功能代码 Add_count int //新增数量 Surplus_count int //剩余数量 Deduction_count int //扣除数量 } //查找最新一条的权益使用记录 func (b *base_resource_use) FindLastOneByEntId(appid, function_code string, ent_id int64) (*base_resource_use, error) { list := Mysql_BaseService.SelectBySql(`select * from base_resource_use where appid=? and function_code=? and ent_id=? limit 1`, appid, function_code, ent_id) if list == nil { return nil, errors.New("find error") } if list != nil && len(*list) == 1 { return JsonUnmarshal((*list)[0], &base_resource_use{}).(*base_resource_use), nil } return nil, nil }