1
This commit is contained in:
@@ -45,7 +45,9 @@ func AddMoney(db *sqlx.Tx, printNo string, money int64) error {
|
||||
|
||||
// UpdateBillToUser 当打印机账户从菜市绑定时,未分配用户,用户再使用小程序绑定时,将打印机分配给用户!
|
||||
func UpdateBillToUser(db *sqlx.Tx, param *app_model.PrintBill) error {
|
||||
return UpdateTx(db, param, []string{"user_id"}...)
|
||||
sql := `UPDATE print_bill SET user_id = ? WHERE print_no = ?`
|
||||
_, err := globals.GetTxDb().Exec(sql, []string{param.UserId, param.PrintNo})
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePrintToSystem 修改打印机账户所属用户
|
||||
|
||||
@@ -285,3 +285,13 @@ func UpdatePrintUser(db *sqlx.Tx, userId, printNo string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ClearPrintMsg 清空打印机消息
|
||||
func ClearPrintMsg(printNo string) error {
|
||||
sql := `UPDATE print_msg SET status = ? WHERE print_no = ? AND status = ?`
|
||||
_, err := globals.GetDB().Exec(sql, []interface{}{model.PrintMsgErr, printNo, model.PrintMsgWait}) // 1-待打印
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
63
dao/print_edition.go
Normal file
63
dao/print_edition.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
editionModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PrintEdition struct {
|
||||
}
|
||||
|
||||
var PrintEditionDao = new(PrintEdition)
|
||||
|
||||
// AddEdition 添加版本控制
|
||||
func (p PrintEdition) AddEdition(param *editionModel.AddOrUpdatePrintEdition) error {
|
||||
if err := Insert(globals.GetDB(), editionModel.PrintEdition{
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
EditionNo: param.EditionNo,
|
||||
EditionMsg: param.EditionMsg,
|
||||
IsHotBuild: param.IsHotBuild,
|
||||
IsForce: param.IsForce,
|
||||
APKUrl: param.APKUrl,
|
||||
HotUrl: param.HotUrl,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateEdition 修改版本控制
|
||||
func (p PrintEdition) UpdateEdition(param *editionModel.AddOrUpdatePrintEdition) error {
|
||||
if err := Update(globals.GetDB(), editionModel.PrintEdition{
|
||||
ID: param.Id,
|
||||
CreatedAt: param.CreatedAt,
|
||||
UpdatedAt: time.Now(),
|
||||
EditionNo: param.EditionNo,
|
||||
EditionMsg: param.EditionMsg,
|
||||
IsHotBuild: param.IsHotBuild,
|
||||
IsForce: param.IsForce,
|
||||
APKUrl: param.APKUrl,
|
||||
HotUrl: param.HotUrl,
|
||||
}, []string{"updated_at", "edition_no", "edition_msg", "is_hot_build", "is_force", "apk_url", "hot_url"}...); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeletePrintEdition 删除
|
||||
func (p PrintEdition) DeletePrintEdition(id int) error {
|
||||
sql := `DELETE FROM print_edition WHERE id = ?`
|
||||
_, err := globals.GetDB().Exec(sql, []interface{}{id}...)
|
||||
return err
|
||||
}
|
||||
|
||||
func (p PrintEdition) SelectEdition() ([]*editionModel.PrintEdition, error) {
|
||||
var result []*editionModel.PrintEdition
|
||||
sql := `SELECT * FROM print_edition ORDER BY created_at DESC LIMIT 20 OFFSET 0 `
|
||||
if err := globals.GetDB().Select(&result, sql); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
56
dao/print_notice.go
Normal file
56
dao/print_notice.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
editionModel "git.rosy.net.cn/jx-print/model/app_model"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PrintNotice struct {
|
||||
}
|
||||
|
||||
var PrintNoticeDao = new(PrintNotice)
|
||||
|
||||
// AddNotice 添加版本控制
|
||||
func (p PrintNotice) AddNotice(param *editionModel.AddOrUpdatePrintNotice) error {
|
||||
if err := Insert(globals.GetDB(), editionModel.PrintNotice{
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
NoticeType: param.NoticeType,
|
||||
Msg: param.Msg,
|
||||
Link: param.Link,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateNotice 修改版本控制
|
||||
func (p PrintNotice) UpdateNotice(param *editionModel.AddOrUpdatePrintNotice) error {
|
||||
if err := Update(globals.GetDB(), editionModel.PrintNotice{
|
||||
ID: param.Id,
|
||||
UpdatedAt: time.Now(),
|
||||
NoticeType: param.NoticeType,
|
||||
Msg: param.Msg,
|
||||
Link: param.Link,
|
||||
}, []string{"updated_at", "notice_type", "msg", "link"}...); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeletePrintNotice 删除
|
||||
func (p PrintNotice) DeletePrintNotice(id int) error {
|
||||
sql := `DELETE FROM print_notice WHERE id = ?`
|
||||
_, err := globals.GetDB().Exec(sql, []interface{}{id}...)
|
||||
return err
|
||||
}
|
||||
|
||||
func (p PrintNotice) SelectPrintNotice(param *editionModel.QueryPrintNotice) ([]*editionModel.PrintNotice, error) {
|
||||
var result []*editionModel.PrintNotice
|
||||
sql := `SELECT * FROM print_edition WHERE notice_type = ? ORDER BY created_at DESC LIMIT ? OFFSET ? `
|
||||
if err := globals.GetDB().Select(&result, sql, []interface{}{param.NoticeType, param.PageSize, (param.PageNumber - 1) * param.PageSize}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
@@ -43,29 +43,33 @@ func (p *PrintSettingDao) UpdatePrinterSetting(param *settingModel.UpdatePrintSe
|
||||
sql += ` call_name_setting = ? `
|
||||
param2 = append(param2, param.CallNameSetting)
|
||||
}
|
||||
if param.SystemVoice != 0 {
|
||||
sql += ` ,system_voice = ? `
|
||||
param2 = append(param2, param.SystemVoice)
|
||||
if param.BusinessOffLineVoice != 0 {
|
||||
sql += ` ,business_off_line_voice = ? `
|
||||
param2 = append(param2, param.BusinessOffLineVoice)
|
||||
}
|
||||
if param.PrintVoiceSetting != "" {
|
||||
sql += ` ,print_voice_setting = ? `
|
||||
param2 = append(param2, param.PrintVoiceSetting)
|
||||
if param.BalanceNotEnoughVoice != 0 {
|
||||
sql += ` ,balance_not_enough_voice = ? `
|
||||
param2 = append(param2, param.BalanceNotEnoughVoice)
|
||||
}
|
||||
if param.OrderVoiceSetting != "" {
|
||||
sql += ` ,order_voice_setting = ? `
|
||||
param2 = append(param2, param.OrderVoiceSetting)
|
||||
if param.EveryDayGreetVoice != 0 {
|
||||
sql += ` ,every_day_greet_voice = ? `
|
||||
param2 = append(param2, param.EveryDayGreetVoice)
|
||||
}
|
||||
if param.RiderVoiceSetting != "" {
|
||||
sql += ` ,rider_voice_setting = ? `
|
||||
param2 = append(param2, param.RiderVoiceSetting)
|
||||
if param.BusinessPrintNum != 0 {
|
||||
sql += ` ,business_print_num = ? `
|
||||
param2 = append(param2, param.BusinessPrintNum)
|
||||
}
|
||||
if param.CustomerVoiceSetting != "" {
|
||||
sql += ` ,customer_voice_setting = ? `
|
||||
param2 = append(param2, param.CustomerVoiceSetting)
|
||||
if param.CustomerPrintNum != 0 {
|
||||
sql += ` ,customer_print_num = ? `
|
||||
param2 = append(param2, param.CustomerPrintNum)
|
||||
}
|
||||
if param.PickingSetting != "" {
|
||||
sql += ` ,picking_setting = ? `
|
||||
param2 = append(param2, param.PickingSetting)
|
||||
if param.VoiceSetting != "" {
|
||||
sql += ` ,voice_setting = ? `
|
||||
param2 = append(param2, param.CustomerPrintNum)
|
||||
}
|
||||
if param.PrintSetting != "" {
|
||||
sql += ` ,print_setting = ? `
|
||||
param2 = append(param2, param.CustomerPrintNum)
|
||||
}
|
||||
sql += ` WHERE print_no = ? `
|
||||
param2 = append(param2, param.PrintNo)
|
||||
|
||||
Reference in New Issue
Block a user