remain_count

This commit is contained in:
caoqianming 2020-05-02 11:29:29 +08:00
parent 996a18043a
commit fdee8192c2
6 changed files with 35 additions and 4 deletions

View File

@ -9,8 +9,7 @@
<text class="weui-badge" style="background:orange" wx:if="{{item.is_top}}">置顶</text>
{{item.title}}</view>
<view class="weui-media-box__desc">
来源:
<span style="font-weight:bold;color:darkblue">{{item.ifrom}}</span>
<span style="font-weight:bold;color:darkblue">{{item.ifrom}} </span>
{{item.update_time}}
</view>
</view>

View File

@ -1,5 +1,5 @@
<view class="head">
题量: {{tm_index+1}}/{{tmtotal}}
<!-- 题量: {{tm_index+1}}/{{tmtotal}} -->
</view>
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
<view class="weui-article">

View File

@ -0,0 +1,18 @@
# Generated by Django 3.0.4 on 2020-05-02 02:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crm', '0013_consumer_remain_count'),
]
operations = [
migrations.AlterField(
model_name='consumer',
name='remain_count',
field=models.IntegerField(default=3, verbose_name='体验次数'),
),
]

View File

@ -1,5 +1,5 @@
from django.urls import path,include
from .views import CompanyViewSet, ConsumerViewSet, ConsumerMPLoginView, ConsumerRegister
from .views import CompanyViewSet, ConsumerViewSet, ConsumerMPLoginView, ConsumerRegister, change_remain_count
from rest_framework import routers
@ -10,5 +10,6 @@ router.register('company', CompanyViewSet, basename="company")
urlpatterns = [
path('consumer/mplogin/', ConsumerMPLoginView.as_view()),
path('consumer/register/', ConsumerRegister.as_view()),
path('change_remain_count/', change_remain_count.as_view()),
path('', include(router.urls)),
]

View File

@ -300,3 +300,14 @@ class ConsumerRegister(APIView):
return Response({'error':'认证错误!'})
else:
return Response({'error':'信息不全!'})
class change_remain_count(APIView):
perms_map=[{'*':'change_remain_count'}]
def get(self, request, *args, **kwargs):
# count = request.query_params.get('count', None)
# if count:
for i in Consumer.objects.all():
i.remain_count = i.remain_count + 2
i.save()
return Response(status=status.HTTP_200_OK)

View File

@ -142,6 +142,8 @@ STATIC_ROOT = os.path.join(BASE_DIR,'static')
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'crm.authentication.MyTokenAuthentication'
],
'DEFAULT_PERMISSION_CLASSES':[