Selaa lähdekoodia

update

master
dengbiao 1 kuukausi sitten
vanhempi
commit
f9ab5df593
8 muutettua tiedostoa jossa 150 lisäystä ja 4 poistoa
  1. +3
    -3
      cmd_db.bat
  2. +1
    -1
      cmd_implement.bat
  3. +9
    -0
      src/super/dao/user_wx_applet_list_dao.go
  4. +10
    -0
      src/super/dao/wx_open_third_party_app_list_dao.go
  5. +44
    -0
      src/super/implement/user_wx_applet_list_implement.go
  6. +56
    -0
      src/super/implement/wx_open_third_party_app_list_implement.go
  7. +13
    -0
      src/super/model/user_wx_applet_list.go
  8. +14
    -0
      src/super/model/wx_open_third_party_app_list.go

+ 3
- 3
cmd_db.bat Näytä tiedosto

@@ -12,14 +12,14 @@ if "%one%" NEQ "" (
set BasePath="./"
set DBUSER="root"
set DBPSW="Fnuo123com@"
set DBNAME="fnuoos_test1"
set DBNAME="super_advertisement"
set DBHOST="119.23.182.117"
set DBPORT="3306"

del "src\models\%Table%.go"
del "src\model\%Table%.go"

echo start reverse table %Table%

xorm reverse mysql "%DBUSER%:%DBPSW%@tcp(%DBHOST%:%DBPORT%)/%DBNAME%?charset=utf8" %BasePath%/etc/db_tpl %BasePath%/src/models/ %TName%
xorm reverse mysql "%DBUSER%:%DBPSW%@tcp(%DBHOST%:%DBPORT%)/%DBNAME%?charset=utf8" %BasePath%/etc/db_tpl %BasePath%/src/model/ %TName%

echo end

+ 1
- 1
cmd_implement.bat Näytä tiedosto

@@ -7,7 +7,7 @@ REM 假设已经提供了文件名作为参数
set "FileName=%~1"

REM 将参数设置最终文件名
set "FinalFile=%BasePath%src\implement\%FileName%_db.go"
set "FinalFile=%BasePath%src\implement\%FileName%_implement.go"

REM 将文件名转换成大驼峰格式并设置成最终实现类名
for /f "delims=" %%i in ('powershell -File "%BasePath%etc\ps\ConvertToUpperCase.ps1" -inputString "%FileName%"') do set "ImplementName=%%i"


+ 9
- 0
src/super/dao/user_wx_applet_list_dao.go Näytä tiedosto

@@ -0,0 +1,9 @@
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"

type UserWxAppletListDao interface {
GetUserWxAppletListByAppId(appid string) (m *model.UserWxAppletList, err error)
UserWxAppletListInsert(m *model.UserWxAppletList) (int64, error)
UpdateUserWxAppletList(m *model.UserWxAppletList, columns ...string) (int64, error)
}

+ 10
- 0
src/super/dao/wx_open_third_party_app_list_dao.go Näytä tiedosto

@@ -0,0 +1,10 @@
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"

type WxOpenThirdPartyAppListDao interface {
GetWxOpenThirdPartyAppList(masterId int) (m *model.WxOpenThirdPartyAppList, err error)
GetWxOpenThirdPartyAppListByAppId(appid string) (m *model.WxOpenThirdPartyAppList, err error)
WxOpenThirdPartyAppListInsert(m *model.WxOpenThirdPartyAppList) (int64, error)
UpdateWxOpenThirdPartyAppList(m *model.WxOpenThirdPartyAppList, columns ...string) (int64, error)
}

+ 44
- 0
src/super/implement/user_wx_applet_list_implement.go Näytä tiedosto

@@ -0,0 +1,44 @@
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
"xorm.io/xorm"
)

func NewUserWxAppletListDb(engine *xorm.Engine) dao.UserWxAppletListDao {
return &UserWxAppletListDb{Db: engine}
}

type UserWxAppletListDb struct {
Db *xorm.Engine
}

