首页 文章详情

程序汪6万接的汽车配件APP项目,开发周期40天

我是程序汪 | 329 2021-09-12 18:38 0 0 0
UniSMS (合一短信)

本文章来自程序汪背后的私活小团队,开发汽车配件交易APP(类似咸鱼),希望把这些真实案例分享出来,大家能学到点东西,比如苹果APP怎么逃苹果税,开发APP用什么比较快捷,爬数据要注意什么等等

B站【我是程序汪】




项目情况

  • 苹果安卓 uniapp

  • 前端  PC端 技术栈  layui  

  • 后端   技术栈  springboot  

  • 开发周期40天 (1周设计3周开发1周改BUG)

  • 开发人数 2人   

  • 整体费用是6万

  • 走的公司合同

  • 云服务器1台(4核 8G 5000元/年)

  • OSS服务器 存视频图片用(20G  400元)

  • 维护费用(5000元/年)


技术选型

  • 核心框架:Spring Boot

  • 数据库连接池:Druid

  • 缓存:redis

  • 数据库:mysql

  • uniapp(使用Vue.js开发所有前端应用的框架



项目背景

汽修厂之间(b2b)经常有配件需要交易,类似咸鱼APP吧,但不向普通用户开放,必须是商家才能入驻。程序汪其实就是在以前电商系统上二次改造的,核心流程还是购买商品那一套。




APP首页




核心的业务就是商家(汽车配件厂家),通过APP发布商品,注意这里商品有2个类型,一个是求购(需求)一个是发布(商品),商品是可以直接支付后购买的








商品点击进入是购买页面,求购点击进去是发布商品的页面


爬汽车配件分类数据

大家知道汽车配件分类有多少种类吗,答案是20万啊,人工输入会疯的,于是我们用python爬了 某汽车XX网站的数据,爬了3天啊,IP还要定时不停的更换才行。



构建一个给爬虫使用的代理IP池




爬的汽车配件数据,主要用于如下界面




下面是爬过来的数据样本,大家可以参考下,爬过来一会还需要把数据转化成我们自己的数据结构




爬虫DEMO代码

import bs4
import requests as req
import re
import json
import csv

def mainMethod():
    li = [chr(i) for i in range(ord("A"), ord("Z") + 1)]
    firstSite = "https://www.autohome.com.cn/grade/carhtml/"
    firstSiteSurfixe = ".html"
    secondSite = "https://car.autohome.com.cn/config/series/"
    secondSiteSurfixe = ".html"
    for a in li:
        print(a)
        if a is not None:
            requestUrl = firstSite + a + firstSiteSurfixe
            print(requestUrl)
            # 开始获取每个品牌的车型
            resp = req.get(requestUrl)
            # print(str(resp.content,"gbk"))
            bs = bs4.BeautifulSoup(str(resp.content, "gbk"), "html.parser")
            bss = bs.find_all("li")
            co = 0
            for b in bss:
                d = b.h4
                if d is not None:
                    her = str(d.a.attrs['href'])
                    her = her.split("#")[0]
                    her = her[her.index(".cn") + 3:].replace("/"'')
                    if her is not None:
                        secSite = secondSite + her + secondSiteSurfixe
                        car_name = d.a.get_text()
                        print(car_name)
                        print("secSite=" + secSite)
                        resp = req.get(secSite)
                        text = str(resp.content, encoding="utf-8")
                        fil = open("E:\\py_shiyan\\Pycharm备份\\搜狐汽车销量采集\\car\\" + str(her) + ".txt""a",
                                   encoding="utf-8")
                        fil.write(text)
                        GetParser(car_name,her)
                    co = (co + 1)
            else:
                print(con)
                
def GetParser(car_name,her):
    f=open("E:\\py_shiyan\\Pycharm备份\\搜狐汽车销量采集\\car\\" +str(her) + ".txt",'r',encoding='utf-8')
    ts=f.read()
    data=re.findall('var\sconfig\s=(.*?)time',ts,re.S)
    try:
        data=data[0][:-2]+"}"
        json_data=json.loads(data)
        limit = len(json_data['result']['paramtypeitems'][0]['paramitems'][0]['valueitems'])
        print(limit)
        for z in range(limit):
            print(f'======================第{z+1}系列:')
            list=[car_name]
            for a in json_data['result']['paramtypeitems']:
                for b in a['paramitems']:
                    list.append(b['valueitems'][z]['value'])
            print(list)
            writer.writerow(list)
    except Exception as e:
        print(f'{car_name}暂无相关数据')

if __name__ == "__main__":
    f = open('cars.csv', mode='a', newline='')
    writer = csv.writer(f, delimiter=',')
    #title.csv文件为只含有各列标题的表头,可通过代码生成,再手工调整,具体代码见后面附录
    f2 = open('title.csv', mode='r', newline='')
    reader = csv.reader(f2)
    for row in reader:
        print(row)
        writer.writerow(row)
        mainMethod()                



苹果税(抽佣30%心在滴血)

开发过苹果APP的都知道苹果税高达30%,本来我们这个项目目前利润就比较少,被他这么一抽,初期肯定扛不住啊,考虑到这个APP用户量也不大,我们采取的方案是TF签名 合法的绕过苹果税



TF签名是指ios内测工具TestFlight,是苹果2014年收购的。

简单来说TF签名是苹果公司提供给开发者用来进行测试的内测商店,通过下载 TestFlight 测试 Beta 版 App,接受来自开发者的电子邮件或公开链接邀请,即可拥有可用于测试的设备。以此来实现将App安装到ios系统中进行使用。

所以,作为苹果官方认可的内测方式,进行TF签名,稳定程度是比较高的。它的优势是分发限制少,链接不会被屏蔽,任意苹果设备均可安装。用户在下载时无需点击信任,方便易操作,用户体验极佳。(需先下载TestFlight)




PC端

目前主要功能

PC端基本功能如下列菜单,商品的管理,订单的处理,这些都是电商系统的基本功能






数据库表分享

CREATE TABLE `tp_goods` (
  `goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品id',
  `cat_id1` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '一级分类id',
  `cat_id2` int(11) DEFAULT '0' COMMENT '二级分类',
  `cat_id3` int(11) DEFAULT '0' COMMENT '三级分类',
  `store_cat_id1` int(11) DEFAULT '0' COMMENT '本店一级分类',
  `store_cat_id2` int(11) DEFAULT '0' COMMENT '本店二级分类',
  `goods_sn` varchar(60) NOT NULL DEFAULT '' COMMENT '商品编号',
  `goods_name` varchar(120) NOT NULL DEFAULT '' COMMENT '商品名称',
  `click_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '点击数',
  `brand_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '品牌id',
  `store_count` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT '库存数量',
  `collect_sum` int(10) DEFAULT '0' COMMENT '商品收藏数',
  `comment_count` smallint(5) DEFAULT '0' COMMENT '商品评论数',
  `weight` varchar(255) NOT NULL DEFAULT '0' COMMENT '商品重量克为单位',
  `market_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '市场价',
  `shop_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '本店价',
  `cost_price` decimal(10,2) DEFAULT '0.00' COMMENT '商品成本价',
  `exchange_integral` int(10) NOT NULL DEFAULT '0' COMMENT 'COMMENT ''积分兑换:0不参与积分兑换',
  `keywords` varchar(255) NOT NULL DEFAULT '' COMMENT '商品关键词',
  `goods_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '商品简单描述',
  `goods_content` text CHARACTER SET utf16 COMMENT '商品详细描述',
  `original_img` varchar(255) NOT NULL DEFAULT '' COMMENT '商品上传原始图',
  `is_real` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否为实物',
  `is_on_sale` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否上架',
  `is_free_shipping` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否包邮0否1是',
  `on_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '商品上架时间',
  `sort` smallint(4) unsigned NOT NULL DEFAULT '50' COMMENT '商品排序',
  `is_recommend` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否推荐',
  `is_new` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否新品',
  `is_hot` tinyint(1) DEFAULT '0' COMMENT '是否热卖',
  `last_update` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新时间',
  `goods_type` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品所属类型id,取值表goods_type的id',
  `give_integral` int(11) DEFAULT '0' COMMENT '购买商品赠送积分',
  `sales_sum` int(11) DEFAULT '0' COMMENT '商品销量',
  `prom_type` tinyint(1) DEFAULT '0' COMMENT '1团购2抢购3优惠促销',
  `prom_id` int(11) DEFAULT '0' COMMENT '优惠活动id',
  `distribut` decimal(10,2) DEFAULT '0.00' COMMENT '佣金用于分销分成',
  `store_id` int(11) DEFAULT '0' COMMENT '商家店铺ID',
  `spu` varchar(128) DEFAULT '' COMMENT 'SPU',
  `sku` varchar(128) DEFAULT '' COMMENT 'SKU',
  `goods_state` tinyint(1) DEFAULT '1' COMMENT '0待审核1审核通过2审核失败3违规下架',
  `suppliers_id` smallint(5) unsigned DEFAULT NULL COMMENT '供应商ID',
  `shipping_area_ids` varchar(255) NOT NULL DEFAULT '' COMMENT '配送物流shipping_area_id,以逗号分隔',
  `chexi` int(11) DEFAULT NULL,
  PRIMARY KEY (`goods_id`),
  KEY `goods_sn` (`goods_sn`),
  KEY `cat_id` (`cat_id1`),
  KEY `last_update` (`last_update`),
  KEY `brand_id` (`brand_id`),
  KEY `goods_number` (`store_count`),
  KEY `goods_weight` (`weight`),
  KEY `sort_order` (`sort`)
) ENGINE=MyISAM AUTO_INCREMENT=454 DEFAULT CHARSET=utf8;             


数据库脚本分享

这是本项目的数据库脚本,大家可以参考学习下

接: https://pan.baidu.com/s/1tbSEogtWKbTUmhzic5QITA  密码: 33hq


电商类(拿去改造成二手交易系统)


参考文档:

  1.  爬虫相关

    https://www.cnblogs.com/xuchunlin/p/9105967.html

    https://zhuanlan.zhihu.com/p/285509641

    https://www.zhihu.com/question/277530396

    https://zhuanlan.zhihu.com/p/31656752

  2. 苹果TF签名

    https://www.zhihu.com/question/390644417

  3. 极光推送

    https://www.jiguang.cn/push?source=bdwx&plan=1&unit=18&keyword=240

欢迎添加程序汪个人微信 itwang008  进粉丝群或围观朋友圈


点下方原文链接观看B站视频版本

good-icon 0
favorite-icon 0
收藏
回复数量: 0
    暂无评论~~
    Ctrl+Enter