浅谈泰山众筹系统开发*成熟技术解决代码方案

简介: 浅谈泰山众筹系统开发*成熟技术解决代码方案
 The experience of offline shopping at your fingertips has solved the problem that consumers can only understand the "wrong version of goods" caused by the introduction of pictures on the e-commerce platform; The stores with extensive tentacles enable people in the underdeveloped areas of the deep network to still shop relatively conveniently; The sales network covering urban and rural areas enables people to place orders online and pick up goods offline; The community service of "the last mile" meets many needs of users in terms of timely return and replacement, maintenance, etc. These advantages of online business supermarkets and the user data accumulated under their long-term operation enable them to have a solid foundation and voice capital for cooperation with online e-commerce platforms.

泰山众筹的基本概念

1、四进一出:当众筹活动到第四期成功的时候,第一期参与众筹的粉丝就会出局,从而获的奖励,当第五期众筹成功的时候,第二期参与的粉丝出局,获得出局奖励,以此类推,直至众筹活动结束或失败。

2、倍利复增:每完成一期众筹活动的时候,下一期将增长30%的众筹资产

3、爆仓重生:众筹活动时间内,无法完成众筹,则会众筹失败,那就视为爆仓,将重新开启第一期循环。

应用场景
在容器内部,想要获取容器名称,替换容器内某些文件内的字符串, 代码如下:

--coding:utf-8--

import os
import redis

def alter(file, new_str, old_str="abc_123abc"):

"""
替换文件中的字符串
file:文件名
old_str:就字符串
new_str:新字符串
"""

file_data = ""
with open(file, "r") as f:
    for line in f:
        if old_str in line:
            line = line.replace(old_str, new_str)
        file_data += line
with open(file, "w") as f:
    f.write(file_data)

def get_container_name():

db = redis.Redis(host="192.168.0.111", port=6380, decode_responses=False)

# start: in container, run next code  -------------------------------------------------
cmd = "cat /proc/self/cgroup"
output = os.popen(cmd)
rests = output.readlines()
container_message= rests[-1]
if not container_message:
    container_id = "abc"
else:
    container_id =  container_message.strip().split("docker-")[-1][:12]
# end. ----------------------------------------------------------------------------------

container_name = None
if container_id != "abc":
    key_name = "nm_" + container_id
    container_name = db.hget("container_msg", key_name)

if container_name:
    container_name = container_name.decode("utf-8")

return container_name

def run():

nginx_conf = "/etc/nginx/nginx.conf"
galaxy_yml = "/galaxy-central/config/galaxy.yml"

container_name = get_container_name()
if container_name is not None:
    alter(nginx_conf, container_name)
    os.popen("nginx -s reload")
    # os.popen("cp /galaxy-central/config/galaxy.yml.sample /galaxy-central/config/galaxy.yml")
    alter(galaxy_yml, container_name)
    print("Replacement string 'abc_123abc' succeeded")
else:
    print("Replacement string 'abc_123abc' failed")
    

if name == '__main__':

run()
相关文章
|
分布式计算 Hadoop 大数据
大数据技术与Python:结合Spark和Hadoop进行分布式计算
【4月更文挑战第12天】本文介绍了大数据技术及其4V特性,阐述了Hadoop和Spark在大数据处理中的作用。Hadoop提供分布式文件系统和MapReduce,Spark则为内存计算提供快速处理能力。通过Python结合Spark和Hadoop,可在分布式环境中进行数据处理和分析。文章详细讲解了如何配置Python环境、安装Spark和Hadoop,以及使用Python编写和提交代码到集群进行计算。掌握这些技能有助于应对大数据挑战。
1136 1
|
8月前
|
人工智能 边缘计算 前端开发
人工智能平台 PAI DistilQwen2.5-DS3-0324发布:知识蒸馏+快思考=更高效解决推理难题
DistilQwen 系列是阿里云人工智能平台 PAI 推出的蒸馏语言模型系列,包括DistilQwen2、DistilQwen2.5、DistilQwen2.5-R1 等。DistilQwen2.5-DS3-0324 系列模型是基于 DeepSeek-V3-0324 通过知识蒸馏技术并引入快思考策略构建,显著提升推理速度,使得在资源受限的设备和边缘计算场景中,模型能够高效执行复杂任务。实验显示,DistilQwen2.5-DS3-0324 系列中的模型在多个基准测试中表现突出,其32B模型效果接近参数量接近其10倍的闭源大模型。
|
数据采集 人工智能 数据处理
Python自动化办公:提升效率,释放潜力(借助AI实现)
Python自动化办公:提升效率,释放潜力(借助AI实现)
1336 0
|
人工智能
通义千问大模型价格直线下调,优惠升级!更有新用户限时免费领取3600万额度!
通义大模型全线9款直降,最高达97%,阿里云MaaS(模型即服务)让推理成本大幅降低,加速AI应用爆发。 即刻登录阿里云百炼官网https://bailian.aliyun.com调用体验,新用户免费限时赠送3600万tokens!
2821 3
|
C#
WPF —— 动画缩放变换
`ScaleTransform`用于二维x-y坐标系中对象的缩放,可沿X或Y轴调整。在故事板中,通过RenderTransform.ScaleX和ScaleY属性控制缩放。示例代码展示了如何设置按钮的RenderTransformOrigin、Background等属性,并通过LayoutTransform应用ScaleTransform。当鼠标进入按钮时,EventTrigger启动DoubleAnimation实现X和Y轴的缩放动画。最后,展示了如何将动画集成到自定义按钮样式中。
353 0
|
弹性计算
通过体验高效构建企业门户网站解决方案并进行部署
既然做了引导以及文档帮助,那就做详细一点,不要放过每一个步骤和细节,让用户直接复制或者照抄就行了,从小白过来的一点小建议。
173 9
|
存储 设计模式 缓存
C++享元模式探索:轻松优化内存使用和性能提升之道
C++享元模式探索:轻松优化内存使用和性能提升之道
232 0
|
前端开发 Java 数据处理
基于SpringBoot的SSMP整合案例
基于SpringBoot的SSMP整合案例
154 0
|
机器学习/深度学习 自然语言处理 数据可视化
阿里提出QuadTree Transformer | 最轻、最强的Vision Transformer Backbone(一)
阿里提出QuadTree Transformer | 最轻、最强的Vision Transformer Backbone(一)
435 0