func (u UserWxAppletListDb) GetUserWxAppletListByAppId(appid string) (m *model.UserWxAppletList, err error) {
m = new(model.UserWxAppletList)
has, err := u.Db.Where("appid =?", appid).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (u UserWxAppletListDb) UserWxAppletListInsert(m *model.UserWxAppletList) (int64, error) {
insertAffected, err := u.Db.InsertOne(m)
if err != nil {
return 0, err
}
return insertAffected, nil
}

func (u UserWxAppletListDb) UpdateUserWxAppletList(m *model.UserWxAppletList, columns ...string) (int64, error) {
affected, err := u.Db.Where("id =?", m.Id).Cols(columns...).Update(m)
if err != nil {
return 0, err
}
return affected, nil
}

+ 56
- 0
src/super/implement/wx_open_third_party_app_list_implement.go Näytä tiedosto

@@ -0,0 +1,56 @@
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
"xorm.io/xorm"
)

func NewWxOpenThirdPartyAppListDb(engine *xorm.Engine) dao.WxOpenThirdPartyAppListDao {
return &WxOpenThirdPartyAppListDb{Db: engine}
}

type WxOpenThirdPartyAppListDb struct {
Db *xorm.Engine
}

func (w WxOpenThirdPartyAppListDb) GetWxOpenThirdPartyAppListByAppId(appid string) (m *model.WxOpenThirdPartyAppList, err error) {
m = new(model.WxOpenThirdPartyAppList)
has, err := w.Db.Where("appid =?", appid).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (w WxOpenThirdPartyAppListDb) GetWxOpenThirdPartyAppList(masterId int) (m *model.WxOpenThirdPartyAppList, err error) {
m = new(model.WxOpenThirdPartyAppList)
has, err := w.Db.Where("uuid =?", masterId).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (w WxOpenThirdPartyAppListDb) WxOpenThirdPartyAppListInsert(m *model.WxOpenThirdPartyAppList) (int64, error) {
insertAffected, err := w.Db.InsertOne(m)
if err != nil {
return 0, err
}
return insertAffected, nil
}

func (w WxOpenThirdPartyAppListDb) UpdateWxOpenThirdPartyAppList(m *model.WxOpenThirdPartyAppList, columns ...string) (int64, error) {
affected, err := w.Db.Where("id =?", m.Id).Cols(columns...).Update(m)
if err != nil {
return 0, err
}
return affected, nil
}

+ 13
- 0
src/super/model/user_wx_applet_list.go Näytä tiedosto

@@ -0,0 +1,13 @@
package model

type UserWxAppletList struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"not null default '' comment('小程序名称') VARCHAR(255)"`
Logo string `json:"logo" xorm:"not null default '' comment('小程序logo') VARCHAR(255)"`
Appid string `json:"appid" xorm:"not null default '' comment('授权小程序appid') VARCHAR(255)"`
AuthorizerRefreshToken string `json:"authorizer_refresh_token" xorm:"not null default '' comment('授权更新token') VARCHAR(255)"`
IsAuth int `json:"is_auth" xorm:"not null default 0 comment('是否已授权 1已授权 0未授权') TINYINT(1)"`
Uuid string `json:"uuid" xorm:"not null default '' comment('站长id') unique VARCHAR(255)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 14
- 0
src/super/model/wx_open_third_party_app_list.go Näytä tiedosto

@@ -0,0 +1,14 @@
package model

type WxOpenThirdPartyAppList struct {
Id int `json:"id" xorm:"not null pk autoincr unique(IDX_UUID_TYPE) INT(11)"`
Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(10)"`
Token string `json:"token" xorm:"not null default '' comment('消息校验Token') VARCHAR(255)"`
AesKey string `json:"aes_key" xorm:"not null default '' comment('消息加解密Key') VARCHAR(255)"`
Appid string `json:"appid" xorm:"not null default '' comment('appid') CHAR(50)"`
AppSecret string `json:"app_secret" xorm:"not null default '' comment('appSecret') VARCHAR(255)"`
ComponentVerifyTicket string `json:"component_verify_ticket" xorm:"not null default '' comment('验证票据') VARCHAR(255)"`
ComponentAccessToken string `json:"component_access_token" xorm:"not null default '' comment('接口令牌') VARCHAR(255)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

Ladataan…
Peruuta
Tallenna