xiaoming_global 5 年之前
父節點
當前提交
77dc600d14

+ 1 - 1
conf/app.conf 查看文件

81
 
81
 
82
 [dev]
82
 [dev]
83
 httpdomain = http://api.test1.sgjyun.com
83
 httpdomain = http://api.test1.sgjyun.com
84
-sso_domain = http://testsso.sgjyun.com
84
+sso_domain = https://testsso.sgjyun.com
85
 front_end_domain = "http://test1.sgjyun.com/#"
85
 front_end_domain = "http://test1.sgjyun.com/#"
86
 
86
 
87
 openwechattoken = dwqofqon2e12en2o
87
 openwechattoken = dwqofqon2e12en2o

+ 55 - 12
controllers/article/article_controller.go 查看文件

29
 	beego.Router("/api/acticle/prviewArticle",&ArticleManage{},"Post:PrviewArticle")
29
 	beego.Router("/api/acticle/prviewArticle",&ArticleManage{},"Post:PrviewArticle")
30
 	beego.Router("/api/acticle/getarticlePreview",&ArticleManage{},"Get:GetArtilcePreview")
30
 	beego.Router("/api/acticle/getarticlePreview",&ArticleManage{},"Get:GetArtilcePreview")
31
 	beego.Router("/api/acticle/save",&ArticleManage{},"Post:AddDraft")
31
 	beego.Router("/api/acticle/save",&ArticleManage{},"Post:AddDraft")
32
-	beego.Router("/api/acticle/getEditArticle",&ArticleManage{},"Get:GetArticleInfo")
32
+	beego.Router("/api/acticle/getEditArticle",&ArticleManage{},"Post:GetArticleInfo")
33
 	beego.Router("/api/article/Delete",&ArticleManage{},"Delete:DeleteArticle")
33
 	beego.Router("/api/article/Delete",&ArticleManage{},"Delete:DeleteArticle")
34
 	beego.Router("/api/acticle/getMenus",&ArticleManage{},"Get:GetMenus")
34
 	beego.Router("/api/acticle/getMenus",&ArticleManage{},"Get:GetMenus")
35
 	beego.Router("/api/acticle/updateArticlesInfo",&ArticleManage{},"Post:UpdataArticleInfo")
35
 	beego.Router("/api/acticle/updateArticlesInfo",&ArticleManage{},"Post:UpdataArticleInfo")
53
     beego.Router("/api/acticle/savevidodraft",&ArticleManage{},"Post:SaveVidoDraft")
53
     beego.Router("/api/acticle/savevidodraft",&ArticleManage{},"Post:SaveVidoDraft")
54
 	beego.Router("/api/article/openDeleteReply",&ArticleManage{},"Delete:DeleteAllReply")
54
 	beego.Router("/api/article/openDeleteReply",&ArticleManage{},"Delete:DeleteAllReply")
55
 	beego.Router("/api/article/deleteAllArticles",&ArticleManage{},"Delete:DeleteAllArticles")
55
 	beego.Router("/api/article/deleteAllArticles",&ArticleManage{},"Delete:DeleteAllArticles")
56
-
56
+	beego.Router("api/aritcle/getallcategory",&ArticleManage{},"Get:GetAllCategory")
57
 }
57
 }
58
 
58
 
59
 type ArticleManage struct {
59
 type ArticleManage struct {
154
 	if limit <= 0 {
154
 	if limit <= 0 {
155
 		limit = 10
155
 		limit = 10
156
 	}
156
 	}
157
-
158
-
159
 	adminUserInfo := this.GetAdminUserInfo()
157
 	adminUserInfo := this.GetAdminUserInfo()
160
 	userOrgID := adminUserInfo.CurrentOrgId
158
 	userOrgID := adminUserInfo.CurrentOrgId
161
-	org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
162
-	OrgName := org.OrgName
163
-	fmt.Println("机构姓名:",OrgName)
159
+	//org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
160
+	//OrgName := org.OrgName
161
+	//fmt.Println("机构姓名:",OrgName)
164
 	if(status == 1){
162
 	if(status == 1){
165
 		articles, total, err := article_service.GetPublished(userOrgID, page, limit, searchKey)
163
 		articles, total, err := article_service.GetPublished(userOrgID, page, limit, searchKey)
166
 		category, err := article_service.FindCategoryList(userOrgID)
164
 		category, err := article_service.FindCategoryList(userOrgID)
165
+		fmt.Println("分类号",category)
167
 		if err !=nil{
166
 		if err !=nil{
168
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取文章分类列表失败")
167
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取文章分类列表失败")
169
 			return
168
 			return
172
 			"articles":articles,
171
 			"articles":articles,
173
 			"total":total,
172
 			"total":total,
174
 			"category":category,
173
 			"category":category,
175
-			"OrgName":OrgName,
174
+
176
 		})
175
 		})
177
 	}
176
 	}
