xiaoming_global 5 anos atrás
pai
commit
3ae3f11f9f

+ 356 - 3
controllers/site/site_controller.go Ver arquivo

@@ -140,6 +140,18 @@ func siteRouters() {
140 140
 	beego.Router("/api/site/getenimagesthree",&Microwebsite{},"Get:GetEnImagesThree")
141 141
 	beego.Router("/api/site/addmagiclinkdata",&Microwebsite{},"Post:AddMagiclinkData")
142 142
 	beego.Router("/api/site/getmaclinkaddress",&Microwebsite{},"Get:GetMacLinkAddress")
143
+	beego.Router("/api/site/addmacgicform",&Microwebsite{},"Post:AddMacgicform")
144
+	beego.Router("/api/site/getmacimagesdetail",&Microwebsite{},"Get:GetMacImagesDetail")
145
+	beego.Router("/api/site/deletemaciamgesdetail",&Microwebsite{},"Post:DeleteMacImagesDetail")
146
+	beego.Router("/api/site/updatemacform",&Microwebsite{},"Post:UpdateMacForm")
147
+	beego.Router("/api/site/geteditmacimagedetail",&Microwebsite{},"Get:GetEditMacImageDetail")
148
+	beego.Router("/api/site/updateeditmacform",&Microwebsite{},"Post:UpdateEditMacForm")
149
+	beego.Router("/api/site/getLikeMacAddressById",&Microwebsite{},"Get:GetLikeMacAddressById")
150
+	beego.Router("/api/site/getarticlename",&Microwebsite{},"Get:GetArticleName")
151
+	beego.Router("/api/site/getallarticelist",&Microwebsite{},"Get:GetAllArticeList")
152
+	beego.Router("/api/site/updatelinkaddress",&Microwebsite{},"Post:UpdateLinkAddress")
153
+	beego.Router("/api/site/addmaclinkaddress",&Microwebsite{},"Post:AddMacLinkAddress")
154
+	beego.Router("/api/site/getlinkaddress",&Microwebsite{},"Get:GetLinkAddress")
143 155
 }
144 156
 
