first commit

This commit is contained in:
Yangtao
2025-11-18 17:48:20 +08:00
commit 6e56cab848
196 changed files with 65809 additions and 0 deletions

125
pkg/req/abstract.go Normal file
View File

@ -0,0 +1,125 @@
package req
import (
"servicebase/pkg/constant"
"servicebase/pkg/tools"
"errors"
"github.com/gin-gonic/gin"
)
const (
defaultPage = 1
defaultSize = 10
)
type Page struct {
Page int64 `json:"page" form:"page" uri:"page"`
Size int64 `json:"size" form:"size" uri:"size"`
}
func (p *Page) check() {
if p.Page < 1 {
p.Page = defaultPage
}
if p.Size == 0 {
p.Size = defaultSize
} else if p.Size < 0 {
p.Size = 9999
}
}
func (p *Page) Check() error {
p.check()
return nil
}
func (p *Page) Offset() int {
p.check()
return int(p.Page*p.Size - p.Size)
}
func (p *Page) Limit() int {
p.check()
return int(p.Size)
}
func TID(c *gin.Context) string {
return c.GetHeader(constant.TenantId)
}
func SID(c *gin.Context) string {
return c.GetHeader(constant.ScopeId)
}
func UID(c *gin.Context) string {
return c.GetHeader(tools.HeaderUserId)
}
func CLI(c *gin.Context) string {
return c.GetHeader(tools.HeaderClient)
}
type BaseQuery struct {
IndustryID string `json:"industry_id" form:"industry_id" uri:"industry_id"`
PeriodID string `json:"period_id" form:"period_id" uri:"period_id"`
CityID string `json:"city_id" form:"city_id" uri:"city_id"`
ProvinceID string `json:"province_id" form:"province_id" uri:"province_id"`
RiskLevel string `json:"risk_level" form:"risk_level" uri:"risk_level"`
}
type KeyBody struct {
Key string `json:"key" form:"key" uri:"key"`
}
type IDBody struct {
ID string `json:"id" form:"id" uri:"id"` // put方法时通常为url参数post方法时通常为json参数
}
type ID32Body struct {
ID int32 `json:"id" form:"id" uri:"id"` // put方法时通常为url参数post方法时通常为json参数
}
func (d IDBody) Check() error {
if len(d.ID) == 0 {
return errors.New("ID不能为空")
}
return nil
}
type ClanIDBody struct {
ClanID string `json:"clan_id" form:"clan_id" uri:"clan_id"` // put方法时通常为url参数post方法时通常为json参数
}
func (d ClanIDBody) Check() error {
if len(d.ClanID) == 0 {
return errors.New("家ID不能为空")
}
return nil
}
type AreaIDBody struct {
IDBody
KeyBody
AreaID string `json:"area_id" form:"area_id" uri:"area_id"`
}
type TenantUserLoginBody struct {
Username string `json:"username"`
Password string `json:"password"`
}
type TenantUserUpdatePwdBody struct {
Pre string `json:"pre"`
New string `json:"new"`
}
type PageWithKeyBody struct {
Page
KeyBody
}
type PageWithIDBody struct {
Page
IDBody
}

15
pkg/req/admin_act.go Normal file
View File

@ -0,0 +1,15 @@
package req
import "servicebase/pkg/datasource/fields"
type News struct {
ID string `gorm:"column:id;type:char(32);not null;uniqueIndex:id,priority:1;comment:业务ID" json:"id"` // 业务ID
TypeID string `gorm:"column:type_id;type:char(32);not null;comment:类型" json:"type_id"` // 类型
Title string `gorm:"column:title;type:varchar(255);not null;comment:标题" json:"title"` // 标题
HeadImg string `gorm:"column:head_img;type:varchar(255);not null;comment:头图" json:"head_img"` // 头图
Content string `gorm:"column:content;type:longtext;not null;comment:内容:富文本" json:"content"` // 内容:富文本
Sort int32 `gorm:"column:sort;type:int;not null;default:999;comment:排序" json:"sort"` // 排序
Position int32 `gorm:"column:position;type:int;not null;default:1;comment:位置1=列表 2=banner" json:"position"` // 位置1=列表 2=banner
State int32 `gorm:"column:state;type:int;not null;default:1;comment:状态1=启用 2=禁用" json:"state"` // 状态1=启用 2=禁用
NewsDate fields.Time `gorm:"column:news_date;type:datetime;not null;comment:新闻时间" json:"news_date"` // 新闻时间
}