178
 	if(status == 2){
177
 	if(status == 2){
186
 			"articles":articles,
185
 			"articles":articles,
187
 			"total":total,
186
 			"total":total,
188
 			"category":category,
187
 			"category":category,
189
-			"OrgName":OrgName,
188
+
190
 		})
189
 		})
191
 	}
190
 	}
192
 
191
 
201
 			"articles":articles,
200
 			"articles":articles,
202
 			"total":total,
201
 			"total":total,
203
 			"category":category,
202
 			"category":category,
204
-			"OrgName":OrgName,
205
 		})
203
 		})
206
 	}
204
 	}
207
 
205
 
223
 		"articles":articles,
221
 		"articles":articles,
224
 		"total":total,
222
 		"total":total,
225
 		"category":category,
223
 		"category":category,
226
-		"OrgName":OrgName,
224
+
227
 	})
225
 	})
228
 	return
226
 	return
229
 }
227
 }
228
+
229
+//func (this *ArticleManage) GetAllartic()  {
230
+//	page, _ := this.GetInt64("page", 1)
231
+//	fmt.Println("页面2",page)
232
+//	limit, _ := this.GetInt64("limit", 10)
233
+//	fmt.Println("限制3",limit)
234
+//	adminUserInfo := this.GetAdminUserInfo()
235
+//	userOrgID := adminUserInfo.CurrentOrgId
236
+//	if page <= 0 {
237
+//		page = 1
238
+//	}
239
+//	if limit <= 0 {
240
+//		limit = 10
241
+//	}
242
+//	articles, total, err := article_service.GetAllartic(page, limit, userOrgID)
243
+//	fmt.Println("articles",articles)
244
+//	fmt.Println("total",total)
245
+//	fmt.Println("err",err)
246
+//	if err !=nil{
247
+//		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取文章分类列表失败")
248
+//		return
249
+//	}
250
+//	//org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
251
+//	//OrgName := org.OrgName
252
+//	//fmt.Println("OrgName",OrgName)
253
+//	this.ServeSuccessJSON(map[string]interface{}{
254
+//		"articles":articles,
255
+//		"total":total,
256
+//	})
257
+//}
258
+
230
 func (this *ArticleManage) AddCategory(){
259
 func (this *ArticleManage) AddCategory(){
231
 
260
 
232
 	dataBody := make(map[string]interface{}, 0)
261
 	dataBody := make(map[string]interface{}, 0)
714
 	adminUserInfo := this.GetAdminUserInfo()
743
 	adminUserInfo := this.GetAdminUserInfo()
715
 	userOrgID := adminUserInfo.CurrentOrgId
744
 	userOrgID := adminUserInfo.CurrentOrgId
716
 	articles, err := article_service.GetArticleInfo(userOrgID, id)
745
 	articles, err := article_service.GetArticleInfo(userOrgID, id)
746
+	fmt.Println("错误是什么",err)
717
 	if err !=nil{
747
 	if err !=nil{
718
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询文章信息失败")
748
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询文章信息失败")
719
 		return
749
 		return
720
 	}
750
 	}
721
-	fmt.Println("内容是啥什么",articles)
751
+	fmt.Println("编辑文章内容是啥什么",articles)
722
 	this.ServeSuccessJSON(map[string]interface{}{
752
 	this.ServeSuccessJSON(map[string]interface{}{
723
 		"articles":articles,
753
 		"articles":articles,
724
 	})
754
 	})
1386
 	returnData["msg"] = "ok"
1416
 	returnData["msg"] = "ok"
1387
 	this.ServeSuccessJSON(returnData)
1417
 	this.ServeSuccessJSON(returnData)
1388
 	return
1418
 	return
1419
+}
1420
+
1421
+func (this *ArticleManage) GetAllCategory()  {
1422
+	adminUserInfo := this.GetAdminUserInfo()
1423
+	userOrgID := adminUserInfo.CurrentOrgId
1424
+	categorys, err := article_service.GetMenus(userOrgID)
1425
+	if err !=nil{
1426
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询回复内容失败")
1427
+		return
1428
+	}
1429
+	this.ServeSuccessJSON(map[string]interface{}{
1430
+		"categorys":categorys,
1431
+	})
1389
 }
1432
 }

