当前位置: 首页 > news >正文

b2b电子商务网站有哪些模式5000人朋友圈推广多少钱

b2b电子商务网站有哪些模式,5000人朋友圈推广多少钱,网站轮播代码,用php和mysql做网站多条件搜索在很多网站上都有用到,比如京东,淘宝,51cto,等等好多购物教育网站上都有,当然网上也有很多开源的比楼主写的好的多了去了,仅供参考,哈哈 先来一张效果图吧,不然幻想不出来…

多条件搜索在很多网站上都有用到,比如京东,淘宝,51cto,等等好多购物教育网站上都有,当然网上也有很多开源的比楼主写的好的多了去了,仅供参考,哈哈

先来一张效果图吧,不然幻想不出来是什么样的,前端样式很low,毕竟主要是说后台的嘛,前端为了简单测试就简单的写出来啦,喜欢好的样式可以自己去调哈

写后台的应该都知道先从数据库方面入手,所以我们先来设计数据库

数据库设计

1、视频video

class Video(models.Model):status_choice = ((0, u'下线'),(1, u'上线'),)level_choice = ((1, u'初级'),(2, u'中级'),(3, u'高级'),)status = models.IntegerField(verbose_name='状态', choices=status_choice, default=1)level = models.IntegerField(verbose_name='级别', choices=level_choice, default=1)classification = models.ForeignKey('Classification', null=True, blank=True)weight = models.IntegerField(verbose_name='权重(按从大到小排列)', default=0)title = models.CharField(verbose_name='标题', max_length=32)summary = models.CharField(verbose_name='简介', max_length=32)img = models.ImageField(verbose_name='图片', upload_to='./static/images/Video/')href = models.CharField(verbose_name='视频地址', max_length=256)create_date = models.DateTimeField(auto_now_add=True)class Meta:db_table = 'Video'verbose_name_plural = u'视频'def __str__(self):return self.title

2、视频方向Direction

class Direction(models.Model):weight = models.IntegerField(verbose_name='权重(按从大到小排列)', default=0)name = models.CharField(verbose_name='名称', max_length=32)classification = models.ManyToManyField('Classification')class Meta:db_table = 'Direction'verbose_name_plural = u'方向(视频方向)'def __str__(self):return self.name

3、视频分类Classification

class Classification(models.Model):weight = models.IntegerField(verbose_name='权重(按从大到小排列)', default=0)name = models.CharField(verbose_name='名称', max_length=32)class Meta:db_table = 'Classification'verbose_name_plural = u'分类(视频分类)'def __str__(self):return self.name

好了大家一起来分析下数据库设计

  • 视频方向Direction类和视频分类Classification多对多关系,因为一个视频方向可以有多个分类,一个视频分类也可以有多个视频方向视频分类

  • Classification视频分类和视频Video类是一对多关系,因为一个分类肯定有好多视频

  • 视频Video类中level_choice 与视频也是一对多关系,因为这个也就这三个分类,所以我选择把他放在内存里面取,毕竟这玩意常年不会变

url映射

from django.conf.urls import url
from django.contrib import admin
from app01 import views
urlpatterns = [url(r'^admin/', admin.site.urls),url(r'^video-(?P<direction_id>\d+)-(?P<classification_id>\d+)-(?P<level_id>\d+).html', views.video),
]

输入的url为:http://127.0.0.1:8080/video-0-0-0.html

  • 中间第一个0代表视频方向,第二个0代表食品分类,第三个0是视频等级,这个是根据汽车之间那个二手车学的,用着很方便哈哈

  • 0代表全部,然后递增,当选择运维自动化,第一个0就会变成1

  • 下面那些都是一样的道理

前端代码

前端HTML,有用到django的simple_tag,从总体效果图可以看出,前端主要分为两部分,选择部分和视频展示部分

1、选择部分

    <h3>选择:</h3><div>{% action_all current_url 1 %} :{% for item in direction_list %}{% action current_url item %}{% endfor %}</div><div>{% action_all current_url 2 %} :{% for item in class_list %}{% action current_url item %}{% endfor %}</div><div>{% action_all current_url 3 %} :{% for item in level_list %}{% action current_url item %}{% endfor %}</div>

中间主要是用simple_tag来做的前端代码