90
pkg/req/admin_system.go Normal file
View File

@ -0,0 +1,90 @@
package req
import (
"errors"
"servicebase/pkg/datasource/fields"
)
type SystemSettingPageReq struct {
Page
}
type DashboardBasicReq struct {
Date *fields.Date
}
type SystemSettingAddReq struct {
Name string `json:"name"` // 配置名称
Key string `json:"key"` // 配置Key
Value string `json:"value"` // 配置值
Desc string `json:"desc"` // 描述说明
Ext string `json:"ext"` // 扩展信息
}
func (d *SystemSettingAddReq) Check() error {
if len(d.Name) == 0 {
return errors.New("名称不能为空")
}
if len(d.Key) == 0 {
return errors.New("配置Key不能为空")
}
return nil
}
type SystemSettingUpdateReq struct {
IDBody
SystemSettingAddReq
}
func (d *SystemSettingUpdateReq) Check() error {
if len(d.ID) == 0 {
return errors.New("ID不能为空")
}
if len(d.Name) == 0 {
return errors.New("名称不能为空")
}
if len(d.Key) == 0 {
return errors.New("配置Key不能为空")
}
return nil
}
type AdminSystemContentPageReq struct {
Page
}
type AdminSystemContentAddReq struct {
Name string `json:"name"` // 配置名称
Key string `json:"key"` // 配置Key
Value string `json:"value"` // 配置值
Desc string `json:"desc"` // 描述说明
Ext string `json:"ext"` // 扩展信息
}
func (d *AdminSystemContentAddReq) Check() error {
if len(d.Name) == 0 {
return errors.New("名称不能为空")
}
if len(d.Key) == 0 {
return errors.New("配置Key不能为空")
}
return nil
}
type AdminSystemContentUpdateReq struct {
IDBody
AdminSystemContentAddReq
}
func (d *AdminSystemContentUpdateReq) Check() error {
if len(d.ID) == 0 {
return errors.New("ID不能为空")
}
if len(d.Name) == 0 {
return errors.New("名称不能为空")
}
if len(d.Key) == 0 {
return errors.New("配置Key不能为空")
}
return nil
}

6
pkg/req/admin_trade.go Normal file
View File

@ -0,0 +1,6 @@
package req
type GameSkinPageReq struct {
PageWithKeyBody
GameName string `json:"game_name"`
}

227
pkg/req/app_user.go Normal file
View File

