from beifen import sql go = sql.sql() go.lianjie_sql("plus2test", sql)
from beifen import sql sql_go = sql.sql() '''SQL语句们''' #公众号id sql_gzh_id_list = "SELECT uniacid FROM plus_shop_info WHERE user_id in (SELECT user_id FROM `plus_users` as a WHERE group_id ='1016')" #人员id sql = "SELECT * FROM plus_store WHERE group_id = '1016'" #门店id sql = "SELECT id FROM plus_store WHERE user_id in (SELECT user_id FROM `plus_users` as a WHERE group_id ='1016')" #或者 sql = "SELECT COUNT(id),city FROM plus_store WHERE group_id ='1016'" #店铺id sql = "SELECT id FROM plus_shop_info WHERE user_id in (SELECT user_id FROM `plus_users` as a WHERE group_id ='1016')" #今天商品信息 sql = "SELECT sum(a.new_goods_sum),sum(a.visit_goods_sum),sum(a.visit_goods_member_sum),sum(a.visit_goods_show_sum),sum(a.pay_person_sum),sum(a.total),sum(a.goods_sum) FROM plus_shop_realtime_data as a WHERE uniacid in (" + sql_gzh_id_list + ")" #店铺数量: sql = "SELECT COUNT(id) FROM plus_shop_info WHERE user_id in (SELECT user_id FROM `plus_users` as a WHERE group_id ='1016')" all_shop_sum = sql_go.lianjie_sql("plus2test", sql) print("店铺数量", int(all_shop_sum[0][0])) #小程序店铺数量: sql = "SELECT COUNT(id) FROM plus_shop_info WHERE type = '1' AND user_id in (SELECT user_id FROM `plus_users` as a WHERE group_id ='1016')" xiao_shop_sum = sql_go.lianjie_sql("plus2test", sql) print("小程序店铺数量", int(xiao_shop_sum[0][0])) #公众号店铺数量: sql = "SELECT COUNT(id) FROM plus_shop_info WHERE type = '2' AND user_id in (SELECT user_id FROM `plus_users` as a WHERE group_id ='1016')" wxapp_shop_sum = sql_go.lianjie_sql("plus2test", sql) print("公众号店铺数量", int(wxapp_shop_sum[0][0])) if int(wxapp_shop_sum[0][0]) + int(xiao_shop_sum[0][0]) == int(