Browse Source

MOD:游戏订单添加多游戏

cxyu 3 years ago
parent
commit
808101ff9f
3 changed files with 41 additions and 3 deletions
  1. 39 2
      handlers/OrderHandler.py
  2. 1 1
      model/UserAuthUtils.py
  3. 1 0
      urls.py

+ 39 - 2
handlers/OrderHandler.py

@@ -60,6 +60,43 @@ class OrderInfoAgent(BaseHandler):
             self.write_json(data=data)
 
 
+class OrderInfoNobody(BaseHandler):
+
+    def post(self):
+        if not self._au:
+            self.write_fail(msg='auth error')
+        else:
+            args = self.get_args()
+            user_id = args.get('user_id')
+
+            db = MysqlUtils()
+            if user_id in super_auth():
+                op = ''
+            else:
+                if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
+                    return None, None, None
+                elif len(UserAuthUtils.get_auth_channel(user_id)) == 1:
+                    op = f" and b.wx_name = '{UserAuthUtils.get_auth_channel(user_id)[0]}'"
+
+                else:
+                    op = f" and b.wx_name in {str(UserAuthUtils.get_auth_channel(user_id))}"
+
+            sql = f'''
+            select row_number() over() as id,
+                d.user_nicename as agent_name
+                from quchen_text.advertiser_vx a
+                left join db_mp.mp_mp_conf b on a.name =b.wx_name 
+                left join db_mp.mp_conf_agent c on b.id = c.advertiser_conf_id 
+                left join db_mp.h_user d on c.agent_id = d.id
+                where d.user_nicename is not null
+                {op} 
+                group by d.user_nicename 
+            '''
+            data = db.quchen_text.getData_json(sql)
+            data.insert(0, {'id': -1, 'agent_name': '自然流量渠道'})
+            data.insert(0, {'id': -2, 'agent_name': '客服渠道'})
+            self.write_json(data=data)
+
 class OrderInfo(BaseHandler):
 
     def post(self):
@@ -163,7 +200,7 @@ class OrderInfo(BaseHandler):
         op8 = f" and a.order_id='{order_id}'" if order_id else ''
         op9 = f" and a.mem_id='{member_id}'" if member_id else ''
         op10 = f" and a.status={status} " if status else ''
-        op11 = f" and e.name='{game}'" if game else ''
+        op11 = f''' and e.name in ({"'" + "','".join(game) + "'"}) ''' if game else ''
 
         # 有自然流量和客服渠道时,其他渠道进行规避
         if agent_name and '自然流量渠道' in agent_name and '客服渠道' in agent_name:
@@ -214,7 +251,7 @@ class OrderInfo(BaseHandler):
                         	and g.app_id = a.app_id and g.mg_mem_id =a.mg_mem_id 
                         left join quchen_text.advertiser_vx h on c.wx_name = h.name
                         left join db_mp.h_user q on a.agent_id =q.id 
-
+                        
                         
                         where 1=1  {op} {op1} {op2} {op3} {op4} {op5}  
                                 {op6} {op7} {op8} {op9} {op10} 

+ 1 - 1
model/UserAuthUtils.py

@@ -59,7 +59,7 @@ def get_auth_game_info(user_id):
                                 left join db_mp.mp_mp_conf b on  a.name =b.wx_name 
                                 left join db_mp.mp_conf_agent c on c.advertiser_conf_id = b.id
                                 left join db_mp.h_game d on c.app_id = d.id
-        where pitcher ='{user_name}'
+        where pitcher ='{user_name}' and d.id
         group by id
     '''
     user_ids = db.quchen_text.get_data_list(sql)

+ 1 - 0
urls.py

@@ -38,6 +38,7 @@ urls = [
     (r'/order/detail', OrderInfo),  # 获取订单明细
     (r'/order/game', OrderInfoGame),  # 获取订单游戏
     (r'/order/agent_name', OrderInfoAgent),  # 获取渠道
+    (r'/order/nobody_sum', OrderInfoNobody),  # 自然量
 
 
     # 外部接口