+ 2 - 2
controllers/base_api_controller.go 查看文件

78
 		adminUserInfo.Subscibes = subscibes
78
 		adminUserInfo.Subscibes = subscibes
79
 		this.SetSession("admin_user_info", &adminUserInfo)
79
 		this.SetSession("admin_user_info", &adminUserInfo)
80
 
80
 
81
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
82
-		//this.StopRun()
81
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
82
+		this.StopRun()
83
 	}
83
 	}
84
 }
84
 }
85
 
85
 

+ 247 - 0
controllers/site/site_controller.go 查看文件

78
 	beego.Router("/api/site/addmagicnavi",&Microwebsite{},"Post:AddMagicNavi")
78
 	beego.Router("/api/site/addmagicnavi",&Microwebsite{},"Post:AddMagicNavi")
79
 	beego.Router("/api/site/getmagicimages",&Microwebsite{},"Post:GetMagicImages")
79
 	beego.Router("/api/site/getmagicimages",&Microwebsite{},"Post:GetMagicImages")
80
 	beego.Router("/api/site/addmarginchart",&Microwebsite{},"Post:AddMarginChart")
80
 	beego.Router("/api/site/addmarginchart",&Microwebsite{},"Post:AddMarginChart")
81
+	beego.Router("/api/site/deleteRotations",&Microwebsite{},"Post:DeleteRotations")
82
+	beego.Router("/api/site/editRotationImages",&Microwebsite{},"Post:EditRotationImages")
83
+	beego.Router("/api/site/updaterotaionimages",&Microwebsite{},"Post:SaveRotationImages")
84
+	beego.Router("/api/site/editnavigation",&Microwebsite{},"Post:EditNavigation")
85
+	beego.Router("/api/site/savenavigation",&Microwebsite{},"Post:SaveNavigation")
86
+	beego.Router("/api/site/addhospital",&Microwebsite{},"Post:AddHospital")
87
+	beego.Router("/api/site/deletimages",&Microwebsite{},"Post:DeleteImages")
81
 }
88
 }
82
 
89
 
83
 type Microwebsite struct {
90
 type Microwebsite struct {
1836
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1843
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1837
 		return
1844
 		return
1838
 	}
1845
 	}
1846
+	fmt.Println("错误是什么?",err)
1839
 	this.ServeSuccessJSON(map[string]interface{}{
1847
 	this.ServeSuccessJSON(map[string]interface{}{
1840
 		"share":share,
1848
 		"share":share,
1841
 	})
1849
 	})
1850
+	fmt.Println("share是什么",share)
1842
 }
1851
 }
1843
 
1852
 
