123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- package raffle
- import (
- "zhiyuan/models"
- "zhiyuan/pkg/db"
- "github.com/gin-gonic/gin"
- )
- type RaffleRecord struct {
- ID int64 `json:"id" prop:"add:false"`
- UserId int64 `json:"user_id" type:"int" prop:"add" search:"="`
- RaffleId int64 `json:"raffle_id" type:"int" prop:"add" search:"="`
- ItemId int64 `json:"item_id" type:"int" prop:"add" search:"="`
- Name string `json:"name" label:"姓名" type:"string" prop:"edit" search:"like"`
- Phone string `json:"phone" label:"电话" type:"string" prop:"edit" search:"like"`
- DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"`
- CreatedAt int64 `json:"created_at" prop:"add:false select:false"`
- UpdatedAt int64 `json:"updated_at" prop:"add:false select:false"`
- db.BaseModel
- }
- func (RaffleRecord) TableName() string {
- return "zy_raffle_record"
- }
- func (model RaffleRecord) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
- return true
- }
- func (RaffleRecord) OnePrivilege(c *gin.Context, id int64) bool {
- return true
- }
- func (RaffleRecord) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error {
- return nil
- }
- func (RaffleRecord) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error {
- return nil
- }
- func (RaffleRecord) DelPrivilege(c *gin.Context, id int64) error {
- return nil
- }
- func (RaffleRecord) Page() bool {
- return false
- }
- func (RaffleRecord) Count() bool {
- return true
- }
- type RaffleItemRecord struct {
- ID int64 `json:"id" prop:"add:false"`
- UserId int64 `json:"user_id" type:"int" prop:"add" search:"="`
- RaffleId int64 `json:"raffle_id" type:"int" prop:"add" search:"="`
- ItemId int64 `json:"item_id" type:"int" prop:"add" search:"="`
- Name string `json:"name" label:"奖品名称" type:"string" prop:"select:item.name"`
- Picture string `json:"picture" label:"图片" type:"string" prop:"select:item.picture"`
- Winning int64 `json:"winning" label:"是否中奖" type:"int" prop:"select:item.winning" search:"="`
- DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"`
- CreatedAt int64 `json:"created_at" prop:"add:false select:false"`
- UpdatedAt int64 `json:"updated_at" prop:"add:false select:false"`
- db.BaseModel
- }
- func (RaffleItemRecord) TableName() string {
- return "zy_raffle_record"
- }
- func (model RaffleItemRecord) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
- return true
- }
- func (RaffleItemRecord) OnePrivilege(c *gin.Context, id int64) bool {
- return true
- }
- func (RaffleItemRecord) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error {
- return nil
- }
- func (RaffleItemRecord) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error {
- return nil
- }
- func (RaffleItemRecord) DelPrivilege(c *gin.Context, id int64) error {
- return nil
- }
- func (RaffleItemRecord) Page() bool {
- return false
- }
- func (RaffleItemRecord) Count() bool {
- return true
- }
- func (model RaffleItemRecord) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel {
- return []db.JoinModel{{
- Model: RaffleItem{},
- As: "item",
- On: []string{"`item`.`id` = " + model.TableName() + ".`item_id`"},
- }}
- }
- type RaffleRecords struct {
- ID int64 `json:"id" prop:"add:false"`
- UserId int64 `json:"user_id" type:"int" prop:"add" search:"="`
- RaffleId int64 `json:"raffle_id" type:"int" prop:"add" search:"="`
- ItemId int64 `json:"item_id" type:"int" prop:"add" search:"="`
- Name string `json:"name" label:"姓名" type:"string" prop:"edit" search:"like"`
- Phone string `json:"phone" label:"电话" type:"string" prop:"edit" search:"like"`
- Nickname string `json:"nickname" label:"昵称" type:"string" prop:"select:user.nickname" search:"like"`
- Headimgurl string `json:"headimgurl" label:"头像" type:"string" prop:"select:user.headimgurl"`
- ItemName string `json:"item_name" label:"奖品名称" type:"string" prop:"select:item.name"`
- ItemPicture string `json:"item_picture" label:"图片" type:"string" prop:"select:item.picture"`
- Winning int64 `json:"winning" label:"是否中奖" type:"int" prop:"select:item.winning" search:"="`
- DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"`
- CreatedAt int64 `json:"created_at" prop:"add:false"`
- UpdatedAt int64 `json:"updated_at" prop:"add:false select:false"`
- db.BaseModel
- }
- func (RaffleRecords) TableName() string {
- return "zy_raffle_record"
- }
- func (model RaffleRecords) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
- return true
- }
- func (RaffleRecords) OnePrivilege(c *gin.Context, id int64) bool {
- return true
- }
- func (RaffleRecords) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error {
- return nil
- }
- func (RaffleRecords) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error {
- return nil
- }
- func (RaffleRecords) DelPrivilege(c *gin.Context, id int64) error {
- return nil
- }
- func (RaffleRecords) Page() bool {
- return false
- }
- func (RaffleRecords) Count() bool {
- return true
- }
- func (model RaffleRecords) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel {
- return []db.JoinModel{{
- Model: RaffleItem{},
- As: "item",
- On: []string{"`item`.`id` = " + model.TableName() + ".`item_id`"},
- }, {
- Model: models.WeixinUser{},
- As: "user",
- On: []string{"`user`.`id` = " + model.TableName() + ".`user_id`"},
- }}
- }
|