@ -0,0 +1,227 @@
package req
import (
"errors"
"servicebase/pkg/datasource/fields"
)
// 登录请求对象
type SignInRequest struct {
Email string `json:"email"`
Password string `json:"password"`
}
func (req *SignInRequest) CheckParameter() (err error) {
if len(req.Email) == 0 || len(req.Password) == 0 {
err = errors.New("邮箱和密码不能为空")
return
}
return nil
}
// 注册请求对象
type SignUpRequest struct {
UserType string `json:"userType"`
Truename string `json:"truename"`
Nickname string `json:"nickname"`
Password string `json:"password"`
Phone string `json:"phone"`
Email string `json:"email"`
BirthYear string `json:"birthYear"`
BirthMonth string `json:"birthMonth"`
BirthDay string `json:"birthday"`
Gender string `json:"gender"`
Position string `json:"position"`
PostCode string `json:"postCode"`
Prefecture string `json:"prefecture"`
Address string `json:"address"`
Building string `json:"building"`
InvoiceType string `json:"invoiceType"`
InvoiceNo string `json:"invoiceNo"`
}
func (req *SignUpRequest) CheckParameter() (err error) {
if len(req.UserType) == 0 {
err = errors.New("用户类型不能为空")
return
}
if req.UserType == "P" {
if len(req.InvoiceType) == 0 {
err = errors.New("开发票类型不能为空")
return
}
}
if len(req.Truename) == 0 {
err = errors.New("真实姓名不能为空")
return
}
if len(req.Nickname) == 0 {
err = errors.New("昵称不能为空")
return
}
if len(req.Password) == 0 {
err = errors.New("密码不能为空")
return
}
if len(req.Phone) == 0 {
err = errors.New("手机号不能为空")
return
}
if len(req.Email) == 0 {
err = errors.New("邮箱不能为空")
return
}
if len(req.BirthYear) == 0 {
err = errors.New("出生年不能为空")
return
}
if len(req.BirthMonth) == 0 {
err = errors.New("出生月不能为空")
return
}
if len(req.BirthDay) == 0 {
err = errors.New("出生日不能为空")
return
}
if len(req.Gender) == 0 {
err = errors.New("性别不能为空")
return
}
if len(req.Position) == 0 {
err = errors.New("职位不能为空")
return
}
if len(req.PostCode) == 0 {
err = errors.New("邮编不能为空")
return
}
if len(req.Prefecture) == 0 {
err = errors.New("省不能为空")
return
}
if len(req.Address) == 0 {
err = errors.New("地址不能为空")
return
}
return nil
}
type ReportAllReq struct {
Date fields.Date `json:"date" form:"date" uri:"date"`
}
// 登录请求对象
type UserInfoUpdateReq struct {
// UserType string `gorm:"column:user_type;type:char(1);not null;comment:P=person C= crop" json:"user_type"`
Truename string `gorm:"column:truename;type:varchar(60);not null" json:"truename"`
Nickname string `gorm:"column:nickname;type:varchar(60);not null" json:"nickname"`
Phone string `gorm:"column:phone;type:varchar(20);not null" json:"phone"`
Email string `gorm:"column:email;type:varchar(100);not null;uniqueIndex:EMAIL_idx,priority:1" json:"email"`
Birthday string `gorm:"column:birthday;type:varchar(20);not null" json:"birthday"`
Gender string `gorm:"column:gender;type:char(1);not null" json:"gender"`
Position string `gorm:"column:position;type:varchar(100);not null" json:"position"`
PostCode string `gorm:"column:post_code;type:varchar(20);not null" json:"post_code"`
Prefecture string `gorm:"column:prefecture;type:varchar(100);not null" json:"prefecture"`
Address string `gorm:"column:address;type:varchar(255);not null" json:"address"`
Building string `gorm:"column:building;type:varchar(100);not null" json:"building"`
InvoiceType string `gorm:"column:invoice_type;type:char(1);not null;comment:发票类型 1=可开 2=不可开" json:"invoice_type"`
InvoiceNo string `gorm:"column:invoice_no;type:varchar(50);not null;comment:发票编号" json:"invoice_no"`
AccountBank string `gorm:"column:account_bank;type:varchar(255);not null;comment:开户银行" json:"account_bank"`
AccountBranch string `gorm:"column:account_branch;type:varchar(255);not null;comment:开户支行" json:"account_branch"`
AccountType string `gorm:"column:account_type;type:char(1);not null;comment:账户类型 1= 普通預金 2=当座預金" json:"account_type"`
AccountNo string `gorm:"column:account_no;type:varchar(100);not null;comment:银行账号" json:"account_no"`
AccountName string `gorm:"column:account_name;type:varchar(100);not null;comment:开户人姓名" json:"account_name"`
PersonalDocType string `gorm:"column:personal_doc_type;type:char(1);not null;comment:1=居民票的复印件2=驾驶证3=护照4=保险证5=在留卡" json:"personal_doc_type"`
PersonalImage string `gorm:"column:personal_image;type:varchar(255);not null;comment:身份证照片" json:"personal_image"`
PersonalEndDate string `gorm:"column:personal_end_date;type:varchar(255);not null;comment:身份证有效期" json:"personal_end_date"`
PersonalImage2 string `gorm:"column:personal_image_2;type:varchar(255);not null;comment:身份证照片" json:"personal_image_2"`
}
func (req *UserInfoUpdateReq) Check() (err error) {
if len(req.Email) == 0 {
err = errors.New("邮箱不能为空")
return
}
return nil
}
type UserPwdUpdateReq struct {
PrePassowrd string `json:"pre_password"`
NewPassowrd string `json:"new_password"`
}
func (req *UserPwdUpdateReq) Check() (err error) {
if len(req.NewPassowrd) == 0 {
err = errors.New("新密码不能为空")
return
}
return nil
}
type UserLogOffReq struct {
Passowrd string `json:"password"`
}
func (req *UserLogOffReq) Check() (err error) {
if len(req.Passowrd) == 0 {
err = errors.New("密码不能为空")
return
}
return nil
}
type UserPwdResetReq struct {
Email string `json:"email"`
}
func (req *UserPwdResetReq) Check() (err error) {
if len(req.Email) == 0 {
err = errors.New("邮箱不能为空")
return
}
return nil
}
type UserPwdResetCommitReq struct {
Code string `json:"code"` // 邮件中url的代码
NewPassword string `json:"new_password"` // 新密码
}
func (req *UserPwdResetCommitReq) Check() (err error) {
if len(req.NewPassword) == 0 {
err = errors.New("新密码不能为空")
return
}
return nil
}
type UserActiveReq struct {
UserId string `json:"userId" uri:"userId"` // 邮件中url的代码
}
func (req *UserActiveReq) Check() (err error) {
if len(req.UserId) == 0 {
err = errors.New("不能为空")
return
}
return nil
}
type AppUserAddApplyList struct {
Page
ClanIDBody
Direct string `json:"direct"` // send 发出的申请 receive 收到的申请
}
func (req *AppUserAddApplyList) Check() (err error) {
req.Page.check()
// if err = req.ClanIDBody.Check(); err != nil {
// return
// }
return nil
}