1844
 func (this *Microwebsite) DeleteNavition()  {
1853
 func (this *Microwebsite) DeleteNavition()  {
2209
 	this.ServeSuccessJSON(map[string]interface{}{
2218
 	this.ServeSuccessJSON(map[string]interface{}{
2210
 		"macnavigation":macnavigation,
2219
 		"macnavigation":macnavigation,
2211
 	})
2220
 	})
2221
+}
2222
+
2223
+func (this *Microwebsite) DeleteRotations(){
2224
+	adminUserInfo := this.GetAdminUserInfo()
2225
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
2226
+	//fmt.Println("机构ID",userOrgID)
2227
+	id, _ := this.GetInt64("id")
2228
+	//fmt.Println("id是什么",id)
2229
+	err := site_service.DeleteRotations(id, userOrgID)
2230
+	if err !=nil{
2231
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除图片失败")
2232
+		return
2233
+	}
2234
+	returnData := make(map[string]interface{}, 0)
2235
+	returnData["msg"] = "ok"
2236
+	this.ServeSuccessJSON(returnData)
2237
+	return
2238
+}
2239
+
2240
+func  (this *Microwebsite) EditRotationImages()  {
2241
+	adminUserInfo := this.GetAdminUserInfo()
2242
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
2243
+	fmt.Println(userOrgID)
2244
+	id, _ := this.GetInt64("id")
2245
+	//fmt.Println("id是什么",id)
2246
+	editpiclink, err := site_service.UpdateRotationImages(userOrgID, id)
2247
+	if err !=nil{
2248
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2249
+		return
2250
+	}
2251
+	this.ServeSuccessJSON(map[string]interface{}{
2252
+		"editpiclink":editpiclink,
2253
+	})
2254
+}
2255
+
2256
+func (this *Microwebsite) SaveRotationImages()  {
2257
+	adminUserInfo := this.GetAdminUserInfo()
2258
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
2259
+	fmt.Println("",userOrgID)
2260
+	id, _ := this.GetInt64("id")
2261
+	fmt.Println("id是什么",id)
2262
+
2263
+	dataBody := make(map[string]interface{}, 0)
2264
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2265
+	if err != nil {
2266
+		utils.ErrorLog(err.Error())
2267
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
2268
+		return
2269
+	}
2270
+	images := dataBody["images"].(string)
2271
+	fmt.Println("图片编辑",images)
2272
+	if len(images) == 0 {
2273
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
2274
+		return
2275
+	}
2276
+	sort :=int64(dataBody["sort"].(float64))
2277
+	fmt.Println("排序",sort)
2278
+   if(sort<=0){
2279
+   	  this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"排序不能为空")
2280
+   	  return
2281
+   }
2282
+	piclink :=int64(dataBody["piclink"].(float64))
2283
+	fmt.Println("图片链接",piclink)
2284
+	if (piclink <= 0) {
2285
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
2286
+		return
2287
+	}
2288
+	linkaddress := dataBody["linkaddress"].(string)
2289
+	if len(linkaddress) == 0 {
2290
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
2291
+		return
2292
+	}
2293
+	fmt.Println("链接地址",linkaddress)
2294
+
2295
+	editpiclink := models.SgjPatientEditpiclink{
2296
+		Images:      images,
2297
+		Sort:        sort,
2298
+		Piclink:     piclink,
2299
+		Linkaddress: linkaddress,
2300
+	}
2301
+	err = site_service.SaveRotationImages(id, userOrgID, editpiclink)
2302
+	fmt.Println("错误",err)
2303
+	if err !=nil{
2304
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2305
+		return
2306
+	}
2307
+	this.ServeSuccessJSON(map[string]interface{}{
2308
+		"editpiclink":editpiclink,
2309
+	})
2310
+}
2311
+
2312
+func (this *Microwebsite) EditNavigation()  {
2313
+	adminUserInfo := this.GetAdminUserInfo()
2314
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
2315
+	fmt.Println("",userOrgID)
2316
+	id, _ := this.GetInt64("id")
2317
+	//fmt.Println("id是什么",id)
2318
+	navigation, err := site_service.EditNavigation(userOrgID,id)
2319
+	if err !=nil{
2320
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2321
+		return
2322
+	}
2323
+	this.ServeSuccessJSON(map[string]interface{}{
2324
+		"navigation":navigation,
2325
+	})
2326
+}
2327
+
2328
+func (this *Microwebsite) SaveNavigation()  {
2329
+	adminUserInfo := this.GetAdminUserInfo()
2330
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
2331
+	fmt.Println("",userOrgID)
2332
+	id, _ := this.GetInt64("id")
2333
+	fmt.Println("id是多少呢",id)
2334
+	dataBody := make(map[string]interface{}, 0)
2335
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2336
+	if err != nil {
2337
+		utils.ErrorLog(err.Error())
2338
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
2339
+		return
2340
+	}
2341
+	navtitle := dataBody["navtitle"].(string)
2342
+	fmt.Println("导航标题",navtitle)
2343
+	if len(navtitle) == 0 {
2344
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
2345
+		return
2346
+	}
2347
+	navimages := dataBody["navimages"].(string)
2348
+	fmt.Println("导航图标选中",navimages)
2349
+	if len(navimages) == 0 {
2350
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
2351
+		return
2352
+	}
2353
+
2354
+	//noCheckImages := dataBody["noCheckImages"].(string)
2355
+	//fmt.Println("导航图标选中",navimages)
2356
+	//if len(navimages) == 0 {
2357
+	//	this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
2358
+	//	return
2359
+	//}
2360
+	jumpset := int64(dataBody["jumpset"].(float64))
2361
+	fmt.Println("跳转设置",jumpset)
2362
+	if jumpset <= 0 {
2363
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
2364
+		return
2365
+	}
2366
+	navaddress := dataBody["navaddress"].(string)
2367
+	fmt.Println("链接地址",navaddress)
2368
+	navigation := models.SgjPatientNavigation{
2369
+		Navtitle:   navtitle,
2370
+		Navimages:  navimages,
2371
+		Jumpset:    jumpset,
2372
+		Navaddress: navaddress,
2373
+	}
2374
+	err = site_service.UpdateNavtion(id, userOrgID, navigation)
2375
+	fmt.Println("err是什么",err)
2376
+	if err !=nil{
2377
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
2378
+		return
2379
+	}
2380
+	this.ServeSuccessJSON(map[string]interface{}{
2381
+		"navigation":navigation,
2382
+	})
2383
+}
2384
+
2385
+func (this *Microwebsite) AddHospital()  {
2386
+	adminUserInfo := this.GetAdminUserInfo()
2387
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
2388
+	fmt.Println("机构ID",userOrgID)
2389
+	dataBody := make(map[string]interface{}, 0)
2390
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2391
+	if err != nil {
2392
+		utils.ErrorLog(err.Error())
2393
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
2394
+		return
2395
+	}
2396
+	title := dataBody["title"].(string)
2397
+	fmt.Println("导航标题",title)
2398
+	if len(title) == 0 {
2399
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
2400
+		return
2401
+	}
2402
+	sort := int64(dataBody["sort"].(float64))
2403
+	if sort<=0{
2404
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"排序不能为空")
2405
+		return
2406
+	}
2407
+	fmt.Println("排序",sort)
2408
+	address :=dataBody["address"].(string)
2409
+	fmt.Println("医院地址",address)
2410
+	if len(address) == 0 {
2411
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
2412
+		return
2413
+	}
2414
+	patientOrdmodel := models.SgjPatientOrdmodel{
2415
+		Title:     title,
2416
+		Sort:      sort,
2417
+		UserOrgId: userOrgID,
2418
+		Status:    1,
2419
+		Ctime:     time.Now().Unix(),
2420
+		ModeType: 2,
2421
+	}
2422
+	site_service.AddOrdModel(&patientOrdmodel)
2423
+	ordmodel, err := site_service.QueryOrdeModelByID(userOrgID)
2424
+
2425
+	hosaddress := models.SgjPatientHosaddress{
2426
+		Title:     title,
2427
+		Sort:      sort,
2428
+		Address:   address,
2429
+		UserOrgId: userOrgID,
2430
+		Status:    1,
2431
+		Ctime:     time.Now().Unix(),
2432
+		Modeid:    ordmodel.ID,
2433
+	}
2434
+	err = site_service.AddHosAddress(&hosaddress)
2435
+	if err !=nil{
2436
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
2437
+		return
2438
+	}
2439
+	this.ServeSuccessJSON(map[string]interface{}{
2440
+		"hosaddress":hosaddress,
2441
+	})
2442
+}
2443
+
2444
+func (this *Microwebsite) DeleteImages()  {
2445
+	adminUserInfo := this.GetAdminUserInfo()
2446
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
2447
+	fmt.Println("机构ID",userOrgID)
2448
+	id, _:= this.GetInt64("id")
2449
+	fmt.Println("id是神么",id)
2450
+	err := site_service.DeleteImages(id, userOrgID)
2451
+	if err !=nil{
2452
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2453
+		return
2454
+	}
2455
+	returnData := make(map[string]interface{}, 0)
2456
+	returnData["msg"] = "ok"
2457
+	this.ServeSuccessJSON(returnData)
2458
+	return
2212
 }
