package admin_api_controllers import ( "XT_Admin_Api/enums" "XT_Admin_Api/models" "XT_Admin_Api/service" "fmt" "time" ) type CustomAPIController struct { AdminBaseAPIAuthController } func (this *CustomAPIController) CheckCustom() { id, _ := this.GetInt64("id") ci, _ := service.FindCustomInfoByID(id) if ci.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } ci.IsCheck = 1 ci.CheckPerson = this.GetAdminInfo().Name err := service.SaveCustom(&ci) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "审核成功", }) } func (this *CustomAPIController) CreateCustom() { name := this.GetString("name") //xtOrgID := this.GetString("xt_org_id") customType, _ := this.GetInt64("custom_type") salesperson := this.GetString("salesperson") signTime := this.GetString("sign_time") contractPrice := this.GetString("contract_price") softwarePrice := this.GetString("software_price") hardwarePrice := this.GetString("hardware_price") yearCostPrice := this.GetString("year_cost_price") address := this.GetString("address") isImplement, _ := this.GetInt64("is_implement") lisStatus, _ := this.GetInt64("lis_status") lisContact := this.GetString("lis_contact") lisTime := this.GetString("lis_time") lisRemark := this.GetString("lis_remark") qcStatus, _ := this.GetInt64("qc_status") ybStatus, _ := this.GetInt64("yb_status") remark := this.GetString("remark") weightScaleStatus, _ := this.GetInt64("weight_scale_status") weightScaleBrand := this.GetString("weight_scale_brand") weightScaleRemark := this.GetString("weight_scale_remark") sphygmomanometerStatus, _ := this.GetInt64("sphygmomanometer_status") sphygmomanometerBrand := this.GetString("sphygmomanometer_brand") sphygmomanometerRemark := this.GetString("sphygmomanometer_remark") scannerStatus, _ := this.GetInt64("scanner_status") scannerBrand := this.GetString("scanner_brand") scannerRemark := this.GetString("scanner_remark") facialRecognitionDeviceStatus, _ := this.GetInt64("facial_recognition_device_status") facialRecognitionDeviceBrand := this.GetString("facial_recognition_device_brand") facialRecognitionDeviceRemark := this.GetString("facial_recognition_device_remark") printerStatus, _ := this.GetInt64("printer_status") printerBrand := this.GetString("printer_brand") printerRemark := this.GetString("printer_remark") hardwareRemark := this.GetString("hardware_remark") implement_time := this.GetString("implement_time") implement_person := this.GetString("implement_person") implement_remark := this.GetString("implement_remark") yb_time := this.GetString("yb_time") yb_person := this.GetString("yb_person") yb_remark := this.GetString("yb_remark") qc_time := this.GetString("qc_time") qc_person := this.GetString("qc_person") qc_remark := this.GetString("qc_remark") client_remark := this.GetString("client_remark") topline_time := this.GetString("topline_time") kyyChargeCustom := &models.KyyChargeCustom{ ImplementTime: implement_time, ImplementPerson: implement_person, ImplementRemark: implement_remark, YbTime: yb_time, YbRemark: yb_remark, YbPerson: yb_person, QcTime: qc_time, QcPerson: qc_person, QcRemark: qc_remark, Name: name, Status: 1, Ctime: time.Now().Unix(), Mtime: time.Now().Unix(), Creator: 0, Modifier: 0, CustomType: customType, Salesperson: salesperson, SignTime: signTime, ContractPrice: contractPrice, SoftwarePrice: softwarePrice, HardwarePrice: hardwarePrice, YearCostPrice: yearCostPrice, Address: address, IsImplement: isImplement, LisStatus: lisStatus, LisContact: lisContact, LisTime: lisTime, LisRemark: lisRemark, QcStatus: qcStatus, YbStatus: ybStatus, Remark: remark, WeightScaleStatus: weightScaleStatus, WeightScaleBrand: weightScaleBrand, WeightScaleRemark: weightScaleRemark, SphygmomanometerStatus: sphygmomanometerStatus, SphygmomanometerBrand: sphygmomanometerBrand, SphygmomanometerRemark: sphygmomanometerRemark, ScannerStatus: scannerStatus, ScannerBrand: scannerBrand, ScannerRemark: scannerRemark, FacialRecognitionDeviceStatus: facialRecognitionDeviceStatus, FacialRecognitionDeviceBrand: facialRecognitionDeviceBrand, FacialRecognitionDeviceRemark: facialRecognitionDeviceRemark, PrinterStatus: printerStatus, PrinterBrand: printerBrand, PrinterRemark: printerRemark, HardwareRemark: hardwareRemark, ClientRemark: client_remark, ToplineTime: topline_time, } //custom, _ := service.FindCustomInfo(xtOrgID) //if custom.ID > 0 { // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameException) // return //} err := service.CreateCustom(kyyChargeCustom) if err == nil { this.ServeSuccessJSON(map[string]interface{}{ "custom": kyyChargeCustom, }) } } func (this *CustomAPIController) GetCustomList() { list, _ := service.GetAllCustoms() this.ServeSuccessJSON(map[string]interface{}{ "list": list, }) } func (this *CustomAPIController) DeleteCustom() { id, _ := this.GetInt64("id") err := service.DeleteAdmin(id) if err == nil { this.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } } func (this *CustomAPIController) ModifyCustom() { id, _ := this.GetInt64("id") module, _ := this.GetInt64("module") custom, _ := service.FindCustomInfoByIDTwo(id) switch module { case 1: //编辑基本信息 name := this.GetString("name") customType, _ := this.GetInt64("custom_type") salesperson := this.GetString("salesperson") signTime := this.GetString("sign_time") contractPrice := this.GetString("contract_price") softwarePrice := this.GetString("software_price") hardwarePrice := this.GetString("hardware_price") yearCostPrice := this.GetString("year_cost_price") address := this.GetString("address") client_remark := this.GetString("client_remark") topline_time := this.GetString("topline_time") custom.CustomType = customType custom.Salesperson = salesperson custom.SignTime = signTime custom.ContractPrice = contractPrice custom.SoftwarePrice = softwarePrice custom.HardwarePrice = hardwarePrice custom.YearCostPrice = yearCostPrice custom.Address = address custom.Name = name custom.ID = id custom.Mtime = time.Now().Unix() custom.ClientRemark = client_remark custom.ToplineTime = topline_time err := service.UpdateCustomTwo(custom) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) break case 2: //编辑实施信息 isImplement, _ := this.GetInt64("is_implement") implementTime := this.GetString("implement_time") implementPerson := this.GetString("implement_person") implementRemark := this.GetString("implement_remark") custom.IsImplement = isImplement custom.ImplementTime = implementTime custom.ImplementPerson = implementPerson custom.ImplementRemark = implementRemark custom.ID = id custom.Mtime = time.Now().Unix() err := service.UpdateCustomTwo(custom) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) break case 3: //编辑LIS对接 lisStatus, _ := this.GetInt64("lis_status") lisContact := this.GetString("lis_contact") lisTime := this.GetString("lis_time") lisRemark := this.GetString("lis_remark") custom.LisStatus = lisStatus custom.LisTime = lisTime custom.LisRemark = lisRemark custom.LisContact = lisContact custom.ID = id custom.Mtime = time.Now().Unix() err := service.UpdateCustomTwo(custom) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) break case 4: //编辑医保对接 ybStatus, _ := this.GetInt64("yb_status") ybPerson := this.GetString("yb_person") ybTime := this.GetString("yb_time") ybRemark := this.GetString("yb_remark") custom.YbStatus = ybStatus custom.YbPerson = ybPerson custom.YbTime = ybTime custom.YbRemark = ybRemark custom.ID = id custom.Mtime = time.Now().Unix() err := service.UpdateCustomTwo(custom) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) break case 5: //编辑质控对接 qcStatus, _ := this.GetInt64("qc_status") qcPerson := this.GetString("qc_person") qcTime := this.GetString("qc_time") qcRemark := this.GetString("qc_remark") custom.QcStatus = qcStatus custom.QcPerson = qcPerson custom.QcTime = qcTime custom.QcRemark = qcRemark custom.ID = id custom.Mtime = time.Now().Unix() err := service.UpdateCustomTwo(custom) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) break case 6: //编辑备注 remark := this.GetString("remark") custom.Remark = remark custom.ID = id custom.Mtime = time.Now().Unix() err := service.UpdateCustomTwo(custom) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) break case 7: //编辑硬件信息 weightScaleStatus, _ := this.GetInt64("weight_scale_status") weightScaleBrand := this.GetString("weight_scale_brand") weightScaleRemark := this.GetString("weight_scale_remark") sphygmomanometerStatus, _ := this.GetInt64("sphygmomanometer_status") sphygmomanometerBrand := this.GetString("sphygmomanometer_brand") sphygmomanometerRemark := this.GetString("sphygmomanometer_remark") scannerStatus, _ := this.GetInt64("scanner_status") scannerBrand := this.GetString("scanner_brand") scannerRemark := this.GetString("scanner_remark") facialRecognitionDeviceStatus, _ := this.GetInt64("facial_recognition_device_status") facialRecognitionDeviceBrand := this.GetString("facial_recognition_device_brand") facialRecognitionDeviceRemark := this.GetString("facial_recognition_device_remark") printerStatus, _ := this.GetInt64("printer_status") printerBrand := this.GetString("printer_brand") printerRemark := this.GetString("printer_remark") hardwareRemark := this.GetString("hardware_remark") custom.WeightScaleStatus = weightScaleStatus custom.WeightScaleBrand = weightScaleBrand custom.WeightScaleRemark = weightScaleRemark custom.SphygmomanometerStatus = sphygmomanometerStatus custom.SphygmomanometerBrand = sphygmomanometerBrand custom.SphygmomanometerRemark = sphygmomanometerRemark custom.ScannerStatus = scannerStatus custom.ScannerBrand = scannerBrand custom.ScannerRemark = scannerRemark custom.FacialRecognitionDeviceStatus = facialRecognitionDeviceStatus custom.FacialRecognitionDeviceBrand = facialRecognitionDeviceBrand custom.FacialRecognitionDeviceRemark = facialRecognitionDeviceRemark custom.PrinterStatus = printerStatus custom.PrinterBrand = printerBrand custom.PrinterRemark = printerRemark custom.HardwareRemark = hardwareRemark custom.ID = id custom.Mtime = time.Now().Unix() err := service.UpdateCustomTwo(custom) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) break } } func (this *CustomAPIController) GetCustom() { id, _ := this.GetInt64("id") custom, _ := service.FindCustomInfoByID(id) if custom.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } this.ServeSuccessJSON(map[string]interface{}{ "custom": custom, }) } func (this *CustomAPIController) CreatePaymentCollection() { customID, _ := this.GetInt64("custom_id") customName := this.GetString("custom_name") paymentCollectionType, _ := this.GetInt64("payment_collection_type") paymentCollectionSumAmt := this.GetString("payment_collection_sumamt") softwareSumAmt := this.GetString("software_sumamt") hardwareSumAmt := this.GetString("hardware_sumamt") paymentCollectionDate := this.GetString("payment_collection_date") paymentCollectionRole := this.GetString("payment_collection_role") url := this.GetString("url") remark := this.GetString("remark") ctime := time.Now().Unix() mtime := time.Now().Unix() // 创建 KyyChargePaymentCollection 对象,并设置每个字段的值 paymentCollection := models.KyyChargePaymentCollection{ CustomId: customID, CustomName: customName, PaymentCollectionType: paymentCollectionType, PaymentCollectionSumamt: paymentCollectionSumAmt, SoftwareSumamt: softwareSumAmt, HardwareSumamt: hardwareSumAmt, PaymentCollectionDate: paymentCollectionDate, PaymentCollectionRole: paymentCollectionRole, Url: url, Remark: remark, Ctime: ctime, Mtime: mtime, Creator: 0, Modifier: 0, Status: 1, } err := service.CreateChargePaymentCollection(&paymentCollection) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "paymentCollection": paymentCollection, }) } func (this *CustomAPIController) GetPaymentCollectionList() { list, _ := service.GetAllPaymentCollections() this.ServeSuccessJSON(map[string]interface{}{ "list": list, }) } func (this *CustomAPIController) GetPaymentCollection() { id, _ := this.GetInt64("id") pc, _ := service.FindPaymentCollectionInfo(id) if pc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } this.ServeSuccessJSON(map[string]interface{}{ "pc": pc, }) } func (this *CustomAPIController) EditPaymentCollection() { id, _ := this.GetInt64("id") paymentCollectionType, _ := this.GetInt64("payment_collection_type") paymentCollectionSumAmt := this.GetString("payment_collection_sumamt") softwareSumAmt := this.GetString("software_sumamt") hardwareSumAmt := this.GetString("hardware_sumamt") paymentCollectionDate := this.GetString("payment_collection_date") paymentCollectionRole := this.GetString("payment_collection_role") url := this.GetString("url") remark := this.GetString("remark") mtime := time.Now().Unix() cpc, _ := service.FindPaymentCollectionInfo(id) if cpc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cpc.PaymentCollectionType = paymentCollectionType cpc.PaymentCollectionSumamt = paymentCollectionSumAmt cpc.SoftwareSumamt = softwareSumAmt cpc.HardwareSumamt = hardwareSumAmt cpc.PaymentCollectionDate = paymentCollectionDate cpc.PaymentCollectionRole = paymentCollectionRole cpc.Url = url cpc.Remark = remark cpc.Mtime = mtime err := service.CreateChargePaymentCollection(&cpc) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "cpc": cpc, }) } func (this *CustomAPIController) DeletePaymentCollection() { id, _ := this.GetInt64("id") cpc, _ := service.FindPaymentCollectionInfo(id) if cpc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cpc.Status = 0 err := service.SaveChargePaymentCollection(&cpc) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } func (this *CustomAPIController) CheckPaymentCollection() { id, _ := this.GetInt64("id") cpc, _ := service.FindPaymentCollectionInfo(id) if cpc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cpc.IsCheck = 1 err := service.SaveChargePaymentCollection(&cpc) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "审核成功", }) } func (this *CustomAPIController) CreateContactInfo() { customID, _ := this.GetInt64("custom_id") contactName := this.GetString("contact_name") contactPhone := this.GetString("contact_phone") contactDuties := this.GetString("contact_duties") isDecision := this.GetString("is_decision") remark := this.GetString("remark") contact_way := this.GetString("contact_way") ctime := time.Now().Unix() mtime := time.Now().Unix() // 创建 KyyChargeContact 对象,并设置每个字段的值 contact := models.KyyChargeContact{ ID: 0, CustomId: customID, ContactName: contactName, ContactPhone: contactPhone, ContactDuties: contactDuties, IsDecision: isDecision, Remark: remark, Ctime: ctime, Mtime: mtime, Status: 1, Creator: 0, Modifier: 0, IsCheck: 0, ContactWay: contact_way, } err := service.SaveChargeContact(&contact) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "contact": contact, }) } func (this *CustomAPIController) GetContactInfoList() { list, _ := service.GetAllChargeContacts() this.ServeSuccessJSON(map[string]interface{}{ "list": list, }) } func (this *CustomAPIController) GetContactInfo() { id, _ := this.GetInt64("id") cc, _ := service.FindChargeContactInfo(id) if cc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } this.ServeSuccessJSON(map[string]interface{}{ "contact_info": cc, }) } func (this *CustomAPIController) EditContactInfo() { id, _ := this.GetInt64("id") contactName := this.GetString("contact_name") contactPhone := this.GetString("contact_phone") contactDuties := this.GetString("contact_duties") isDecision := this.GetString("is_decision") remark := this.GetString("remark") mtime := time.Now().Unix() chargeContact, _ := service.FindChargeContactInfo(id) if chargeContact.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } chargeContact.ContactName = contactName chargeContact.ContactPhone = contactPhone chargeContact.ContactDuties = contactDuties chargeContact.IsDecision = isDecision chargeContact.Remark = remark chargeContact.Remark = remark chargeContact.Mtime = mtime err := service.SaveChargeContact(&chargeContact) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "contact": chargeContact, }) } func (this *CustomAPIController) DeleteContactInfo() { id, _ := this.GetInt64("id") cc, _ := service.FindChargeContactInfo(id) if cc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cc.Status = 0 err := service.SaveChargeContact(&cc) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } func (this *CustomAPIController) CheckContactInfo() { id, _ := this.GetInt64("id") chargeContact, _ := service.FindChargeContactInfo(id) if chargeContact.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } chargeContact.IsCheck = 1 err := service.SaveChargeContact(&chargeContact) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "审核成功", }) } func (this *CustomAPIController) CreateContractInfo() { customID, _ := this.GetInt64("custom_id") code := this.GetString("code") name := this.GetString("name") sumamt := this.GetString("sumamt") custom_name := this.GetString("custom_name") start_time := this.GetString("start_time") end_time := this.GetString("end_time") signing_person := this.GetString("signing_person") wordFileURL := this.GetString("word_file_url") pdfFileURL := this.GetString("pdf_file_url") remark := this.GetString("remark") ctime := time.Now().Unix() mtime := time.Now().Unix() // 创建 KyyChargeContract 对象,并设置每个字段的值 contract := models.KyyChargeContract{ CustomId: customID, Code: code, Name: name, Sumamt: sumamt, StartTime: start_time, EndTime: end_time, SigningPerson: signing_person, WordFileUrl: wordFileURL, PdfFileUrl: pdfFileURL, CustomName: custom_name, Remark: remark, Ctime: ctime, Mtime: mtime, Status: 1, } err := service.SaveChargeContract(&contract) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "创建成功", }) } func (this *CustomAPIController) GetContractInfoList() { list, _ := service.GetAllChargeContracts() this.ServeSuccessJSON(map[string]interface{}{ "list": list, }) } func (this *CustomAPIController) GetContractInfo() { id, _ := this.GetInt64("id") cc, _ := service.FindChargeContractInfo(id) if cc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } this.ServeSuccessJSON(map[string]interface{}{ "charge_contract": cc, }) } func (this *CustomAPIController) EditContractInfo() { id, _ := this.GetInt64("id") code := this.GetString("code") name := this.GetString("name") customName := this.GetString("custom_name") sumamt := this.GetString("sumamt") startTime := this.GetString("start_time") endTime := this.GetString("end_time") signingPerson := this.GetString("signing_person") wordFileURL := this.GetString("word_file_url") pdfFileURL := this.GetString("pdf_file_url") remark := this.GetString("remark") mtime := time.Now().Unix() chargeContract, _ := service.FindChargeContractInfo(id) if chargeContract.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } chargeContract.Code = code chargeContract.Name = name chargeContract.CustomName = customName chargeContract.Sumamt = sumamt chargeContract.StartTime = startTime chargeContract.EndTime = endTime chargeContract.SigningPerson = signingPerson chargeContract.WordFileUrl = wordFileURL chargeContract.PdfFileUrl = pdfFileURL chargeContract.Remark = remark chargeContract.Mtime = mtime err := service.SaveChargeContract(&chargeContract) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "修改成功", }) } func (this *CustomAPIController) DeleteContractInfo() { id, _ := this.GetInt64("id") cc, _ := service.FindChargeContractInfo(id) if cc.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cc.Status = 0 err := service.SaveChargeContract(&cc) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } func (this *CustomAPIController) CheckContractInfo() { id, _ := this.GetInt64("id") chargeContract, _ := service.FindChargeContractInfo(id) if chargeContract.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } chargeContract.IsCheck = 1 err := service.SaveChargeContract(&chargeContract) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "审核成功", }) } func (this *CustomAPIController) CreateFollowInfo() { ctime := time.Now().Unix() mtime := time.Now().Unix() customID, _ := this.GetInt64("custom_id") desc := this.GetString("desc") // 创建 KyyChargeFollow 对象,并设置每个字段的值 follow := models.KyyChargeFollow{ Ctime: ctime, Mtime: mtime, Creator: this.GetAdminInfo().ID, CustomId: customID, Desc: desc, Status: 1, } err := service.SaveChargeFollow(&follow) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "follow": follow, }) } func (this *CustomAPIController) GetFollowInfoList() { list, _ := service.GetAllChargeFollow() this.ServeSuccessJSON(map[string]interface{}{ "list": list, }) } func (this *CustomAPIController) GetFollowInfo() { id, _ := this.GetInt64("id") follow, _ := service.FindChargeFollowInfo(id) if follow.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } this.ServeSuccessJSON(map[string]interface{}{ "follow": follow, }) } func (this *CustomAPIController) EditFollowInfo() { id, _ := this.GetInt64("id") desc := this.GetString("desc") chargeFollow, _ := service.FindChargeFollowInfo(id) chargeFollow.Desc = desc chargeFollow.Mtime = time.Now().Unix() err := service.SaveChargeFollow(&chargeFollow) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "follow": chargeFollow, }) } func (this *CustomAPIController) DeleteFollowInfo() { id, _ := this.GetInt64("id") follow, _ := service.FindChargeFollowInfo(id) if follow.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } follow.Status = 0 err := service.SaveChargeFollow(&follow) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } func (this *CustomAPIController) CheckFollowInfo() { id, _ := this.GetInt64("id") follow, _ := service.FindChargeFollowInfo(id) if follow.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } follow.IsCheck = 1 err := service.SaveChargeFollow(&follow) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "审核成功", }) } func (this *CustomAPIController) CreateDemandInfo() { demandType, _ := this.GetInt64("demand_type") demandDesc := this.GetString("demand_desc") demandStatus, _ := this.GetInt64("demand_status") demandCreator := this.GetString("demand_creator") demandCreateDate := this.GetString("demand_create_date") demandDirector := this.GetString("demand_director") ctime := time.Now().Unix() mtime := time.Now().Unix() customID, _ := this.GetInt64("custom_id") demandFinishDate := this.GetString("demand_finish_date") demandDetail := this.GetString("demand_detail") // 创建 KyyChargeDemand 对象,并设置每个字段的值 demand := models.KyyChargeDemand{ DemandType: demandType, DemandDesc: demandDesc, DemandStatus: demandStatus, DemandCreator: demandCreator, DemandCreateDate: demandCreateDate, DemandDirector: demandDirector, Ctime: ctime, Mtime: mtime, Status: 1, CustomId: customID, DemandFinishDate: demandFinishDate, DemandDetail: demandDetail, } err := service.SaveChargeDemand(&demand) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "demand": demand, }) } func (this *CustomAPIController) GetDemandInfoList() { list, _ := service.GetAllChargeDemand() this.ServeSuccessJSON(map[string]interface{}{ "list": list, }) } func (this *CustomAPIController) GetDemandInfo() { id, _ := this.GetInt64("id") cd, _ := service.FindChargeDemandInfo(id) if cd.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } this.ServeSuccessJSON(map[string]interface{}{ "charge_demand": cd, }) } func (this *CustomAPIController) EditDemandInfo() { id, _ := this.GetInt64("id") demandType, _ := this.GetInt64("demand_type") demandDesc := this.GetString("demand_desc") demandStatus, _ := this.GetInt64("demand_status") demandCreator := this.GetString("demand_creator") demandCreateDate := this.GetString("demand_create_date") demandFinishDate := this.GetString("demand_finish_date") demandDetail := this.GetString("demand_detail") demandDirector := this.GetString("demand_director") cd, _ := service.FindChargeDemandInfo(id) cd.DemandType = demandType cd.DemandDesc = demandDesc cd.DemandStatus = demandStatus cd.DemandCreator = demandCreator cd.DemandCreateDate = demandCreateDate cd.DemandFinishDate = demandFinishDate cd.DemandDirector = demandDirector cd.DemandDetail = demandDetail cd.Mtime = time.Now().Unix() err := service.SaveChargeDemand(&cd) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "demand": cd, }) } func (this *CustomAPIController) DeleteDemandInfo() { id, _ := this.GetInt64("id") cd, _ := service.FindChargeDemandInfo(id) if cd.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cd.Status = 0 err := service.SaveChargeDemand(&cd) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } func (this *CustomAPIController) CheckDemandInfo() { id, _ := this.GetInt64("id") cd, _ := service.FindChargeDemandInfo(id) if cd.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cd.IsCheck = 1 err := service.SaveChargeDemand(&cd) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "审核成功", }) } func (this *CustomAPIController) CreateRenewalInfo() { types, _ := this.GetInt64("type") startTime := this.GetString("start_time") endTime := this.GetString("end_time") signingPersonal := this.GetString("signing_personal") customID, _ := this.GetInt64("custom_id") signTime := this.GetString("sign_time") checkPersonal := this.GetString("check_personal") ctime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间 mtime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间 remark := this.GetString("remark") // 创建 KyyChargeRenewal 对象,并设置每个字段的值 renewal := models.KyyChargeRenewal{ Type: types, StartTime: startTime, EndTime: endTime, SigningPersonal: signingPersonal, CustomId: customID, SignTime: signTime, CheckPersonal: checkPersonal, Ctime: ctime, Mtime: mtime, Status: 1, Remark: remark, } err := service.SaveChargeRenewal(&renewal) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "renewal": renewal, }) } func (this *CustomAPIController) GetRenewalInfoList() { list, _ := service.GetAllChargeRenewal() this.ServeSuccessJSON(map[string]interface{}{ "list": list, }) } func (this *CustomAPIController) GetRenewalInfo() { id, _ := this.GetInt64("id") cr, _ := service.FindChargeRenewalInfo(id) if cr.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } this.ServeSuccessJSON(map[string]interface{}{ "charge_renewal": cr, }) } func (this *CustomAPIController) EditRenewalInfo() { types, _ := this.GetInt64("type") id, _ := this.GetInt64("id") startTime := this.GetString("start_time") endTime := this.GetString("end_time") signingPersonal := this.GetString("signing_personal") customID, _ := this.GetInt64("custom_id") signTime := this.GetString("sign_time") remark := this.GetString("remark") checkPersonal := this.GetString("check_personal") mtime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间 cr, _ := service.FindChargeRenewalInfo(id) if cr.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cr.Type = types cr.CustomId = customID cr.StartTime = startTime cr.EndTime = endTime cr.SigningPersonal = signingPersonal cr.SignTime = signTime cr.Mtime = mtime cr.Remark = remark cr.CheckPersonal = checkPersonal err := service.SaveChargeRenewal(&cr) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "cr": cr, }) } func (this *CustomAPIController) DeleteRenewalInfo() { id, _ := this.GetInt64("id") cr, _ := service.FindChargeRenewalInfo(id) if cr.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cr.Status = 0 err := service.SaveChargeRenewal(&cr) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "删除成功", }) } func (this *CustomAPIController) CheckRenewalInfo() { id, _ := this.GetInt64("id") cr, _ := service.FindChargeRenewalInfo(id) if cr.ID == 0 { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong) return } cr.IsCheck = 1 err := service.SaveChargeRenewal(&cr) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "msg": "审核成功", }) } func (c *CustomAPIController) GetQNUpToken() { redisClient := service.RedisClient() defer redisClient.Close() token, err := redisClient.Get("qn_token").Result() if err != nil { defer fmt.Println(err) c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken) return } c.ServeSuccessJSON(map[string]interface{}{ "uptoken": token, }) return }