115
pkg/req/app_user_clan.go Normal file
View File

@ -0,0 +1,115 @@
package req
import (
"errors"
)
type AppClanCreate struct {
Nickname string `gorm:"column:nickname;type:varchar(64);not null;comment:昵称" json:"nickname"`
Sign string `gorm:"column:sign;type:varchar(255);not null;comment:签名" json:"sign"`
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"`
}
func (req *AppClanCreate) Check() (err error) {
if len(req.Nickname) == 0 {
err = errors.New("名称不能为空")
return
}
return nil
}
type AppClanUpdate struct {
IDBody
Nickname string `gorm:"column:nickname;type:varchar(64);not null;comment:昵称" json:"nickname"`
Sign string `gorm:"column:sign;type:varchar(255);not null;comment:签名" json:"sign"`
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"`
}
func (req *AppClanUpdate) Check() (err error) {
if len(req.Nickname) == 0 {
err = errors.New("名称不能为空")
return
}
return nil
}
type AppClanMemberApplyList struct {
Page
ClanIDBody
Direct string `json:"direct"` // send 发出的申请 receive 收到的申请
}
func (req *AppClanMemberApplyList) Check() (err error) {
req.Page.check()
// if err = req.ClanIDBody.Check(); err != nil {
// return
// }
return nil
}
type AppClanMemberInvite struct {
ClanID string `json:"clan_id"`
UserID string `json:"user_id"`
Message string `json:"message"`
}
func (req *AppClanMemberInvite) Check() (err error) {
if len(req.ClanID) == 0 {
err = errors.New("家不能为空")
return
}
if len(req.UserID) == 0 {
err = errors.New("用户ID不能为空")
return
}
return nil
}
type AppClanMemberInviteAccept struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberInviteAccept) Check() (err error) {
return req.IDBody.Check()
}
type AppClanMemberInviteRefuse struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberInviteRefuse) Check() (err error) {
return req.IDBody.Check()
}
type AppClanMemberApply struct {
ClanID string `json:"clan_id"`
Message string `json:"message"`
}
func (req *AppClanMemberApply) Check() (err error) {
if len(req.ClanID) == 0 {
err = errors.New("家不能为空")
return
}
return nil
}
type AppClanMemberApplyAccept struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberApplyAccept) Check() (err error) {
return req.IDBody.Check()
}
type AppClanMemberApplyRefuse struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberApplyRefuse) Check() (err error) {
return req.IDBody.Check()
}

View File

