123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- # -*- coding: utf-8 -*-
- # !/usr/bin/env python
- """
- """
- import os
- import sys
- from django.conf import settings
- from apps.web.core.models import _AliPaymentApp
- PROJECT_ROOT = os.path.join(os.path.abspath(os.path.split(os.path.realpath(__file__))[0] + "/.."), '..')
- sys.path.insert(0, PROJECT_ROOT)
- from script.base import init_env
- init_env(interactive = True)
- from apps.web.agent.models import Agent
- for agent in Agent.objects.all():
- if not agent.is_primary:
- continue
- my_agent = Agent.objects(id = str('6417d4456f29257125ebf705')).get()
- import copy
- if not agent.wechatLoginAuthApp or not agent.wechatLoginAuthApp.appid:
- agent.wechatLoginAuthApp = copy.deepcopy(my_agent.wechatLoginAuthApp)
- if not agent.wechatPayApp or not agent.wechatPayApp.appid:
- agent.wechatPayApp = copy.deepcopy(my_agent.wechatPayApp)
- agent.customizedWechatCashflowAllowable = my_agent.customizedWechatCashflowAllowable
- if not agent.wechatUserManagerialApp or not agent.wechatUserManagerialApp.appid:
- agent.wechatUserManagerialApp = copy.deepcopy(my_agent.wechatUserManagerialApp)
- agent.customizedUserGzhAllowable = my_agent.customizedUserGzhAllowable
- if not agent.wechatDealerManagerialApp or not agent.wechatDealerManagerialApp.appid:
- agent.wechatDealerManagerialApp = copy.deepcopy(my_agent.wechatDealerManagerialApp)
- agent.customizedDealerGzhAllowable = my_agent.customizedDealerGzhAllowable
- if not agent.aliPayApp or not agent.aliPayApp.appid:
- if agent.customizedWechatCashflowAllowable:
- if agent.customizedAlipayCashflowAllowable:
- agent.aliPayApp = _AliPaymentApp(appid = agent.alipay_appid,
- public_key_path = agent.alipay_public_key_path,
- app_private_key_path = agent.app_private_key_path,
- shadow = False)
- else:
- if agent.customizedAlipayCashflowAllowable:
- agent.aliPayApp = _AliPaymentApp(appid = agent.alipay_appid,
- public_key_path = agent.alipay_public_key_path,
- app_private_key_path = agent.app_private_key_path,
- shadow = False)
- else:
- agent.aliPayApp = copy.deepcopy(my_agent.aliPayApp)
- agent.customizedAlipayCashflowAllowable = my_agent.customizedAlipayCashflowAllowable
- if not agent.productName:
- agent.productName = my_agent.productName
- if not agent.productLogo:
- agent.productLogo = my_agent.productLogo
- agent.save()
|