import path_setting
from in_common.base_request import BaseRequest

class achelous_request(BaseRequest):
    def __init__(self):
        self.data = self.api_load(path_setting.ACHELOUS_REQUEST_CONFIG)
#直播间批量添加商品
    def batch_add_service(self, stream_id, service_item_ids):
        self.params["stream_id"] = stream_id
        self.params["service_item_ids"] = service_item_ids
        return self.api_send(self.data["batch_add_service"])

    #def batch_del_service(self, stream_id, service_item_ids):
    #    self.params["stream_id"] = stream_id
    #    self.params["service_item_ids"] = service_item_ids
    #    return self.api_send(self.data["batch_add_service"])

    #OM后台-自定义专题搜索
    def special_list(self, page_index, page_capacity, page_id, name, creator_name, create_time_gt, create_time_lt, is_online, status, start_time, end_time):
        self.params["page_index"] = page_index
        self.params["page_capacity"] = page_capacity
        self.params["page_id"] = page_id
        self.params["name"] = name
        self.params["creator_name"] = creator_name
        self.params["create_time_gt"] = create_time_gt
        self.params["create_time_lt"] = create_time_lt
        self.params["is_online"] = is_online
        self.params["status"] = status
        self.params["start_time"] = start_time
        self.params["end_time"] = end_time

        return self.api_send(self.data["special_list"])

    #OM后台-自定义专题创建
    def special_edit(self, user_id, name, id, start_time, end_time, is_online, share_title, share_content, share_pic ):
        self.params["user_id"] = user_id
        self.params["name"] = name
        self.params["id"] = id
        self.params["start_time"] = start_time
        self.params["end_time"] = end_time
        self.params["is_online"] = is_online
        self.params["share_title"] = share_title
        self.params["share_content"] = share_content
        self.params["share_pic"] = share_pic

        return self.api_send(self.data["special_edit"])

    #OM后台-自定义专题删除
    def special_delete(self, ids ):
        self.params["ids"] = ids
        print('*'*100)
        return self.api_send(self.data["special_delete"])

    #OM后台-组件库创建保存/更新保存
    def page_edit(self, visualpage_id, name, visual_info):
        self.params["visualpage_id"] = visualpage_id
        self.params["name"] = name
        self.params["visual_info"] = visual_info
        return self.api_send(self.data["page_edit"])

    #OM后台-自定义专题组件创建保存/更新保存
    def unit_update(self, page_id, order, unit):
        self.params["page_id"] = page_id
        self.params["order"] = order
        self.params["unit"] = unit
        return self.api_send(self.data["unit_update"])

if __name__ == "__main__":
    # print(achelous_request().batch_add_service("4176", "73809,23508,33823"))
   # print(achelous_request().batch_del_service("4176","7312,7311"))
   #  print(achelous_request().special_edit("32244157","自定义专题创建1","0","2021-08-01 00:00:00","2021-09-30 00:00:00","1","自定义专题创建1","自定义专题创建1","https://heras.igengmei.com/4d5eef0a-78dd-43b3-98b7-137d2341f106-1628565831259"))
   print(achelous_request().special_list('1', '10', '', '', '', '', '', '1', '0', '', ''))