2459
 }

+ 52 - 21
models/article_models.go 查看文件

19
 	return "sgj_patient_articles_menu"
19
 	return "sgj_patient_articles_menu"
20
 }
20
 }
21
 
21
 
22
+//type Articles struct {
23
+//	ID            int64     `gorm:"column:id" json:"id"`
24
+//	Title         string    `gorm:"column:title" json:"title"`
25
+//	Summary       string    `gorm:"column:summary" json:"summary"`
26
+//	Content       string    `gorm:"column:content" json:"content"`
27
+//	Type          int       `gorm:"column:type" json:"type"`
28
+//	Num           int       `gorm:"column:num" json:"num"`
29
+//	Realreadnum   int64       `gorm:"column:real_read_num" json:"real_read_num"`
30
+//	Mtime         int64     `gorm:"column:mtime" json:"mtime"`
31
+//	Ctime         int64     `gorm:"column:ctime" json:"ctime"`
32
+//	ClassId       int64     `gorm:"column:class_id" json:"class_id"`
33
+//	Author        string    `gorm:"column:author" json:"author"`
34
+//	Status        int       `gorm:"column:status" json:"status"`
35
+//	Reason        string    `gorm:"column:reason" json:"reason"`
36
+//	StarNum       int       `gorm:"column:star_num" json:"star_num"`
37
+//	CommentNum    int       `gorm:"column:comment_num" json:"comment_num"`
38
+//	UserOrgId     int64     `gorm:"column:user_org_id" json:"user_org_id"`
39
+//	ArticleStatus int64     `gorm:"column:article_status" json:"article_status"`
40
+//	Imgs          string    `gorm:"column:imgs" json:"imgs"`
41
+//	VideoUrl      string    `gorm:"column:video_url" json:"video_url"`
42
+//	Cover         string    `gorm:"-" json:"cover"`
43
+//	PublicTime    string    `gorm:"-" json:"publicTime"`
44
+//	Comments      []Comment `gorm:"ForeignKey:ArticleId"`
45
+//	ArticleId	  int64		 `gorm:"-"`
46
+//}
22
 type Articles struct {
47
 type Articles struct {
23
-	ID            int64     `gorm:"column:id" json:"id"`
24
-	Title         string    `gorm:"column:title" json:"title"`
25
-	Summary       string    `gorm:"column:summary" json:"summary"`
26
-	Content       string    `gorm:"column:content" json:"content"`
27
-	Type          int       `gorm:"column:type" json:"type"`
28
-	Num           int       `gorm:"column:num" json:"num"`
29
-	Realreadnum   int64       `gorm:"column:real_read_num" json:"real_read_num"`
30
-	Mtime         int64     `gorm:"column:mtime" json:"mtime"`
31
-	Ctime         int64     `gorm:"column:ctime" json:"ctime"`
32
-	ClassId       int64     `gorm:"column:class_id" json:"class_id"`
33
-	Author        string    `gorm:"column:author" json:"author"`
34
-	Status        int       `gorm:"column:status" json:"status"`
35
-	Reason        string    `gorm:"column:reason" json:"reason"`
36
-	StarNum       int       `gorm:"column:star_num" json:"star_num"`
37
-	CommentNum    int       `gorm:"column:comment_num" json:"comment_num"`
38
-	UserOrgId     int64     `gorm:"column:user_org_id" json:"user_org_id"`
39
-	ArticleStatus int64     `gorm:"column:article_status" json:"article_status"`
40
-	Imgs          string    `gorm:"column:imgs" json:"imgs"`
41
-	VideoUrl      string    `gorm:"column:video_url" json:"video_url"`
42
-	Cover         string    `gorm:"-" json:"cover"`
43
-	PublicTime    string    `gorm:"-" json:"publicTime"`
48
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
49
+	Title string `gorm:"column:title" json:"title" form:"title"`
50
+	Summary string `gorm:"column:summary" json:"summary" form:"summary"`
51
+	Content string `gorm:"column:content" json:"content" form:"content"`
52
+	Type int64 `gorm:"column:type" json:"type" form:"type"`
53
+	Num int64 `gorm:"column:num" json:"num" form:"num"`
54
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
55
+	RealReadNum int64 `gorm:"column:real_read_num" json:"real_read_num" form:"real_read_num"`
56
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
57
+	ClassId int64 `gorm:"column:class_id" json:"class_id" form:"class_id"`
58
+	Author string `gorm:"column:author" json:"author" form:"author"`
59
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
60
+	Reason string `gorm:"column:reason" json:"reason" form:"reason"`
61
+	StarNum int64 `gorm:"column:star_num" json:"star_num" form:"star_num"`
62
+	CommentNum int64 `gorm:"column:comment_num" json:"comment_num" form:"comment_num"`
63
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
64
+	ArticleStatus int64 `gorm:"column:article_status" json:"article_status" form:"article_status"`
65
+	Imgs string `gorm:"column:imgs" json:"imgs" form:"imgs"`
66
+	VideoUrl string `gorm:"column:video_url" json:"video_url" form:"video_url"`
67
+	Source int64 `gorm:"column:source" json:"source" form:"source"`
68
+	CategoryId int64 `gorm:"column:category_id" json:"category_id" form:"category_id"`
69
+	Ttid int64 `gorm:"column:ttid" json:"ttid" form:"ttid"`
70
+	Ttype int64 `gorm:"column:ttype" json:"ttype" form:"ttype"`
71
+	Toid int64 `gorm:"column:toid" json:"toid" form:"toid"`
44
 	Comments      []Comment `gorm:"ForeignKey:ArticleId"`
72
 	Comments      []Comment `gorm:"ForeignKey:ArticleId"`
73
+	PublicTime    string    `gorm:"-" json:"publicTime"`
45
 	ArticleId	  int64		 `gorm:"-"`
74
 	ArticleId	  int64		 `gorm:"-"`
46
 }
75
 }