@ -0,0 +1,68 @@
package req
import "errors"
type AppUserAuthReq struct {
Code string `json:"code" form:"code" uri:"code"`
No string `json:"no" form:"no" uri:"no"`
Pwd string `json:"pwd" form:"pwd" uri:"pwd"`
}
func (d AppUserAuthReq) Check() error {
if len(d.Code) == 0 {
return errors.New("code不能为空")
}
return nil
}
type AppUserRegisterReq struct {
Nickname string `json:"nickname" form:"nickname" uri:"nickname"`
Avatar string `json:"avatar" form:"avatar" uri:"avatar"`
Sex int32 `json:"sex" form:"sex" uri:"sex"` // 1=男 2=女
Mobile string `json:"mobile" form:"mobile" uri:"mobile"`
}
func (d AppUserRegisterReq) Check() error {
return nil
}
type AppUserRealAuthByIDCardReq struct {
Avatar string `json:"avatar" form:"avatar" uri:"avatar"`
IDCard string `json:"id_card" form:"id_card" uri:"id_card"`
RealName string `json:"real_name" form:"real_name" uri:"real_name"`
Gender int32 `json:"gender" form:"gender" uri:"gender"`
Mobile string `json:"mobile" form:"mobile" uri:"mobile"`
// ImageFront string `json:"image_front" form:"image_front" uri:"image_front"`
// ImageBack string `json:"image_back" form:"image_back" uri:"image_back"`
// ImageOnHand string `json:"image_on_hand" form:"image_on_hand" uri:"image_on_hand"`
}
func (d AppUserRealAuthByIDCardReq) Check() error {
return nil
}
type AppUserRealAuthByIDCardVerifyReq struct {
RealAuthID string `json:"real_auth_id" form:"real_auth_id" uri:"real_auth_id"`
Code string `json:"code" form:"code" uri:"code"`
}
func (d AppUserRealAuthByIDCardVerifyReq) Check() error {
return nil
}
type AppUserComplainAddReq struct {
// 投诉单号 问题分类 提交日期 提交人 具体内容 状态
Type string `json:"type"` // 类型DRIVER=司机 VEHICLE=车辆 ORDER=订单 COMPANY=公司 OTHER=其他
Content string `json:"content"` // 投诉类型
Mobile string `json:"mobile"` // 联系方式
Desc string `json:"desc"` // 更多说明
}
type AppUserComplainUpdateReq struct {
IDBody
// 投诉单号 问题分类 提交日期 提交人 具体内容 状态
Type string `json:"type"` // 类型DRIVER=司机 VEHICLE=车辆 ORDER=订单 COMPANY=公司 OTHER=其他
Content string `json:"content"` // 投诉类型
Mobile string `json:"mobile"` // 联系方式
Desc string `json:"desc"` // 更多说明
}

View File

@ -0,0 +1,66 @@
package req
type CategoryListReq struct {
KeyBody
ParentID *string `json:"parent_id" form:"parent_id" uri:"parent_id"`
}
func (d *CategoryListReq) Check() error {
return nil
}
type ShopListReq struct {
KeyBody
}
func (d *ShopListReq) Check() error {
return nil
}
type CommodityListReq struct {
KeyBody
TopCatID *string `json:"top_cat_id" form:"top_cat_id" uri:"top_cat_id"`
SecondCatID *string `json:"second_cat_id" form:"second_cat_id" uri:"second_cat_id"`
ThirdCatID *string `json:"third_cat_id" form:"third_cat_id" uri:"third_cat_id"`
}
type CommodityListByTagReq struct {
Tag string `json:"tag" form:"tag" uri:"tag"`
}
func (d *CommodityListReq) Check() error {
return nil
}
type AppCommodityPageReq struct {
PageWithKeyBody
CatID *string `json:"cat_id" form:"cat_id" uri:"cat_id"`
}
func (d *AppCommodityPageReq) Check() error {
return nil
}
type BannerListReq struct {
Position string `json:"position" form:"position" uri:"position"`
}
func (d *BannerListReq) Check() error {
return nil
}
type FAQListReq struct {
KeyBody
}
func (d *FAQListReq) Check() error {
return nil
}
type ArticleListReq struct {
KeyBody
ArticleType string `json:"article_type" form:"article_type" uri:"article_type"`
}
func (d *ArticleListReq) Check() error {
return nil
}

View File

@ -0,0 +1,83 @@
package req
import (
"errors"
)
type AppFriendList struct {
}
func (req *AppFriendList) Check() (err error) {
return nil
}
type AppFriendApplyList struct {
Page
Direct string `json:"direct"` // send 发出的申请 receive 收到的申请
}
func (req *AppFriendApplyList) Check() (err error) {
return nil
}
type AppFriendApply struct {
UserID string `json:"user_id"`
Message string `json:"message"`
}
func (req *AppFriendApply) Check() (err error) {
if len(req.UserID) == 0 {
err = errors.New("用户不能为空")
return
}
return nil
}
type AppFriendApplyAccept struct {
IDBody
Message string `json:"message"`
}
func (req *AppFriendApplyAccept) Check() (err error) {
return req.IDBody.Check()
}
type AppFriendApplyRefuse struct {
IDBody
Message string `json:"message"`
}
func (req *AppFriendApplyRefuse) Check() (err error) {
return req.IDBody.Check()
}
type AppFriendTopList struct {
}
func (req *AppFriendTopList) Check() (err error) {
return nil
}
type AppFriendTopAdd struct {
UserID string `json:"user_id"`
}
func (req *AppFriendTopAdd) Check() (err error) {
if len(req.UserID) == 0 {
err = errors.New("用户不能为空")
return
}
return nil
}
type AppFriendTopRemove struct {
UserID string `json:"user_id"`
}
func (req *AppFriendTopRemove) Check() (err error) {
if len(req.UserID) == 0 {
err = errors.New("用户不能为空")
return
}
return nil
}

