This commit is contained in:
eson 2024-04-09 23:50:42 +08:00
parent 74b790b542
commit 13782b799e

View File

@ -7,6 +7,14 @@ import (
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
) )
const (
/**
* 禁止A仓交易12
*/
Disable_A_No = 2
Type_2 = 2
)
type KillaraCustomerModel struct { type KillaraCustomerModel struct {
// fields ... // fields ...
db *sqlx.DB db *sqlx.DB
@ -21,3 +29,21 @@ func (m *KillaraCustomerModel) Find(ctx context.Context) (result []*KillaraCusto
} }
return customer, nil return customer, nil
} }
func (m *KillaraCustomerModel) InsertCustomer(data *KillaraCustomer) (int64, error) {
result, err := m.db.NamedExec(`INSERT INTO customer (type, realname, code, telephone, email, nickname, name, status, disable_a, parent_id)
VALUES (:type, :realname, :code, :telephone, :email, :nickname, :name, :status, :disable_a, :parent_id)`, data)
if err != nil {
return 0, err
}
id, err := result.LastInsertId()
return id, err
}
func (m *KillaraCustomerModel) UpdateCustomer(id int64, data *KillaraCustomer) error {
_, err := m.db.NamedExec(
`UPDATE customer SET type=:type, realname=:realname, code=:code, telephone=:telephone, email=:email, nickname=:nickname, name=:name, status=:status, disable_a=:disable_a, parent_id=:parent_id WHERE customer_id=:customer_id`,
data,
)
return err
}