def post(self): echo_dist = {} echo_dist['data'] = [] echo_dist["recordsTotal"] = 0 echo_dist["recordsFiltered"] = 0 if self.session['swissquote_uid'] == None: # 退出 echo_dist['reponse_status'] = -1 else: # print("SS:", self.request.arguments) F = ProxyForm(self.request.arguments) if F.validate(): #and F.cla.data == "SendError" echo_dist['reponse_status'] = 5 P = ProxyOrderModel() cookie_dist = self.getCookie(1) page_papa = {} page_papa['start'] = F.start.data page_papa['length'] = F.length.data page_papa['search'] = self.get_argument('search[value]', '0') # page_papa['search_regex'] = F.search_regex.data # page_papa['page_num'] = self.get_argument('page_num', 10) page_papa['fx_type'] = F.fx_type.data page_papa['account'] = F.account.data page_papa['time_type'] = F.time_type.data echo_dist['fx_type'] = F.fx_type.data if F.fx_type.data == "list_proposal": echo_dist['data'] = yield P.getCsList( self.session['swissquote_uid'], F.start.data, F.length.data) elif F.fx_type.data == "list_proxy_order": # 单个账户佣金列表 echo_dist['data'] = yield P.getProxyOrderList( self.session['swissquote_uid'], page_papa) elif F.fx_type.data == "list_proxy_count2": # 单个账户返佣总金额 echo_dist['data'] = yield P.getProxyCount2( self.session['swissquote_uid'], page_papa) elif F.fx_type.data == "list_proxy_count": # 返佣总金额 echo_dist['data'] = yield P.getProxyCount( self.session['swissquote_uid'], page_papa) elif F.fx_type.data == "list_proxy_order_count": # 统计各账户的返佣金额 echo_dist['data'] = yield P.getProxyOrderCountList( self.session['swissquote_uid'], page_papa) elif F.fx_type.data == "list_settlement": # 统计返佣结算金额列表 echo_dist['data'] = yield P.getProxySettlementList( self.session['swissquote_uid'], page_papa) elif F.fx_type.data == "list_settlement_count": # 统计结算金额 echo_dist['data'] = yield P.getProxySettlementCount( self.session['swissquote_uid'], page_papa) else: echo_dist['echo'] = self.locale.translate("无数据") echo_dist['reponse_status'] = 5 # print(echo_dist['data']) if len(echo_dist.get('data')) > 0: if 'allnum' in echo_dist['data'][-1]: allnum = echo_dist['data'].pop() # print('allnum', allnum) echo_dist["recordsTotal"] = allnum['allnum'] echo_dist["recordsFiltered"] = allnum['allnum'] # s_data.pop() else: echo_dist['echo'] = self.locale.translate("无数据") echo_dist['reponse_status'] = 5 else: # 表单错误 from models.public.confrom_model import get_ErrorForm echo_dist['echo'] = get_ErrorForm(F) echo_dist['reponse_status'] = 1 # print(echo_dist) from models.public.headers_model import DateEncoder yield self.write(json.dumps(echo_dist, cls=DateEncoder)) # self.write(json.dumps(echo_dist)) self.finish()
def post(self): echo_dist = {} echo_dist['data'] = [] echo_dist["recordsTotal"] = 0 echo_dist["recordsFiltered"] = 0 if self.session['ManagerUid'] == None: # 退出 echo_dist['reponse_status'] = -1 else: # print("SS:", self.request.arguments) F = ProxyForm(self.request.arguments) if F.validate():#and F.cla.data == "SendError" echo_dist['reponse_status'] = 5 P = ProxyOrderModel() cookie_dist = self.getCookie(1) page_papa = {} page_papa['start'] = F.start.data page_papa['length'] = F.length.data page_papa['search'] = self.get_argument('search[value]', '0') # page_papa['search_regex'] = F.search_regex.data # page_papa['page_num'] = self.get_argument('page_num', 10) page_papa['fx_type'] = F.fx_type.data page_papa['account'] = F.account.data page_papa['uid'] = F.uid.data page_papa['time_type'] = F.time_type.data echo_dist['fx_type'] = F.fx_type.data if F.fx_type.data == "list_proxy_order": # 单个账户佣金列表 echo_dist['data'] = yield P.getProxyOrderList(page_papa['uid'], page_papa) elif F.fx_type.data == "list_proxy_count2": # 单个账户返佣总金额 echo_dist['data'] = yield P.getProxyCount2(page_papa['uid'], page_papa) elif F.fx_type.data == "list_proxy_count": # 返佣总金额 echo_dist['data'] = yield P.getProxyCount(page_papa['uid'], page_papa) elif F.fx_type.data == "list_proxy_count_all": # 所有代理返佣总金额 echo_dist['data'] = yield P.getProxyCountAll(page_papa) elif F.fx_type.data == "list_proxy_order_count": # 统计各账户的返佣金额 echo_dist['data'] = yield P.getProxyOrderCountList(page_papa['uid'], page_papa) elif F.fx_type.data == "list_proxy_order_count_all": # 统计各代理的返佣金额 echo_dist['data'] = yield P.getProxyOrderCountListAll(page_papa) elif F.fx_type.data == "list_settlement": # 统计返佣结算金额列表 echo_dist['data'] = yield P.getProxySettlementList(page_papa['uid'], page_papa) elif F.fx_type.data == "list_settlement_count": # 统计结算金额 echo_dist['data'] = yield P.getProxySettlementCount(page_papa['uid'], page_papa) elif F.fx_type.data == "list_proxy_settlement_count": # 统计总佣金和总结算金额 echo_dist['all_proxy_profit'], echo_dist['all_profit'], echo_dist['all_amount'] = yield P.getProxySettlementAllCount(page_papa['uid']) data = yield P.CheckProxyInfo(page_papa['uid']) if len(data) > 0: echo_dist['uname'] = data[0]['uname'] echo_dist['iban'] = data[0]['iban'] echo_dist['flag'] = data[0]['flag'] else: echo_dist['uname'] = "" echo_dist['iban'] = "" echo_dist['flag'] = 0 echo_dist['reponse_status'] = 5 echo_dist['echo'] = "" elif F.fx_type.data == "add_settlement": # 新增结算金额 page_papa['in_uname'] = F.in_uname.data page_papa['in_iban'] = F.in_iban.data page_papa['out_iban'] = F.out_iban.data page_papa['amount'] = F.amount.data page_papa['remarks'] = F.remarks.data add_flag = yield P.addProxySettlement(page_papa['uid'], page_papa) if add_flag == True: sendfalg = yield self.ProxySendMail(page_papa['uid'], page_papa['amount']) if sendfalg == True: echo_dist['reponse_status'] = 5 echo_dist['echo'] = "新增完成,邮件发送成功!" else: echo_dist['reponse_status'] = -2 echo_dist['echo'] = "新增完成,邮件发送失败" else: echo_dist['echo'] = "新增失败" echo_dist['reponse_status'] = -1 else: echo_dist['echo'] = self.locale.translate("无数据") echo_dist['reponse_status'] = 5 # print(echo_dist['data']) if len(echo_dist.get('data')) > 0: if 'allnum' in echo_dist['data'][-1]: allnum = echo_dist['data'].pop() # print('allnum', allnum) echo_dist["recordsTotal"] = allnum['allnum'] echo_dist["recordsFiltered"] = allnum['allnum'] # s_data.pop() else: echo_dist['echo'] = self.locale.translate("无数据") echo_dist['reponse_status'] = 5 else: # 表单错误 from models.public.confrom_model import get_ErrorForm echo_dist['echo'] = get_ErrorForm(F) echo_dist['reponse_status'] = 1 # print(echo_dist) from models.public.headers_model import DateEncoder yield self.write(json.dumps(echo_dist, cls=DateEncoder)) # self.write(json.dumps(echo_dist)) self.finish()