陈少旭 пре 4 месеци
родитељ
комит
e7741b540f

+ 2 - 0
controllers/admin_api_controllers/admin_api_router_register.go Прегледај датотеку

@@ -17,6 +17,8 @@ func AdminAPIControllersRegisterRouters() {
17 17
 	beego.Router("/admin/api/custom/edit", &CustomAPIController{}, "post:ModifyCustom")
18 18
 	beego.Router("/admin/api/custom/list", &CustomAPIController{}, "get:GetCustomList")
19 19
 	beego.Router("/admin/api/custom/get", &CustomAPIController{}, "get:GetCustom")
20
+	beego.Router("/admin/api/custom/check", &CustomAPIController{}, "post:CheckCustom")
21
+
20 22
 	//beego.Router("/admin/api/checkcustom/get", &CustomAPIController{}, "get:GetWaitCheckCustom")
21 23
 
22 24
 	beego.Router("/admin/api/paymentcollection/create", &CustomAPIController{}, "post:CreatePaymentCollection")

+ 21 - 0
controllers/admin_api_controllers/custom_api_controller.go Прегледај датотеку

@@ -12,6 +12,26 @@ type CustomAPIController struct {
12 12
 	AdminBaseAPIAuthController
13 13
 }
14 14
 
15
+func (this *CustomAPIController) CheckCustom() {
16
+	id, _ := this.GetInt64("id")
17
+	ci, _ := service.FindCustomInfoByID(id)
18
+	if ci.ID == 0 {
19
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
20
+		return
21
+	}
22
+	ci.IsCheck = 1
23
+	ci.CheckPerson = this.GetAdminInfo().Name
24
+	err := service.SaveCustom(&ci)
25
+	if err != nil {
26
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
27
+		return
28
+	}
29
+	this.ServeSuccessJSON(map[string]interface{}{
30
+		"msg": "审核成功",
31
+	})
32
+
33
+}
34
+
15 35
 func (this *CustomAPIController) CreateCustom() {
16 36
 	name := this.GetString("name")
17 37
 	//xtOrgID := this.GetString("xt_org_id")
@@ -621,6 +641,7 @@ func (this *CustomAPIController) CreateContractInfo() {
621 641
 		Remark:        remark,
622 642
 		Ctime:         ctime,
623 643
 		Mtime:         mtime,
644
+		Status:        1,
624 645
 	}
625 646
 	err := service.SaveChargeContract(&contract)
626 647
 	if err != nil {

+ 2 - 0
models/custom.go Прегледај датотеку

@@ -116,6 +116,8 @@ type KyyChargeCustom struct {
116 116
 	KyyChargeDemand               []*KyyChargeDemand            `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cd"`
117 117
 	KyyChargeFollow               []*KyyChargeFollow            `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cf"`
118 118
 	KyyChargeRenewal              []*KyyChargeRenewal           `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cr"`
119
+	IsCheck                       int64                         `gorm:"column:is_check" json:"is_check" form:"is_check"`
120
+	CheckPerson                   string                        `gorm:"column:check_person" json:"check_person" form:"check_person"`
119 121
 }
120 122
 
121 123
 func (KyyChargeCustom) TableName() string {

+ 11 - 7
service/custom_service.go Прегледај датотеку

@@ -12,6 +12,10 @@ func CreateCustom(admin *models.KyyChargeCustom) (err error) {
12 12
 	return
13 13
 }
14 14
 
15
+func SaveCustom(admin *models.KyyChargeCustom) (err error) {
16
+	err = ChargeWriteDB().Model(&models.KyyChargeCustom{}).Create(&admin).Error
17
+	return
18
+}
15 19
 func GetAllCustoms() (cus []*models.KyyChargeCustom, err error) {
16 20
 	err = ChargeReadDB().Model(&models.KyyChargeCustomTwo{}).Where("status = 1").Find(&cus).Error
17 21
 	return
@@ -65,12 +69,12 @@ func UpdateCustom(custom models.KyyChargeCustom) (err error) {
65 69
 }
66 70
 
67 71
 func CreateChargePaymentCollection(cpc *models.KyyChargePaymentCollection) (err error) {
68
-	err = ChargeWriteDB().Save(cpc).Error
72
+	err = ChargeWriteDB().Save(&cpc).Error
69 73
 	return
70 74
 }
71 75
 
72 76
 func SaveChargePaymentCollection(cpc *models.KyyChargePaymentCollection) (err error) {
73
-	err = ChargeWriteDB().Save(cpc).Error
77
+	err = ChargeWriteDB().Save(&cpc).Error
74 78
 	return
75 79
 }
76 80
 
@@ -80,7 +84,7 @@ func FindPaymentCollectionInfo(id int64) (cpc models.KyyChargePaymentCollection,
80 84
 }
81 85
 
82 86
 func SaveChargeContact(chargeContact *models.KyyChargeContact) (err error) {
83
-	err = ChargeWriteDB().Save(chargeContact).Error
87
+	err = ChargeWriteDB().Save(&chargeContact).Error
84 88
 	return
85 89
 }
86 90
 
@@ -90,7 +94,7 @@ func FindChargeContactInfo(id int64) (cpc models.KyyChargeContact, err error) {
90 94
 }
91 95
 
92 96
 func SaveChargeContract(chargeContract *models.KyyChargeContract) (err error) {
93
-	err = ChargeWriteDB().Save(chargeContract).Error
97
+	err = ChargeWriteDB().Save(&chargeContract).Error
94 98
 	return
95 99
 }
96 100
 
@@ -100,7 +104,7 @@ func FindChargeContractInfo(id int64) (cpc models.KyyChargeContract, err error)
100 104
 }
101 105
 
102 106
 func SaveChargeFollow(chargeFollow *models.KyyChargeFollow) (err error) {
103
-	err = ChargeWriteDB().Save(chargeFollow).Error
107
+	err = ChargeWriteDB().Save(&chargeFollow).Error
104 108
 	return
105 109
 }
106 110
 
@@ -110,7 +114,7 @@ func FindChargeFollowInfo(id int64) (cf models.KyyChargeFollow, err error) {
110 114
 }
111 115
 
112 116
 func SaveChargeDemand(cd *models.KyyChargeDemand) (err error) {
113
-	err = ChargeWriteDB().Save(cd).Error
117
+	err = ChargeWriteDB().Save(&cd).Error
114 118
 	return
115 119
 }
116 120
 
@@ -120,7 +124,7 @@ func FindChargeDemandInfo(id int64) (cd models.KyyChargeDemand, err error) {
120 124
 }
121 125
 
122 126
 func SaveChargeRenewal(chargeRenewal *models.KyyChargeRenewal) (err error) {
123
-	err = ChargeWriteDB().Save(chargeRenewal).Error
127
+	err = ChargeWriteDB().Save(&chargeRenewal).Error
124 128
 	return
125 129
 }
126 130