View File

@ -0,0 +1,36 @@
package req
import (
"errors"
)
type AppMomentCreate struct {
ClanID string `gorm:"column:clan_id;type:char(32);not null;comment:家" json:"clan_id"`
Title string `gorm:"column:title;type:varchar(64);not null;comment:标题" json:"title"`
TextContent string `gorm:"column:text_content;type:varchar(2048);not null;comment:内容" json:"text_content"`
Items []AppMomentCreateItem `json:"items"`
}
func (req *AppMomentCreate) Check() (err error) {
return nil
}
type AppMomentUpdate struct {
IDBody
Nickname string `gorm:"column:nickname;type:varchar(64);not null;comment:昵称" json:"nickname"`
Sign string `gorm:"column:sign;type:varchar(255);not null;comment:签名" json:"sign"`
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"`
}
func (req *AppMomentUpdate) Check() (err error) {
if len(req.Nickname) == 0 {
err = errors.New("名称不能为空")
return
}
return nil
}
type AppMomentCreateItem struct {
Type string `gorm:"column:type;type:varchar(64);not null;comment:类型PIC=图片" json:"type"`
Content string `gorm:"column:content;type:varchar(255);not null;comment:内容、如图片id" json:"content"`
}

59
pkg/req/app_user_order.go Normal file
View File

@ -0,0 +1,59 @@
package req
import (
"errors"
"servicebase/pkg/datasource/fields"
"github.com/shopspring/decimal"
)
type OrderInfoReq struct {
IDBody
}
type OrderCommitReq struct {
OrderType int32 `gorm:"column:order_type;type:int;not null;comment:订单类型 1=到店 2=邮寄" json:"order_type"`
OrderAmount decimal.Decimal `gorm:"column:order_amount;type:decimal(10,2);not null;comment:订单金额" json:"order_amount"`
OrderExtraAmount decimal.Decimal `gorm:"column:order_extra_amount;type:decimal(10,2);not null;comment:订单额外费用挂号信要2000其他0" json:"order_extra_amount"`
OrderPayAmount decimal.Decimal `gorm:"column:order_pay_amount;type:decimal(10,2);not null;comment:订单支付金额" json:"order_pay_amount"`
OrderPayType int32 `gorm:"column:order_pay_type;type:int;not null;comment:订单支付类型1=现金 2=银行汇款 3=挂号信" json:"order_pay_type"`
OrderPayTime fields.Time `gorm:"column:order_pay_time;type:datetime;not null;comment:订单支付时间" json:"order_pay_time"`
OrderPayNo string `gorm:"column:order_pay_no;type:varchar(255);not null;comment:订单支付流水号" json:"order_pay_no"`
OrderPayRemark string `gorm:"column:order_pay_remark;type:varchar(255);not null;comment:订单支付备注" json:"order_pay_remark"`
OrderRemark string `gorm:"column:order_remark;type:varchar(255);not null;comment:订单备注" json:"order_remark"`
ToShopID string `gorm:"column:to_shop_id;type:char(32);not null;comment:到店门店id" json:"to_shop_id"`
ToShopDate string `gorm:"column:to_shop_date;type:char(10);not null;comment:到店日期" json:"to_shop_date"`
ToShopTime string `gorm:"column:to_shop_time;type:char(20);not null;comment:到店时间" json:"to_shop_time"`
ExpressArriveDate string `gorm:"column:express_arrive_date;type:varchar(20);not null;comment:快递日期" json:"express_arrive_date"`
ExpressArriveTime string `gorm:"column:express_arrive_time;type:varchar(255);not null;comment:快递时间" json:"express_arrive_time"`
InvoiceType string `gorm:"column:invoice_type;type:char(1);not null;comment:发票类型1=需要发票 2=不需要" json:"invoice_type"`
InvoiceNo string `gorm:"column:invoice_no;type:varchar(255);comment:发票号码" json:"invoice_no"`
PersonalDocType string `gorm:"column:personal_doc_type;type:char(2);comment:身份类型" json:"personal_doc_type"`
PersonalDoc string `gorm:"column:personal_doc;type:varchar(255);comment:身份照片" json:"personal_doc"`
PersonalEndDate string `gorm:"column:personal_end_date;type:varchar(255);comment:身份照片有效期" json:"personal_end_date"`
OrderDetails []OrderDetailReq `json:"order_details"`
BankName string `json:"bank_name"`
BranchBankName string `json:"branch_bank_name"`
CardType string `json:"card_type"`
CardNo string `json:"card_no"`
CardUserName string `json:"card_user_name"`
PersonalDoc2 string `json:"personal_doc_2"`
}
func (d *OrderCommitReq) Check() error {
if len(d.OrderDetails) == 0 {
return errors.New("没有商品信息")
}
return nil
}
type OrderDetailReq struct {
OrderID int32 `gorm:"column:order_id;type:int;not null;comment:订单ID" json:"order_id"`
ProductID string `gorm:"column:product_id;type:char(32);not null;comment:商品ID" json:"product_id"`
ProductName string `gorm:"column:product_name;type:varchar(255);not null;comment:商品名称" json:"product_name"`
ProductPrice decimal.Decimal `gorm:"column:product_price;type:decimal(10,2);not null;comment:商品价格" json:"product_price"`
ProductNum int32 `gorm:"column:product_num;type:int;not null;comment:商品数量" json:"product_num"`
ProductTotal decimal.Decimal `gorm:"column:product_total;type:decimal(10,2);not null;comment:商品总价" json:"product_total"`
ProductPros string `gorm:"column:product_pros;type:varchar(255);not null;comment:属性" json:"product_pros"`
PriceType string `gorm:"column:price_type;type:char(50);not null;comment:价格类型" json:"price_type"`
}

