remain_count
This commit is contained in:
parent
996a18043a
commit
fdee8192c2
|
@ -9,8 +9,7 @@
|
||||||
<text class="weui-badge" style="background:orange" wx:if="{{item.is_top}}">置顶</text>
|
<text class="weui-badge" style="background:orange" wx:if="{{item.is_top}}">置顶</text>
|
||||||
{{item.title}}</view>
|
{{item.title}}</view>
|
||||||
<view class="weui-media-box__desc">
|
<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}}
|
{{item.update_time}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<view class="head">
|
<view class="head">
|
||||||
题量: {{tm_index+1}}/{{tmtotal}}
|
<!-- 题量: {{tm_index+1}}/{{tmtotal}} -->
|
||||||
</view>
|
</view>
|
||||||
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
|
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
|
||||||
<view class="weui-article">
|
<view class="weui-article">
|
||||||
|
|
|
@ -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='体验次数'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,5 +1,5 @@
|
||||||
from django.urls import path,include
|
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
|
from rest_framework import routers
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,5 +10,6 @@ router.register('company', CompanyViewSet, basename="company")
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('consumer/mplogin/', ConsumerMPLoginView.as_view()),
|
path('consumer/mplogin/', ConsumerMPLoginView.as_view()),
|
||||||
path('consumer/register/', ConsumerRegister.as_view()),
|
path('consumer/register/', ConsumerRegister.as_view()),
|
||||||
|
path('change_remain_count/', change_remain_count.as_view()),
|
||||||
path('', include(router.urls)),
|
path('', include(router.urls)),
|
||||||
]
|
]
|
||||||
|
|
|
@ -300,3 +300,14 @@ class ConsumerRegister(APIView):
|
||||||
return Response({'error':'认证错误!'})
|
return Response({'error':'认证错误!'})
|
||||||
else:
|
else:
|
||||||
return Response({'error':'信息不全!'})
|
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)
|
|
@ -142,6 +142,8 @@ STATIC_ROOT = os.path.join(BASE_DIR,'static')
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||||
|
'rest_framework.authentication.BasicAuthentication',
|
||||||
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
'crm.authentication.MyTokenAuthentication'
|
'crm.authentication.MyTokenAuthentication'
|
||||||
],
|
],
|
||||||
'DEFAULT_PERMISSION_CLASSES':[
|
'DEFAULT_PERMISSION_CLASSES':[
|
||||||
|
|
Loading…
Reference in New Issue