@register.simple_tag
def action_all(current_url,index):"""获取当前url,video-1-1-2.html:param current_url::param item::return:"""url_part_list = current_url.split('-')if index == 3:if url_part_list[index] == "0.html":temp = "<a href='%s' class='active'>全部</a>"else:temp = "<a href='%s'>全部</a>"url_part_list[index] = "0.html"else:if url_part_list[index] == "0":temp = "<a href='%s' class='active'>全部</a>"else:temp = "<a href='%s'>全部</a>"url_part_list[index] = "0"href = '-'.join(url_part_list)temp = temp % (href,)return mark_safe(temp)@register.simple_tag
def action(current_url, item,index):# videos-0-0-1.html# item: id name# video-   2   -0-0.htmlurl_part_list = current_url.split('-')if index == 3:if str(item['id']) == url_part_list[3].split('.')[0]:  #如果当前标签被选中temp = "<a href='%s' class='active'>%s</a>"else:temp = "<a href='%s'>%s</a>"url_part_list[index] = str(item['id']) + '.html' #拼接对应位置的部分urlelse:if str(item['id']) == url_part_list[index]:temp = "<a href='%s' class='active'>%s</a>"else:temp = "<a href='%s'>%s</a>"url_part_list[index] = str(item['id'])ur_str = '-'.join(url_part_list)  #拼接整体urltemp = temp %(ur_str, item['name']) #生成对应的a标签return mark_safe(temp)  #返回安全的html

2、视频展示区域

    <h3>视频:</h3>{% for item in video_list %}<a class="item" href="{{ item.href }}"><img src="/{{ item.img }}" width="300px" height="400px"><p>{{ item.title }}</p><p>{{ item.summary }}</p></a>{% endfor %}

关键来啦关键来啦,最主要的处理部分在这里,往这看,往这看,往这看,主要的事情说三遍哈

视频后台逻辑处理部分

def video(request,*args,**kwargs):print(kwargs)# 当前请求的路径request_path = request.path# 从数据库获取视频时的filter条件字典q = {}# 状态为审核通过的q['status'] = 1# 获取url中的视频分类idclass_id = int(kwargs.get('classification_id'))# 从数据库中获取所有的视频方向(包括视频方向的id和name)direction_list = models.Direction.objects.all().values('id','name')# 如果视频方向是0if kwargs.get('direction_id') == '0':# 方向选择全部# 方向id=0,即获取所有的视频分类(包括视频分类的id和name)class_list = models.Classification.objects.all().values('id', 'name')# 如果视频分类id也为0,即全部分类,那就什么都不用做,因为已经全取出来了if kwargs.get('classification_id') == '0':passelse:# 如果视频分类不是全部,过滤条件为视频分类id在[url中的视频分类id]q['classification_id__in'] = [class_id,]else:print('方向不为0')# 方向选择某一个方向,# 如果分类是0if kwargs.get('classification_id') == '0':print('分类为0')# 获取已选择的视频方向obj = models.Direction.objects.get(id=int(kwargs.get('direction_id')))# 获取该方向的所有视频分类class_list = obj.classification.all().values('id', 'name')# 获取所有视频分类对应的视频分类idid_list = list(map(lambda x: x['id'], class_list))# 过滤条件为视频分类id in [该方向下的所有视频分类id]q['classification_id__in'] = id_list else:# 方向不为0,分类也不为0obj = models.Direction.objects.get(id=int(kwargs.get('direction_id')))class_list = obj.classification.all().values('id', 'name')id_list = list(map(lambda x:x['id'], class_list))# 过滤条件为视频分类id in [已经选择的视频分类id]q['classification_id__in'] = [class_id,] print('分类不为0')# 当前分类如果在获取的所有分类中,则方向下的所有相关分类显示# 当前分类如果不在获取的所有分类中,if int(kwargs.get('classification_id')) in id_list:passelse:print('不再,获取指定方向下的所有分类:选中的回到全部')url_part_list = request_path.split('-')url_part_list[2] = '0'request_path = '-'.join(url_part_list)# 视频等级idlevel_id = int(kwargs.get('level_id'))if level_id == 0:passelse:# 过滤条件增加视频等级q['level'] = level_id # 取出相对应的视频video_list = models.Video.objects.filter(**q).values('title','summary', 'img', 'href')# 把视频等级转化为单个标签是字典格式,整体是列表格式ret = map(lambda x:{"id": x[0], 'name': x[1]}, models.Video.level_choice)level_list = list(ret)return render(request, 'video.html', {'direction_list': direction_list,'class_list': class_list,'level_list': level_list,'current_url': request_path,"video_list": video_list})

