base_function.go 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. package entity
  2. import (
  3. . "app.yhyue.com/moapp/jybase/common"
  4. . "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/db"
  5. )
  6. var Base_function = base_function{}
  7. //功能原始表
  8. type base_function struct {
  9. Id int64
  10. Appid string
  11. Name string //功能名称
  12. Code string //功能代码
  13. Status int64 //0:不可用 1:可用
  14. Haspower int64 //能否生成用户权益;0:否 1:是
  15. Version string //版本号
  16. Function_type int64 //1:消耗型(比如:信息发布,需要扣减) 2:固额型(比如:关注条数,不需要扣减) 3:配额型(比如:搜索结果条数)
  17. Power_rule int64 //校验权限规则;1:仅周期 2:周期+数量 3:周期+频率+数量
  18. Power_type int64 //权限类型;1:互斥 2:兼容
  19. }
  20. //根据代码查找功能详情
  21. func (b *base_function) FindByCode(appid, code string) *base_function {
  22. list := Mysql_BaseService.SelectBySql(`select * from base_function where appid=? and code=? and status=1 limit 1`, appid, code)
  23. if list != nil && len(*list) == 1 {
  24. return JsonUnmarshal((*list)[0], &base_function{}).(*base_function)
  25. }
  26. return nil
  27. }