| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package controllers
- import (
- "ColdVerify_server/lib"
- "ColdVerify_server/models/Account"
- "ColdVerify_server/models/Distributor"
- "ColdVerify_server/models/Task"
- )
- // 获取管理员 关联ERP
- func (c *AccountController) Account_List_All_For_ERP() {
- PowerList := Account.Read_Power_List_ALL_1()
- PowerMap := Account.UserPowerListToPowerMap(PowerList)
- T_name := c.GetString("T_name")
- var r_jsons lib.R_JSONS
- r_jsons.List = Account.Read_Admin_List_ALL_Power("", T_name, PowerMap)
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
- c.ServeJSON()
- return
- }
- // 获取公司列表
- func (c *UserController) User_List_All_For_ERP() {
- T_name := c.GetString("T_name")
- CreateDate := c.GetString("CreateDate")
- if len(CreateDate) > 0 && !lib.IsDateStr(CreateDate) {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "日期格式错误!"}
- c.ServeJSON()
- return
- }
- distributorList := Distributor.Read_Distributor_List_ALL("")
- distributorMap := Distributor.DistributorListToMap(distributorList)
- List, _ := Account.List_All_For_ERP(T_name, CreateDate, distributorMap)
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: List}
- c.ServeJSON()
- return
- }
- func (c *TaskController) Task_List_All_For_ERP() {
- start_time := c.GetString("T_reporting_pass_start_time")
- end_time := c.GetString("T_reporting_pass_end_time")
- if _, is := lib.TimeStrToTime(start_time); !is {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "开始时间格式错误!"}
- c.ServeJSON()
- return
- }
- if _, is := lib.TimeStrToTime(end_time); !is {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "结束时间格式错误!"}
- c.ServeJSON()
- return
- }
- List, _ := Task.Read_Task_List_For_ERP(start_time, end_time)
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: List}
- c.ServeJSON()
- return
- }
- func (c *TaskController) Task_List2_All_For_ERP() {
- T_type := c.GetString("T_type")
- if T_type != "collection" && T_type != "reporting" {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "类型错误!"}
- c.ServeJSON()
- return
- }
- start_time := c.GetString("T_start_time")
- end_time := c.GetString("T_end_time")
- if _, is := lib.TimeStrToTime(start_time); !is {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "开始时间格式错误!"}
- c.ServeJSON()
- return
- }
- if _, is := lib.TimeStrToTime(end_time); !is {
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "结束时间格式错误!"}
- c.ServeJSON()
- return
- }
- var List []Task.Task_
- if T_type == "collection" {
- List, _ = Task.Read_Task_List_For_ERP_By_Type(T_type, start_time, end_time)
- }
- if T_type == "reporting" {
- List, _ = Task.Read_Task_List_For_ERP_By_Type(T_type, start_time, end_time)
- }
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: List}
- c.ServeJSON()
- return
- }
|