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 }