From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 01 十一月 2023 19:20:21 +0800 Subject: [PATCH] 公海member_id使用0 --- service/contract.go | 30 +++++++++++++----------------- 1 files changed, 13 insertions(+), 17 deletions(-) diff --git a/service/contract.go b/service/contract.go index a1e56e5..2910f87 100644 --- a/service/contract.go +++ b/service/contract.go @@ -16,19 +16,6 @@ return ecode.OK } -func (ContractService) DeleteContract(id int) int { - _, err := model.NewContractSearch().SetId(id).Find() - if err != nil { - return ecode.ContractNotExist - } - - err = model.NewContractSearch().SetId(id).Delete() - if err != nil { - return ecode.ContractNotExist - } - return ecode.OK -} - func (ContractService) UpdateContract(contract *model.Contract) int { // check contract exist _, err := model.NewContractSearch().SetId(contract.Id).Find() @@ -44,11 +31,20 @@ return ecode.OK } -func (ContractService) GetContractList(page, pageSize int, keyword string) ([]*model.Contract, int) { +func (ContractService) GetContractList(page, pageSize int, data map[string]interface{}) ([]*model.Contract, int64, int) { // get contact list - contacts, err := model.NewContractSearch().SetKeyword(keyword).SetPage(page, pageSize).FindAll() + contacts, total, err := model.NewContractSearch().SetPage(page, pageSize).SetSearchMap(data).FindAll() if err != nil { - return nil, ecode.ContractListErr + return nil, 0, ecode.ContractListErr } - return contacts, ecode.OK + return contacts, total, ecode.OK +} + +func (ContractService) DeleteContract(id int) int { + // delete client + err := model.NewContractSearch().SetId(id).Delete() + if err != nil { + return ecode.ContractDeleteErr + } + return ecode.OK } -- Gitblit v1.8.0