165
pkg/req/common_auth.go Normal file
View File

@ -0,0 +1,165 @@
package req
import (
"context"
"errors"
"servicebase/pkg/log"
)
type CommonAuthReq struct {
Type string `json:"type"` // app_user_wechat app_driver_wechat admin_company
Code string `json:"code" form:"code" uri:"code"` // 微信登录type=app_user_wechat|app_driver_wechat
Login string `json:"login"` // 账号密码登录type=admin_company
Password string `json:"password"` // 账号密码登录type=admin_company
}
func (d *CommonAuthReq) Check() error {
return nil
}
type AdminUserRoleAllReq struct {
UserID string `json:"user_id" form:"user_id" uri:"user_id"` // ID
}
type TenantRolePrivilegeAllReq struct {
RoleID string `json:"role_id" form:"role_id" uri:"role_id"` // ID
}
type AdminUserPassResetReq struct {
UserID string `json:"user_id"` // USERNAME EMAIL AUTO
PrePass string `json:"pre_password"`
NewPass string `json:"new_password"`
}
func (d *AdminUserPassResetReq) Check() error {
if len(d.UserID) == 0 {
return errors.New("请指定用户ID")
}
if len(d.PrePass) == 0 {
return errors.New("请指定旧密码")
}
if len(d.NewPass) == 0 {
return errors.New("请指定新密码")
}
if len(d.NewPass) < 6 {
return errors.New("密码不能少于6位")
}
return nil
}
type UserCheckReq struct {
UserID string `json:"user_id"`
Point string `json:"point"`
}
func (d UserCheckReq) Check(c context.Context) error {
if len(d.UserID) == 0 || len(d.Point) == 0 {
log.ErrorF("privilege check 参数错误: uid=%s point=%s", d.UserID, d.Point)
return errors.New("参数错误")
}
return nil
}
type ServiceUserResourceReq struct {
UserID string `json:"user_id" form:"user_id" uri:"user_id"`
}
func (d ServiceUserResourceReq) Check() error {
if len(d.UserID) == 0 {
return errors.New("参数错误")
}
return nil
}
type TenantAddReq struct {
Name string `gorm:"column:name;type:varchar(255);not null;index:idx_name,priority:1;comment:租户名" json:"name"`
Contact string `gorm:"column:contact;type:varchar(255);not null;comment:联系方式" json:"contact"`
Desc string `gorm:"column:desc;type:varchar(255);not null;comment:备注" json:"desc"`
}
func (d *TenantAddReq) Check() error {
if len(d.Name) == 0 {
return errors.New("名称不能为空")
}
return nil
}
type TenantUpdateReq struct {
IDBody
TenantAddReq
}
func (d *TenantUpdateReq) Check() error {
if len(d.ID) == 0 {
return errors.New("ID不能为空")
}
return nil
}
type AdminPrivilegeAddReq struct {
TenantID string `gorm:"column:tenant_id;type:char(32);not null;default:system;comment:企业ID" json:"tenant_id"`
ScopeID string `gorm:"column:scope_id;type:char(32);not null;comment:范围" json:"scope_id"`
ParentID string `gorm:"column:parent_id;type:char(32);not null;comment:父ID" json:"parent_id"`
Code string `gorm:"column:code;type:varchar(64);not null;comment:代码" json:"code"`
Name string `gorm:"column:name;type:varchar(64);not null;index:idx_name,priority:1;comment:权限名称" json:"name"`
Level int32 `gorm:"column:level;type:int;not null;comment:权限级别" json:"level"`
SourceType string `gorm:"column:source_type;type:varchar(64);not null;comment:类型resource、interface等" json:"source_type"`
TargetType string `gorm:"column:target_type;type:varchar(255);not null" json:"target_type"`
Target string `gorm:"column:target;type:varchar(255);not null;comment:权限值 resource:菜单路径; api=url-pre" json:"target"`
Desc string `gorm:"column:desc;type:varchar(64);not null;comment:描述" json:"desc"`
}
func (d *AdminPrivilegeAddReq) Check() error {
return nil
}
type AdminPrivilegeUpdateReq struct {
IDBody
AdminPrivilegeAddReq
}
func (d *AdminPrivilegeUpdateReq) Check() error {
return nil
}
type AdminRoleAddReq struct {
Name string `json:"name"` // 名称
Code string `json:"code"` // 名称
Desc string `json:"desc"` // 描述
}
type AdminRoleUpdateReq struct {
IDBody
AdminRoleAddReq
}
type AdminUserAddReq struct {
Username string `json:"username" form:"username" uri:"username"` // ID
Nickname string `json:"nickname" form:"nickname" uri:"nickname"` //
Desc string `json:"desc" form:"desc" uri:"desc"` //
Password string `json:"password" form:"password" uri:"password"` //
}
type AdminUserUpdateReq struct {
IDBody
Username string `json:"username" form:"username" uri:"username"` // ID
Nickname string `json:"nickname" form:"nickname" uri:"nickname"` //
Desc string `json:"desc" form:"desc" uri:"desc"` //
State int32 `json:"state" form:"state" uri:"state"` //
}
type AdminUserUpdatePasswordReq struct {
IDBody
Password string `json:"password" form:"password" uri:"password"` // ID
}
type AdminUserRoleAddReq struct {
ScopeID string `json:"scope_id"` //
UserID string `json:"user_id"` //
RoleID string `json:"role_id"` //
}
type AdminRolePrivilegeAddReq struct {
ScopeID string `json:"scope_id"` //
RoleID string `json:"role_id"` //
PrivilegeID string `json:"privilege_id"` //
}