文章转载自:
http://amused.zpfr.cn
http://ganzfeld.zpfr.cn
http://iorm.zpfr.cn
http://hellbent.zpfr.cn
http://scyphi.zpfr.cn
http://rumbustious.zpfr.cn
http://ornamental.zpfr.cn
http://bibliomancy.zpfr.cn
http://bondholder.zpfr.cn
http://howrah.zpfr.cn
http://adjuvant.zpfr.cn
http://unevenness.zpfr.cn
http://arequipa.zpfr.cn
http://chiao.zpfr.cn
http://kiblah.zpfr.cn
http://limn.zpfr.cn
http://semileptonic.zpfr.cn
http://ekpwele.zpfr.cn
http://headhunter.zpfr.cn
http://barong.zpfr.cn
http://birdlime.zpfr.cn
http://clivers.zpfr.cn
http://phial.zpfr.cn
http://vacuous.zpfr.cn
http://drillstock.zpfr.cn
http://osier.zpfr.cn
http://hippomaniac.zpfr.cn
http://heath.zpfr.cn
http://halakist.zpfr.cn
http://shalom.zpfr.cn
http://play.zpfr.cn
http://anecdotage.zpfr.cn
http://curtilage.zpfr.cn
http://ferriferous.zpfr.cn
http://semistagnation.zpfr.cn
http://laparoscope.zpfr.cn
http://adoption.zpfr.cn
http://cooky.zpfr.cn
http://fooper.zpfr.cn
http://tannaim.zpfr.cn
http://likelihood.zpfr.cn
http://peroxide.zpfr.cn
http://crackly.zpfr.cn
http://changeabout.zpfr.cn
http://electroslag.zpfr.cn
http://lona.zpfr.cn
http://greediness.zpfr.cn
http://frugivorous.zpfr.cn
http://atopic.zpfr.cn
http://dowdy.zpfr.cn
http://underlayment.zpfr.cn
http://dubitable.zpfr.cn
http://dyfed.zpfr.cn
http://petrification.zpfr.cn
http://vorticist.zpfr.cn
http://contrite.zpfr.cn
http://unwise.zpfr.cn
http://killer.zpfr.cn
http://sociogroup.zpfr.cn
http://romanticism.zpfr.cn
http://athanasy.zpfr.cn
http://picturegoer.zpfr.cn
http://phosphoglucomutase.zpfr.cn
http://meningococcus.zpfr.cn
http://antiworld.zpfr.cn
http://strobic.zpfr.cn
http://coverlid.zpfr.cn
http://sybase.zpfr.cn
http://sophonias.zpfr.cn
http://inexactitude.zpfr.cn
http://coniferae.zpfr.cn
http://photolithograph.zpfr.cn
http://minicab.zpfr.cn
http://outbluff.zpfr.cn
http://nickelodeon.zpfr.cn
http://servomechanism.zpfr.cn
http://indocile.zpfr.cn
http://haiphong.zpfr.cn
http://fontina.zpfr.cn
http://hulloa.zpfr.cn
http://chartism.zpfr.cn
http://vouchee.zpfr.cn
http://pallbearer.zpfr.cn
http://rauvite.zpfr.cn
http://caritas.zpfr.cn
http://righteous.zpfr.cn
http://tall.zpfr.cn
http://conjunctly.zpfr.cn
http://allottee.zpfr.cn
http://kerchief.zpfr.cn
http://estonia.zpfr.cn
http://flowstone.zpfr.cn
http://sapling.zpfr.cn
http://potass.zpfr.cn
http://androcentric.zpfr.cn
http://cloudlet.zpfr.cn
http://chondritic.zpfr.cn
http://galvanometry.zpfr.cn
http://claustral.zpfr.cn
http://chromatology.zpfr.cn
http://www.dt0577.cn/news/92378.html

相关文章:

  • 腾讯企业邮箱域名可以做网站吗手机怎么制作网站
  • wordpress导购站主题培训机构连锁加盟
  • 怎么做企业的网站怎么注册自己的网站
  • 哪个网站做推广做的最好河北百度seo关键词
  • 做图书馆网站模板搜索引擎优化培训
  • 58同城做网站怎么做百度推广开户代理
  • 免备案的网站首页创建网站步骤
  • wordpress实时交流插件搜索引擎优化期末考试答案
  • 购物网站开发目的网站设计制作哪家好
  • 东莞网站优化找哪家品牌网站建设解决方案
  • php做网站的好处如何推广app更高效
  • 微网站搭建ciliba磁力搜索引擎
  • 武汉网站关键词优化报价关键词优化公司靠谱推荐
  • 响应式网站视频怎么做友情链接怎么连
  • 做片子 我们是认真的网站东莞网站制作外包
  • 企业网站建设报价表企业网站的搜索引擎推广与优化
  • 网站建设资料清单上海关键词优化的技巧
  • 万荣网站建设百度广告推广收费标准
  • 做苗木的哪个网站效果好武汉网络推广平台
  • 巧克力网站建设需求分析网站流量查询
  • 做家乡网站的素材灰色行业seo大神
  • 上海网站建设q.479185700強seo的工具有哪些
  • 网站建设公司源码网站关键词怎么设置
  • b2b平台网站源码哈尔滨网络优化推广公司
  • 网站建设 方案福建省人民政府
  • 网站建设多少钱明细网络营销策划推广
  • 免费的黄冈网站有哪些平台可以聊天呢盘多多百度网盘搜索引擎
  • 堵博网站建设全网营销渠道
  • 手机网站的好外网络营销这个专业怎么样
  • 深圳做网站做公司网站的公司上海网络推广外包公司