47
 
76
 
77
+
78
+
48
 func (Articles) TableName() string {
79
 func (Articles) TableName() string {
49
 	return "sgj_patient_articles"
80
 	return "sgj_patient_articles"
50
 }
81
 }

+ 18 - 0
models/site_models.go 查看文件

232
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
232
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
233
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
233
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
234
 	ModeType int64 `gorm:"column:mode_type" json:"mode_type" form:"mode_type"`
234
 	ModeType int64 `gorm:"column:mode_type" json:"mode_type" form:"mode_type"`
235
+	Hosaddress     SgjPatientHosaddress `gorm:"ForeignKey:Modeid"`
235
 	Connectway     []SgjPatientConnectway `gorm:"ForeignKey:ModeId"`
236
 	Connectway     []SgjPatientConnectway `gorm:"ForeignKey:ModeId"`
236
 	Worktime     SgjPatientWorktime `gorm:"ForeignKey:ModeId"`
237
 	Worktime     SgjPatientWorktime `gorm:"ForeignKey:ModeId"`
237
 	Rideway  SgjPatientRideway `gorm:"ForeignKey:ModeId"`
238
 	Rideway  SgjPatientRideway `gorm:"ForeignKey:ModeId"`
380
 	return "sgj_patient_macnavigation"
381
 	return "sgj_patient_macnavigation"