31
pkg/req/open.go Normal file
View File

@ -0,0 +1,31 @@
package req
type AudioToTextReq struct {
Url string `json:"audio_url" form:"audio_url" uri:"audio_url"`
Text string `json:"text" form:"text" uri:"text"`
}
func (d AudioToTextReq) GetText() string {
if len(d.Text) == 0 {
return `本人尊重宣誓:本人自愿加入东东电竞,并严格遵守东东电竞所有规定,接受个人信息公开到互联网进行监督和宣传,爱国爱党不触碰法律法规,不做无道德无底线的事,不做违法乱纪的事。做一名优秀的陪玩,时刻约束自己,努力为陪玩行业正名,拥有远大志向,从我做起改善不良风气,不断努力,不断进步,和东东电竞一起努力,共同构建陪玩行业新标杆。若出现违反相关规定内容,本人自愿接受所有处罚。`
}
return d.Text
}
type TextSimilarityReq struct {
Text1 string `json:"text1" form:"text1" uri:"text1"`
Text2 string `json:"text2" form:"text2" uri:"text2"`
}
type VideoExtractFramesReq struct {
Url string `json:"video_url" form:"video_url" uri:"video_url"`
NumFrames int `json:"num_frames" form:"num_frames" uri:"num_frames"`
Force bool `json:"force" form:"force" uri:"force"`
}
func (d VideoExtractFramesReq) GetNumFrames() int {
if d.NumFrames <= 0 || d.NumFrames > 20 {
return 5
}
return d.NumFrames
}

1
pkg/req/trade_game.go Normal file
View File

@ -0,0 +1 @@
package req