145 157
 type Microwebsite struct {
@@ -2275,6 +2287,8 @@ func (this *Microwebsite) AddrotationImage()  {
2275 2287
 func (this *Microwebsite)  AddImageslink()  {
2276 2288
 	adminUserInfo := this.GetAdminUserInfo()
2277 2289
 	userOrgID := int64(adminUserInfo.CurrentOrgId)
2290
+	id, _ := this.GetInt64("id")
2291
+	fmt.Println("id是多少",id)
2278 2292
 	dataBody := make(map[string]interface{}, 0)
2279 2293
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2280 2294
 	if err != nil {
@@ -2311,6 +2325,7 @@ func (this *Microwebsite)  AddImageslink()  {
2311 2325
 		UserOrgId:   userOrgID,
2312 2326
 		Modeid:0,
2313 2327
 		ImgShow:1,
2328
+		Linkid:id,
2314 2329
 	}
2315 2330
 
2316 2331
 	err = site_service.AddImageslink(&editpiclink)
@@ -2341,6 +2356,8 @@ func (this *Microwebsite) AddMagicNavi()  {
2341 2356
 	adminUserInfo := this.GetAdminUserInfo()
2342 2357
 	userOrgID := int64(adminUserInfo.CurrentOrgId)
2343 2358
 	fmt.Println("这个是",userOrgID)
2359
+	id, _ := this.GetInt64("id")
2360
+	fmt.Println("id是多少",id)
2344 2361
 	dataBody := make(map[string]interface{}, 0)
2345 2362
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2346 2363
 	if err != nil {
@@ -2383,6 +2400,7 @@ func (this *Microwebsite) AddMagicNavi()  {
2383 2400
 		UserOrgId:     userOrgID,
2384 2401
 		ImgShow:1,
2385 2402
 		Modeid:0,
2403
+		Linkid:id,
2386 2404
 	}
2387 2405
 
2388 2406
 	err = site_service.AddMagicNavi(&editmargin)
@@ -3468,7 +3486,7 @@ func(this *Microwebsite) GetMacImages()  {
3468 3486
 	fmt.Println("错误是设么",err)
3469 3487
 	fmt.Println("model是什么",model)
3470 3488
 	macnavigation, err := site_service.GetMacImagesByModeid(id, userOrgID)
3471
-	fmt.Println("返回数据",macnavigation)
3489
+	fmt.Println("中袖返回数据",macnavigation)
3472 3490
 	fmt.Println("错误",err)
3473 3491
 	if err !=nil{
3474 3492
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
@@ -4131,10 +4149,11 @@ func (this *Microwebsite) AddMagiclinkData()  {
4131 4149
 	fmt.Println("文章分类",articeType)
4132 4150
 	phone := dataBody["phone"].(string)
4133 4151
 	fmt.Println("电话号码",phone)
4134
-	outstationlink := dataBody["OutstationLink"].(string)
4152
+	outstationlink := dataBody["outstationlink"].(string)
4135 4153
 	fmt.Println("站外链接",outstationlink)
4136 4154
 	linkaddress := dataBody["linkaddress"].(string)
4137 4155
 	fmt.Println("链接地址",linkaddress)
4156
+	articeTtitle := int64(dataBody["title"].(float64))
4138 4157
 	if(phone != ""){
4139 4158
 		linkaddress = phone
4140 4159
 	}
@@ -4150,14 +4169,18 @@ func (this *Microwebsite) AddMagiclinkData()  {
4150 4169
 		Ctime:time.Now().Unix(),
4151 4170
 		Status:1,
4152 4171
 		Linkaddress:linkaddress,
4172
+		UserOrgId:userOrgID,
4173
+		Title:articeTtitle,
4153 4174
 	}
4154 4175
 	err = site_service.AddMagiclinkData(&magiclink)
4176
+	patientMagiclink, err := site_service.GetMacLinkAddress(userOrgID)
4155 4177
 	if err !=nil{
4156 4178
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4157 4179
 		return
4158 4180
 	}
4159 4181
 	this.ServeSuccessJSON(map[string]interface{}{
4160 4182
 		"magiclink":magiclink,
4183
+		"patientMagiclink":patientMagiclink,
4161 4184
 	})
4162 4185
 }
4163 4186
 
@@ -4166,6 +4189,8 @@ func  (this *Microwebsite) GetMacLinkAddress()  {
4166 4189
 	userOrgID := adminUserInfo.CurrentOrgId
4167 4190
 	fmt.Println("机构ID",userOrgID)
4168 4191
 	magiclink, err := site_service.GetMacLinkAddress(userOrgID)
4192
+	fmt.Println("magiclink",magiclink)
4193
+	fmt.Println("中秋梦玲",err)
4169 4194
 	if err !=nil{
4170 4195
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4171 4196
 		return
@@ -4173,4 +4198,332 @@ func  (this *Microwebsite) GetMacLinkAddress()  {
4173 4198
 	this.ServeSuccessJSON(map[string]interface{}{
4174 4199
 		"magiclink":magiclink,
4175 4200
 	})
4176
-}
4201
+}
4202
+
4203
+func (this *Microwebsite) AddMacgicform() {
4204
+	adminUserInfo := this.GetAdminUserInfo()
4205
+	userOrgID := adminUserInfo.CurrentOrgId
4206
+	fmt.Println("机构ID", userOrgID)
4207
+	id, _ := this.GetInt64("id")
4208
+	fmt.Println("id是多少", id)
4209
+	dataBody := make(map[string]interface{}, 0)
4210
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4211
+	if err != nil {
4212
+		utils.ErrorLog(err.Error())
4213
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
4214
+		return
4215
+	}
4216
+	title := dataBody["title"].(string)
4217
+	fmt.Println("导航标题", title)
4218
+	macgicimages := dataBody["macgicimages"].(string)
4219
+	fmt.Println("导航图标", macgicimages)
4220
+	jumpset := int64(dataBody["jumpset"].(float64))
4221
+	fmt.Println("跳转设置", jumpset)
4222
+	linkaddress := dataBody["linkaddress"].(string)
4223
+	fmt.Println("链接地址", linkaddress)
4224
+	editmargin := models.SgjPatientEditmargin{
4225
+		Margtitle:     title,
4226
+		Margimage:     macgicimages,
4227
+		Jumpset:       jumpset,
4228
+		Marginaddress: macgicimages,
4229
+		UserOrgId:userOrgID,
4230
+		Modeid:        id,
4231
+		Status:        1,
4232
+		Ctime:         time.Now().Unix(),
4233
+	}
4234
+	err = site_service.AddMacgicform(&editmargin)
4235
+	if err !=nil{
4236
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4237
+		return
4238
+	}
4239
+	this.ServeSuccessJSON(map[string]interface{}{
4240
+		"editmargin":editmargin,
4241
+	})
4242
+}
4243
+
4244
+func (this *Microwebsite) GetMacImagesDetail()  {
4245
+	adminUserInfo := this.GetAdminUserInfo()
4246
+	userOrgID := adminUserInfo.CurrentOrgId
4247
+	fmt.Println("机构ID", userOrgID)
4248
+	id, _ := this.GetInt64("id")
4249
+	fmt.Println("id是多少", id)
4250
+	editmargin, err := site_service.GetMacImagesDetail(userOrgID, id)
4251
+	if err !=nil{
4252
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4253
+		return
4254
+	}
4255
+	this.ServeSuccessJSON(map[string]interface{}{
4256
+		"editmargin":editmargin,
4257
+	})
4258
+}
4259
+
4260
+func (this *Microwebsite) DeleteMacImagesDetail()  {
4261
+	adminUserInfo := this.GetAdminUserInfo()
4262
+	userOrgID := adminUserInfo.CurrentOrgId
4263
+	fmt.Println("机构ID", userOrgID)
4264
+	id, _ := this.GetInt64("id")
4265
+	fmt.Println("id是多少", id)
4266
+	err := site_service.DeletMacImagesDetail(id, userOrgID)
4267
+	if err !=nil{
4268
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
4269
+		return
4270
+	}
4271
+
4272
+	returnData := make(map[string]interface{}, 0)
4273
+	returnData["msg"] = "ok"
4274
+	this.ServeSuccessJSON(returnData)
4275
+	return
4276
+}
4277
+
4278
+func (this*Microwebsite) UpdateMacForm()  {
4279
+	adminUserInfo := this.GetAdminUserInfo()
4280
+	userOrgID := adminUserInfo.CurrentOrgId
4281
+	fmt.Println("机构ID", userOrgID)
4282
+	id, _ := this.GetInt64("id")
4283
+	fmt.Println("id是多少", id)
4284
+	dataBody := make(map[string]interface{}, 0)
4285
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4286
+	if err != nil {
4287
+		utils.ErrorLog(err.Error())
4288
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
4289
+		return
4290
+	}
4291
+	title := dataBody["title"].(string)
4292
+	fmt.Println("导航标题", title)
4293
+	sort := int64(dataBody["sort"].(float64))
4294
+	fmt.Println("排序",sort)
4295
+	model := models.SgjPatientModel{
4296
+		Title: title,
4297
+		Sort:  sort,
4298
+	}
4299
+	err = site_service.UpdateModel(id, userOrgID, model)
4300
+	if err !=nil{
4301
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4302
+		return
4303
+	}
4304
+	this.ServeSuccessJSON(map[string]interface{}{
4305
+		"model":model,
4306
+	})
4307
+}
4308
+
4309
+func (this*Microwebsite) GetEditMacImageDetail()  {
4310
+	adminUserInfo := this.GetAdminUserInfo()
4311
+	userOrgID := adminUserInfo.CurrentOrgId
4312
+	fmt.Println("机构中秋ID", userOrgID)
4313
+	id, _ := this.GetInt64("id")
4314
+	fmt.Println("机构宗秀id",id)
4315
+	editmargin, err := site_service.GetEditMacImageDetailById(userOrgID, id)
4316
+	fmt.Println("ditmargin",editmargin)
4317
+	fmt.Println("错误",err)
4318
+	if err !=nil{
4319
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4320
+		return
4321
+	}
4322
+	this.ServeSuccessJSON(map[string]interface{}{
4323
+		"editmargin":editmargin,
4324
+	})
4325
+}
4326
+
4327
+func (this*Microwebsite) UpdateEditMacForm()  {
4328
+	adminUserInfo := this.GetAdminUserInfo()
4329
+	userOrgID := adminUserInfo.CurrentOrgId
4330
+	fmt.Println("机构中秋ID", userOrgID)
4331
+	id, _ := this.GetInt64("id")
4332
+	fmt.Println("中秋id",id)
4333
+	dataBody := make(map[string]interface{}, 0)
4334
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4335
+	if err != nil {
4336
+		utils.ErrorLog(err.Error())
4337
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
4338
+		return
4339
+	}
4340
+	margtitle := dataBody["margtitle"].(string)
4341
+	fmt.Println("导航标题", margtitle)
4342
+	margimage := dataBody["margimage"].(string)
4343
+	fmt.Println("导航图片",margimage)
4344
+	jumpset := int64(dataBody["jumpset"].(float64))
4345
+	fmt.Println("导航设置",jumpset)
4346
+	marginaddress := dataBody["marginaddress"].(string)
4347
+	fmt.Println("链接地址",marginaddress)
4348
+	editmargin := models.SgjPatientEditmargin{
4349
+		Margtitle:     margtitle,
4350
+		Margimage:     margimage,
4351
+		Jumpset:       jumpset,
4352
+		Marginaddress: marginaddress,
4353
+	}
4354
+	err = site_service.UpdateEditMacFormById(id, userOrgID, editmargin)
4355
+	fmt.Println("爆粗",err)
4356
+	if err !=nil{
4357
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4358
+		return
4359
+	}
4360
+	this.ServeSuccessJSON(map[string]interface{}{
4361
+		"editmargin":editmargin,
4362
+	})
4363
+}
4364
+
4365
+func (this*Microwebsite) GetLikeMacAddressById()  {
4366
+	adminUserInfo := this.GetAdminUserInfo()
4367
+	userOrgID := adminUserInfo.CurrentOrgId
4368
+	//fmt.Println("机构中秋ID", userOrgID)
4369
+	id, _ := this.GetInt64("id")
4370
+	//fmt.Println("中秋id",id)
4371
+	magiclink, err := site_service.GetLikeMacAddressById(userOrgID, id)
4372
+	//fmt.Println("中秋快乐",magiclink)
4373
+	fmt.Println("错误",err)
4374
+	if err !=nil{
4375
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4376
+		return
4377
+	}
4378
+	this.ServeSuccessJSON(map[string]interface{}{
4379
+		"magiclink":magiclink,
4380
+	})
4381
+}
4382
+
4383
+func (this*Microwebsite) GetArticleName()  {
4384
+	adminUserInfo := this.GetAdminUserInfo()
4385
+	userOrgID := adminUserInfo.CurrentOrgId
4386
+	fmt.Println("ID", userOrgID)
4387
+	id, _ := this.GetInt64("id")
4388
+	articlelist, err := site_service.GetArticleById(id, userOrgID)
4389
+	if err !=nil{
4390
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4391
+		return
4392
+	}
4393
+	this.ServeSuccessJSON(map[string]interface{}{
4394
+		"articlelist":articlelist,
4395
+	})
4396
+}
4397
+
4398
+func  (this*Microwebsite) GetAllArticeList()  {
4399
+	adminUserInfo := this.GetAdminUserInfo()
4400
+	userOrgID := adminUserInfo.CurrentOrgId
4401
+	articles, err := site_service.GetAllArticeList(userOrgID)
4402
+	if err !=nil{
4403
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4404
+		return
4405
+	}
4406
+	this.ServeSuccessJSON(map[string]interface{}{
4407
+		"articles":articles,
4408
+	})
4409
+}
4410
+
4411
+func  (this*Microwebsite) UpdateLinkAddress()  {
4412
+	adminUserInfo := this.GetAdminUserInfo()
4413
+	userOrgID := adminUserInfo.CurrentOrgId
4414
+	fmt.Println("机构id", userOrgID)
4415
+	id, _:= this.GetInt64("id")
4416
+	fmt.Println("id",id)
4417
+	dataBody := make(map[string]interface{}, 0)
4418
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4419
+	if err != nil {
4420
+		utils.ErrorLog(err.Error())
4421
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
4422
+		return
4423
+	}
4424
+	linktype := int64(dataBody["linktype"].(float64))
4425
+	fmt.Println("链接类型",linktype)
4426
+	instationlink := int64(dataBody["instationlink"].(float64))
4427
+	fmt.Println("站类李恩杰",instationlink)
4428
+	articetype := int64(dataBody["articetype"].(float64))
4429
+	fmt.Println("文章類型",articetype)
4430
+	title := int64(dataBody["title"].(float64))
4431
+	fmt.Println("文章標題",title)
4432
+	phone := dataBody["phone"].(string)
4433
+	fmt.Println("電話",phone)
4434
+	outstationlink := dataBody["outstationlink"].(string)
4435
+	fmt.Println("展望列哪家",outstationlink)
4436
+	linkaddress := dataBody["linkaddress"].(string)
4437
+	fmt.Println("链接地址",linkaddress)
4438
+	if(phone != ""){
4439
+		linkaddress = phone;
4440
+	}
4441
+	if(outstationlink != ""){
4442
+		linkaddress = outstationlink;
4443
+	}
4444
+	magiclink := models.SgjPatientMagiclink{
4445
+		Linktype:       linktype,
4446
+		Instationlink:  instationlink,
4447
+		Articetype:     articetype,
4448
+		Title:          title,
4449
+		Phone:          phone,
4450
+		Outstationlink: outstationlink,
4451
+		Linkaddress:    linkaddress,
4452
+	}
4453
+	fmt.Println(magiclink)
4454
+	err = site_service.UpdateLinkAddress(id, userOrgID, magiclink)
4455
+	fmt.Println("报错误",err)
4456
+	if err !=nil{
4457
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4458
+		return
4459
+	}
4460
+	this.ServeSuccessJSON(map[string]interface{}{
4461
+		"magiclink":magiclink,
4462
+	})
4463
+}
4464
+
4465
+func  (this*Microwebsite) AddMacLinkAddress()  {
4466
+	adminUserInfo := this.GetAdminUserInfo()
4467
+	userOrgID := adminUserInfo.CurrentOrgId
4468
+	fmt.Println("机构id", userOrgID)
4469
+	dataBody := make(map[string]interface{}, 0)
4470
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4471
+	if err != nil {
4472
+		utils.ErrorLog(err.Error())
4473
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
4474
+		return
4475
+	}
4476
+	linktype := int64(dataBody["linktype"].(float64))
4477
+	fmt.Println("链接类型",linktype)
4478
+	instationlink := int64(dataBody["instationlink"].(float64))
4479
+	fmt.Println("站内链接",instationlink)
4480
+	articetype := int64(dataBody["articetype"].(float64))
4481
+	fmt.Println("文字类型",articetype)
4482
+	title := int64(dataBody["title"].(float64))
4483
+	fmt.Println("文章id",title)
4484
+	phone := dataBody["phone"].(string)
4485
+	fmt.Println("电话",phone)
4486
+	outstationlink := dataBody["outstationlink"].(string)
4487
+	fmt.Println("站内链接",outstationlink)
4488
+	linkaddress := dataBody["linkaddress"].(string)
4489
+	fmt.Println("链接地址",linkaddress)
4490
+	magiclink := models.SgjPatientMagiclink{
4491
+		Linktype:       linktype,
4492
+		Instationlink:  instationlink,
4493
+		Articetype:     articetype,
4494
+		Title:          title,
4495
+		Phone:          phone,
4496
+		Outstationlink: outstationlink,
4497
+		Linkaddress:    linkaddress,
4498
+		Ctime:time.Now().Unix(),
4499
+		Status:1,
4500
+		UserOrgId:userOrgID,
4501
+	}
4502
+	err = site_service.AddMacLinkAddress(&magiclink)
4503
+	patientMagiclink, err := site_service.GetMacLinkAddress(userOrgID)
4504
+	if err !=nil{
4505
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4506
+		return
4507
+	}
4508
+	this.ServeSuccessJSON(map[string]interface{}{
4509
+		"patientMagiclink":patientMagiclink,
4510
+		"magiclink":magiclink,
4511
+	})
4512
+
4513
+}
4514
+
4515
+func  (this*Microwebsite) GetLinkAddress()  {
4516
+	adminUserInfo := this.GetAdminUserInfo()
4517
+	userOrgID := adminUserInfo.CurrentOrgId
4518
+	fmt.Println("机构id", userOrgID)
4519
+	id, _:= this.GetInt64("id")
4520
+	fmt.Println("id",id)
4521
+	linkaddress, err := site_service.GetPatientLinkAddress(id, userOrgID)
4522
+	if err !=nil{
4523
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4524
+		return
4525
+	}
4526
+	this.ServeSuccessJSON(map[string]interface{}{
4527
+		"linkaddress":linkaddress,
4528
+	})
4529
+}

+ 4 - 1
models/site_models.go Ver arquivo

@@ -35,6 +35,7 @@ type SgjPatientModel struct {
35 35
 	Macnavigation  SgjPatientMacnavigation `gorm:"ForeignKey:Modeid"`
36 36
 	Addactivity  SgjPatientAddactivity `gorm:"ForeignKey:Modeid"`
37 37
 	Articlelist  SgjPatientArticlelist `gorm:"ForeignKey:Modeid"`
38
+	Editmargin  []SgjPatientEditmargin `gorm:"ForeignKey:Modeid"`
38 39
 
39 40
 
40 41
 
@@ -365,13 +366,13 @@ type SgjPatientEditpiclink struct {
365 366
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
366 367
 	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
367 368
 	ImgShow int64 `gorm:"column:img_show" json:"img_show" form:"img_show"`
369
+	Linkid int64 `gorm:"column:linkid" json:"linkid" form:"linkid"`
368 370
 }
369 371
 
370 372
 func (SgjPatientEditpiclink) TableName() string  {
371 373
 
372 374
 	return "sgj_patient_editpiclink"
373 375
 }
374
-
375 376
 type SgjPatientEditmargin struct {
376 377
 	ID int64 `gorm:"column:id" json:"id" form:"id"`
377 378
 	Margtitle string `gorm:"column:margtitle" json:"margtitle" form:"margtitle"`
@@ -384,6 +385,7 @@ type SgjPatientEditmargin struct {
384 385
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
385 386
 	ImgShow int64 `gorm:"column:img_show" json:"img_show" form:"img_show"`
386 387
 	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
388
+	Linkid int64 `gorm:"column:linkid" json:"linkid" form:"linkid"`
387 389
 }
388 390
 
389 391
 func (SgjPatientEditmargin) TableName() string {
@@ -513,6 +515,7 @@ type SgjPatientMagiclink struct {
513 515
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
514 516
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
515 517
 	Linkaddress string `gorm:"column:linkaddress" json:"linkaddress" form:"linkaddress"`
518
+	Title int64 `gorm:"column:title" json:"title" form:"title"`
516 519
 }
517 520
 
518 521
 func (SgjPatientMagiclink)TableName() string  {

+ 60 - 5
service/site_service/site_microwebsite_service.go Ver arquivo

@@ -261,7 +261,7 @@ func GetData(orgid int64)(model []*models.SgjPatientModel,err error)  {
261 261
 		db = db.Where("user_org_id = ? ", orgid)
262 262
 	}
263 263
 	err = db.Preload("Hospitals").Preload("Offices").Preload("Doctors").Preload("OfficeEnviroment").
264
-		Preload("Editdoctor").Preload("Rotation").Preload("Macnavigation").
264
+		Preload("Editdoctor").Preload("Rotation").Preload("Macnavigation").Preload("Editmargin").
265 265
 		Select("m.id,m.title,m.sort,m.ctime,m.mtime,m.user_org_id,m.status,m.mode_type").Order("sort").Find(&model).Error
266 266
 	return
267 267
 }
@@ -740,9 +740,9 @@ func UpdateArticeDetail(id int64,orgid int64,articlelist models.SgjPatientArticl
740 740
 	return  err
741 741
 }
742 742
 
743
-func GetMacImagesByModeid(modeid int64,orgid int64)(models.SgjPatientMacnavigation,error)  {
744
-	macnavigation := models.SgjPatientMacnavigation{}
745
-	err := service.PatientReadDB().Model(macnavigation).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&macnavigation).Error
743
+func GetMacImagesByModeid(modeid int64,orgid int64)(macnavigation []models.SgjPatientEditmargin,err error)  {
744
+
745
+	err = service.PatientReadDB().Model(macnavigation).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&macnavigation).Error
746 746
 	return macnavigation,err
747 747
 }
748 748
 
@@ -898,7 +898,7 @@ func AddMagiclinkData(magiclink *models.SgjPatientMagiclink)error  {
898 898
 
899 899
 func GetMacLinkAddress(orgid int64)(models.SgjPatientMagiclink,error) {
900 900
 	patientMagiclink := models.SgjPatientMagiclink{}
901
-	err := service.PatientReadDB().Model(&patientMagiclink).Where("user_org_id = ? AND status = ", orgid, 1).Last(&patientMagiclink).Error
901
+	err := service.PatientReadDB().Model(&patientMagiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&patientMagiclink).Error
902 902
 	return patientMagiclink,err
903 903
 }
904 904
 
@@ -909,4 +909,59 @@ func UpdateEditMagin(orgid int64,ids[] int64,editmargin models.SgjPatientEditmar
909 909
 		err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id IN(?) and user_org_id = ? ", ids, orgid).Update(map[string]interface{}{"modeid": editmargin.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
910 910
 	}
911 911
 	return
912
+}
913
+
914
+func AddMacgicform(editmargin *models.SgjPatientEditmargin)error {
915
+	err := service.PatientWriteDB().Create(&editmargin).Error
916
+	return err
917
+}
918
+
919
+func GetMacImagesDetail(orgid int64,modeid int64)(editmargin []models.SgjPatientEditmargin,err error)  {
920
+	err = service.PatientReadDB().Model(&editmargin).Where("user_org_id = ? AND status = ? AND modeid = ?", orgid, 1, modeid).Find(&editmargin).Error
921
+	return editmargin,err
922
+}
923
+
924
+func DeletMacImagesDetail(id int64,orgid int64)(error)  {
925
+	err := service.PatientWriteDB().Model(models.SgjPatientEditmargin{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0,"modeid":0, "mtime": time.Now().Unix()}).Error
926
+	return err
927
+}
928
+
929
+func GetEditMacImageDetailById(orgid int64,id int64)(models.SgjPatientEditmargin,error)  {
930
+	editmargin := models.SgjPatientEditmargin{}
931
+	err := service.PatientReadDB().Where("user_org_id = ? AND id = ?", orgid, id).Find(&editmargin).Error
932
+	return editmargin,err
933
+}
934
+
935
+func UpdateEditMacFormById(id int64,orgid int64,editmargin models.SgjPatientEditmargin)(err error)  {
936
+	err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"margtitle": editmargin.Margtitle, "margimage": editmargin.Margimage, "jumpset": editmargin.Jumpset, "marginaddress": editmargin.Marginaddress, "mtime": time.Now().Unix()}).Error
937
+	return err
938
+}
939
+
940
+func GetLikeMacAddressById(orgid int64,id int64)(models.SgjPatientMagiclink,error)  {
941
+      magiclink := models.SgjPatientMagiclink{}
942
+	err := service.PatientReadDB().Where("user_org_id = ? AND id = ?", orgid, id).Find(&magiclink).Error
943
+	return magiclink,err
944
+}
945
+
946
+func GetAllArticeList(orgid int64)(articles []models.Articles,err error)  {
947
+	err = service.PatientReadDB().Model(&articles).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&articles).Error
948
+	return articles,err
949
+}
950
+
951
+func UpdateLinkAddress(id int64,orgid int64,magiclink models.SgjPatientMagiclink)error  {
952
+
953
+	err := service.PatientWriteDB().Model(&models.SgjPatientMagiclink{}).Where("id = ? AND user_org_id = ? ", id, orgid).Update(map[string]interface{}{"linktype": magiclink.Linktype, "instationlink": magiclink.Instationlink, "articetype": magiclink.Articetype, "phone": magiclink.Phone, "outstationlink": magiclink.Outstationlink, "linkaddress": magiclink.Linkaddress, "title": magiclink.Title, "mtime": time.Now().Unix()}).Error
954
+	return err
955
+}
956
+
957
+func AddMacLinkAddress(magiclink *models.SgjPatientMagiclink)error  {
958
+
959
+	err := service.PatientWriteDB().Create(&magiclink).Error
960
+	return  err
961
+}
962
+
963
+func GetPatientLinkAddress(id int64,orgid int64)(models.SgjPatientLinkaddress,error)  {
964
+	linkaddress := models.SgjPatientLinkaddress{}
965
+	err := service.PatientReadDB().Where(" id = ? AND user_org_id = ?", id, orgid).Find(&linkaddress).Error
966
+	return  linkaddress,err
912 967
 }