381
 }
382
 }
382
 
383
 
384
+type SgjPatientHosaddress struct {
385
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
386
+	Title string `gorm:"column:title" json:"title" form:"title"`
387
+	Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
388
+	Address string `gorm:"column:address" json:"address" form:"address"`
389
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
390
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
391
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
392
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
393
+	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
394
+}
395
+
396
+func (SgjPatientHosaddress) TableName() string  {
397
+
398
+	return "sgj_patient_hosaddress"
399
+}
400
+

+ 17 - 0
service/article_service/article_category_service.go 查看文件

154
 	return
154
 	return
155
 }
155
 }
156
 
156
 
157
+//func GetAllartic(page int64,limit int64,orgID int64)(articles []*models.Articles,total int64, err error)  {
158
+//	db := service.PatientReadDB().Table("sgj_patient_articles as a ").Where("a.status=1")
159
+//	if (orgID > 0) {
160
+//		db = db.Where("a.user_org_id=? AND article_status = ?", orgID,1)
161
+//	}
162
+//	offset := (page - 1) * limit
163
+//	err = db.Count(&total).Order("a.ctime desc").Offset(offset).Limit(limit).
164
+//		Preload("Comments", func(db *gorm.DB) *gorm.DB {
165
+//		return  db.Where(" status = ?",1)
166
+//	}).Select("a.id, a.title, a.summary, a.content, a.type, a.num, a.mtime, a.real_read_num, a.ctime, a.class_id, a.author, a.status, a.reason,a.star_num, a.comment_num,a.user_org_id, a.article_status, a.imgs, a.video_url, a.source, a.category_id, a.ttid, a.ttype, a.toid").Find(&articles).Error
167
+//	fmt.Println("err是啥呢?",err)
168
+//	if err != nil {
169
+//		return
170
+//	}
171
+//	return
172
+//}
173
+
157
 func GetDraftbox(orgID int64,page int64,limit int64, searchKey string)(articles []*models.Articles,total int64, err error) {
174
 func GetDraftbox(orgID int64,page int64,limit int64, searchKey string)(articles []*models.Articles,total int64, err error) {
158
 	db := service.PatientReadDB().Table("sgj_patient_articles as a ").Where("a.status=1")
175
 	db := service.PatientReadDB().Table("sgj_patient_articles as a ").Where("a.status=1")
159
 	if (orgID > 0) {
176
 	if (orgID > 0) {

+ 43 - 1
service/site_service/site_microwebsite_service.go 查看文件

352
 	return err
352
 	return err
353
 }
353
 }
354
 
354
 
355
+func AddHosAddress(hosaddress *models.SgjPatientHosaddress) error  {
356
+
357
+	err := service.PatientWriteDB().Create(&hosaddress).Error
358
+	return  err
359
+}
360
+
355
 func QueryOrdeModelByID(orgid int64)(models.SgjPatientOrdmodel,error)  {
361
 func QueryOrdeModelByID(orgid int64)(models.SgjPatientOrdmodel,error)  {
356
 	ordmodel := models.SgjPatientOrdmodel{}
362
 	ordmodel := models.SgjPatientOrdmodel{}
357
 	err := service.PatientReadDB().Where("user_org_id = ? AND status = ? ", orgid, 1).Last(&ordmodel).Error
363
 	err := service.PatientReadDB().Where("user_org_id = ? AND status = ? ", orgid, 1).Last(&ordmodel).Error
373
 	if(orgid > 0){
379
 	if(orgid > 0){
374
 		db = db.Where("user_org_id = ?", orgid)
380
 		db = db.Where("user_org_id = ?", orgid)
375
 	}
381
 	}
376
-	err = db.Preload("Connectway").Preload("Worktime").Preload("Rideway").Preload("Oldration").
382
+	err = db.Preload("Hosaddress").Preload("Connectway").Preload("Worktime").Preload("Rideway").Preload("Oldration").
377
 		Select("o.id,o.title,o.sort,o.ctime,o.mtime,o.mode_type").Order("sort").Find(&model).Error
383
 		Select("o.id,o.title,o.sort,o.ctime,o.mtime,o.mode_type").Order("sort").Find(&model).Error
378
     fmt.Println("sql错误是什么",err)
384
     fmt.Println("sql错误是什么",err)
379
 	return
385
 	return
420
 	err := service.PatientWriteDB().Create(&macnavigation).Error
426
 	err := service.PatientWriteDB().Create(&macnavigation).Error
421
 	return err
427
 	return err
422
 }
428
 }
429
+
430
+func DeleteRotations(id int64, orgid int64)(error)  {
431
+	err := service.PatientWriteDB().Model(models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
432
+	return  err
433
+}
434
+
435
+func UpdateRotationImages(orgid int64,id int64)(models.SgjPatientEditpiclink,error){
436
+	editpiclink := models.SgjPatientEditpiclink{}
437
+	err := service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&editpiclink).Error
438
+	return editpiclink,err
439
+}
440
+
441
+func SaveRotationImages(id int64,orgid int64,editpiclink models.SgjPatientEditpiclink)error  {
442
+	err := service.PatientWriteDB().Model(editpiclink).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": editpiclink.Images, "sort": editpiclink.Sort, "piclink": editpiclink.Piclink, "linkaddress": editpiclink.Linkaddress, "mtime": time.Now().Unix()}).Error
443
+	return  err
444
+}
445
+
446
+func EditNavigation(orgid int64,id int64)(models.SgjPatientNavigation,error){
447
+	navigation := models.SgjPatientNavigation{}
448
+	err := service.PatientReadDB().Model(&navigation).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&navigation).Error
449
+	return  navigation,err
450
+}
451
+
452
+func UpdateNavtion(id int64,orgid int64,navigation models.SgjPatientNavigation) error {
453
+	err := service.PatientWriteDB().Model(navigation).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"navtitle": navigation.Navtitle, "navimages": navigation.Navimages, "jumpset": navigation.Jumpset, "navaddress": navigation.Navaddress, "mtime": time.Now().Unix()}).Error
454
+	return err
455
+}
456
+
457
+func DeleteImages(id int64,orgid int64)(error)  {
458
+	err := service.PatientWriteDB().Model(models.SgjPatientConrotation{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
459
+	return err
460
+}
461
+
462
+
463
+
464
+