ticon-issue-opened"> Обсуждения 0 Пулл реквесты 0 Коммиты 1617 Релизы 0

Нет описания

huangqimin001: 28f8bc3cb9 :art: Models update for tenancy лет %!s(int64=3): %!d(string=назад)
..
0001_initial.py aa31a5f59a Add kodo лет %!s(int64=8): %!d(string=назад)
0002_auto_20180104_0414.py 018d52f61d Update package django_xxx лет %!s(int64=8): %!d(string=назад)
0003_auto_20180104_0428.py 9ec76d526a TextField => CharField лет %!s(int64=8): %!d(string=назад)
0004_latestappinfo.py 018d52f61d Update package django_xxx лет %!s(int64=8): %!d(string=назад)
0005_auto_20180115_0021.py 49634dc097 Add api operator login лет %!s(int64=8): %!d(string=назад)
0006_auto_20180115_0047.py 49634dc097 Add api operator login лет %!s(int64=8): %!d(string=назад)
0007_consumeinfosubmitloginfo.py 1b1f0192f8 ConsumeInfoSubmitLogInfo лет %!s(int64=8): %!d(string=назад)
0008_auto_20180129_0422.py a77c4993f8 FloatField лет %!s(int64=8): %!d(string=назад)
0009_auto_20180129_0426.py e04f95dc5e long => lon лет %!s(int64=8): %!d(string=назад)
0010_modelinfo_integral.py 71993af1e4 Add integral for ModelInfo лет %!s(int64=8): %!d(string=назад)
0011_modelinfo_model_full_name.py 145973f8f0 Add brand_full_name for BrandInfo лет %!s(int64=8): %!d(string=назад)
0012_auto_20180401_2012.py f1260953bf Move image/url from ModelImageInfo to ModelInfo лет %!s(int64=8): %!d(string=назад)
0013_consumeinfosubmitloginfo_test_user.py e47aa7f8c4 Add field test_user лет %!s(int64=8): %!d(string=назад)
0014_auto_20180508_1058.py c7b55979c0 Add province code/name for DistributorInfo лет %!s(int64=8): %!d(string=назад)
0015_auto_20180508_1433.py d10bd672ea AdministratorInfo/BrandModelDistributorPriceInfo лет %!s(int64=8): %!d(string=назад)
0016_auto_20180508_1507.py d10bd672ea AdministratorInfo/BrandModelDistributorPriceInfo лет %!s(int64=8): %!d(string=назад)
0017_auto_20180508_1830.py 537c495621 Statistic лет %!s(int64=8): %!d(string=назад)
0018_auto_20180514_1519.py 62948fb5c3 Operator add/delete/update/list лет %!s(int64=8): %!d(string=назад)
0019_saleclerkinfo.py 137ed6dee2 Clerk add/delete/update/list лет %!s(int64=8): %!d(string=назад)
0020_auto_20180517_1819.py 2988703c52 Update лет %!s(int64=8): %!d(string=назад)
0021_auto_20180522_1100.py e7dcf47e22 SaleclerkInfo лет %!s(int64=8): %!d(string=назад)
0022_auto_20180522_1355.py b90bf186bc brand_domain лет %!s(int64=8): %!d(string=назад)
0023_auto_20180826_0448.py 3f9969cafc Support scan jancode лет %!s(int64=7): %!d(string=назад)
0024_latestappscreeninfo.py 900c3fd386 Makemigrations лет %!s(int64=7): %!d(string=назад)
0025_auto_20180917_1554.py 9c585b197e Mch migrations лет %!s(int64=7): %!d(string=назад)
0026_auto_20180930_1159.py 66a598b30c Makemigrations лет %!s(int64=7): %!d(string=назад)
0027_distributorinfo_distributor_short_name.py deb84bfcb5 Makemigrations лет %!s(int64=7): %!d(string=назад)
0028_consumeinfosubmitloginfo_dupload.py e9f8a35b9d Makemigrations лет %!s(int64=7): %!d(string=назад)
0029_auto_20181117_0052.py b8784eee8a Makemigrations лет %!s(int64=7): %!d(string=назад)
0030_auto_20190301_1402.py ff3a23ccf0 Activity лет %!s(int64=7): %!d(string=назад)
0031_activityinfo_model_uni_names.py ded4db2cda activityinfo_model_uni_names лет %!s(int64=7): %!d(string=назад)
0032_auto_20190521_1544.py 5a8859fa5e Makemigrations лет %!s(int64=7): %!d(string=назад)
0033_consumeinfosubmitloginfo_activity_id.py 3ade638ea3 Makemigrations лет %!s(int64=7): %!d(string=назад)
0034_auto_20190620_1709.py d666c88eac COUPON_EXPIRED_TIME_TUPLE лет %!s(int64=7): %!d(string=назад)
0035_auto_20190625_1443.py 219acdedb1 Add field has_used лет %!s(int64=7): %!d(string=назад)
0036_auto_20190701_1441.py 77c612316a queryusedsn лет %!s(int64=7): %!d(string=назад)
0037_auto_20190826_1537.py 8d998319f7 Makemigrations лет %!s(int64=6): %!d(string=назад)
0038_auto_20190826_1625.py 9db41fee66 default False лет %!s(int64=6): %!d(string=назад)
0039_auto_20191119_1348.py 3d0d214667 :sparkles: Member Infos лет %!s(int64=6): %!d(string=назад)
0040_modelinfo_shot_member_name.py 4ce7f5c87b :art: Member Relative APIs лет %!s(int64=6): %!d(string=назад)
0041_activityinfo_coupon_id.py a8239c077f :art: CouponInfo for coupon app лет %!s(int64=6): %!d(string=назад)
0042_auto_20200113_1832.py 212f24c882 MarketCode лет %!s(int64=6): %!d(string=назад)
0043_modelcamerabodyinfo.py 72656ceaff :art: model/cameras лет %!s(int64=6): %!d(string=назад)
0044_modelcamerabodyinfo_camera_brand_name.py 9619c195e6 :art: Makemigrations лет %!s(int64=6): %!d(string=назад)
0045_auto_20200304_1826.py dccd94c448 :art: Opt api model/cameras лет %!s(int64=6): %!d(string=назад)
0046_cameramodelinfo.py dccd94c448 :art: Opt api model/cameras лет %!s(int64=6): %!d(string=назад)
0047_auto_20200304_1848.py dccd94c448 :art: Opt api model/cameras лет %!s(int64=6): %!d(string=назад)
0048_modelcamerabodyinfo_is_important.py 43455cdf4e :art: Support is_important лет %!s(int64=6): %!d(string=назад)
0049_modelcamerabodyinfo_camera_market_time.py da799e7af6 :art: Add field camera_market_time for CameraModelInfo/ModelCameraBodyInfo лет %!s(int64=6): %!d(string=назад)
0050_cameramodelinfo_camera_market_time.py da799e7af6 :art: Add field camera_market_time for CameraModelInfo/ModelCameraBodyInfo лет %!s(int64=6): %!d(string=назад)
0051_auto_20200314_2340.py 7dc0b7fc6b :art: Makemigrations лет %!s(int64=6): %!d(string=назад)
0052_consumeinfosubmitloginfo_code_version.py 03631cb847 add code_version лет %!s(int64=6): %!d(string=назад)
0053_auto_20200407_1118.py 608bdf8508 makemigrations лет %!s(int64=6): %!d(string=назад)
0054_auto_20200411_2143.py 58c38a0546 整理 优惠券 лет %!s(int64=6): %!d(string=назад)
0055_auto_20200601_1634.py 89c3cefcc7 saleclerk migrate лет %!s(int64=6): %!d(string=назад)
0056_auto_20200601_1640.py 3872355991 add department_name лет %!s(int64=6): %!d(string=назад)
0057_auto_20200602_1403.py 11df57b63d support qy login лет %!s(int64=6): %!d(string=назад)
0058_auto_20201202_1203.py 6a9e324f6f :art: Re Makemigrations лет %!s(int64=5): %!d(string=назад)
0059_auto_20201221_1115.py 4ba79f76cd 后台管理,添加运营人员角色 лет %!s(int64=5): %!d(string=назад)
0060_modelinfo_is_show_shot.py 45f886651e 添加 is_show_shot 用于控制是否在前端显示 лет %!s(int64=5): %!d(string=назад)
0061_consumeinfosubmitloginfo_integral.py 39290e111b ConsumeInfoSubmitLogInfo 记录用户积分 лет %!s(int64=5): %!d(string=назад)
0062_distributorinfo_office.py 8dcde2c80c 销售员提交新增事务所和销售担当,以及经销商ID лет %!s(int64=4): %!d(string=назад)
0063_auto_20210915_1653.py 414cc1ada2 :art: back_express_name / back_tracking_number лет %!s(int64=4): %!d(string=назад)
0064_alter_modelinfo_display.py 28f8bc3cb9 :art: Models update for tenancy лет %!s(int64=3): %!d(string=назад)
__init__.py aa31a5f59a Add kodo лет %!s(int64=8): %!d(string=назад)
kodo - Gogs: Go Git Service

Aucune description

model_views.py 6.8KB

    # -*- coding: utf-8 -*- from __future__ import division import monetary from django.conf import settings from django.db.models import Q from django_logit import logit from django_response import response from paginator import pagination from account.models import UserInfo from mch.models import AdministratorInfo, ModelCameraBodyInfo, ModelInfo from utils.error.errno_utils import AdministratorStatusCode, ProductModelStatusCode, UserStatusCode @logit def model_add(request): jancode = request.POST.get('jancode', '') model_name = request.POST.get('model_name', '') model_uni_name = request.POST.get('model_uni_name', '') model_full_name = request.POST.get('model_full_name', '') image_path = request.POST.get('image_path', '') image2_path = request.POST.get('image2_path', '') factory_yuan = request.POST.get('factory_yuan', 1000) integral = int(request.POST.get('integral', 100)) category = request.POST.get('category', '') warehouse = request.POST.get('warehouse', '') admin_id = request.session.get('admin_id') is_important = request.POST.get('is_important', 0) try: administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True) except AdministratorInfo.DoesNotExist: return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) ModelInfo.objects.create( brand_id=administrator.brand_id, jancode=jancode, model_name=model_name, model_uni_name=model_uni_name, model_full_name=model_full_name, category=category, warehouse=warehouse, image=image_path, image2=image2_path, factory_yuan=factory_yuan, factory_fee=monetary.Yuan2Fen(factory_yuan), integral=integral, is_important=is_important, ) return response(200, 'Model Add Success', u'型号添加成功') @logit def model_delete(request): model_id = request.POST.get('model_id', '') admin_id = request.session.get('admin_id') try: administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True) except AdministratorInfo.DoesNotExist: return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) try: modelObj = ModelInfo.objects.get(brand_id=administrator.brand_id, model_id=model_id, status=True) except ModelInfo.DoesNotExist: return response(ProductModelStatusCode.MODEL_NOT_FOUND) modelObj.status = False modelObj.save() return response(200, 'Model Delete Success', u'型号删除成功') @logit def model_update(request): jancode = request.POST.get('jancode', '') model_id = request.POST.get('model_id', '') model_name = request.POST.get('model_name', '') model_uni_name = request.POST.get('model_uni_name', '') model_full_name = request.POST.get('model_full_name', '') image_path = request.POST.get('image_path', '') image2_path = request.POST.get('image2_path', '') factory_yuan = request.POST.get('factory_yuan', 1000) integral = int(request.POST.get('integral', 100)) category = request.POST.get('category', '') warehouse = request.POST.get('warehouse', '') admin_id = request.session.get('admin_id') is_important = request.POST.get('is_important', 0) try: administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True) except AdministratorInfo.DoesNotExist: return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) try: modelObj = ModelInfo.objects.get(brand_id=administrator.brand_id, model_id=model_id, status=True) except ModelInfo.DoesNotExist: return response(ProductModelStatusCode.MODEL_NOT_FOUND) if jancode: modelObj.jancode = jancode if model_name: modelObj.model_name = model_name if model_uni_name: modelObj.model_uni_name = model_uni_name if model_full_name: modelObj.model_full_name = model_full_name if category: modelObj.category = category if warehouse: modelObj.warehouse = warehouse if image_path: modelObj.image = image_path if image2_path: modelObj.image2 = image2_path if factory_yuan: modelObj.factory_yuan = factory_yuan modelObj.factory_fee = monetary.Yuan2Fen(factory_yuan) if integral: modelObj.integral = integral modelObj.is_important = is_important modelObj.save() return response(200, 'Model Update Success', u'型号更新成功') @logit def model_list(request): page = request.POST.get('page', 1) num = request.POST.get('num', 20) admin_id = request.session.get('admin_id') try: administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True) except AdministratorInfo.DoesNotExist: return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) models = ModelInfo.objects.filter(brand_id=administrator.brand_id, display=True, status=True).order_by('-pk') count = models.count() models, left = pagination(models, page, num) models = [mdl.admindata for mdl in models] return response(200, 'Get Model List Success', u'获取型号列表成功', { 'models': models, 'count': count, 'left': left, }) @logit def model_name_list(request): brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) user_id = request.POST.get('user_id', '') # 校验用户是否存在 try: user = UserInfo.objects.get(user_id=user_id) except UserInfo.DoesNotExist: return response(UserStatusCode.USER_NOT_FOUND) models = ModelCameraBodyInfo.objects.filter(brand_id=brand_id, status=True).order_by('-is_important', 'model_name').values_list('model_name', flat=True) models = list(models) return response(200, 'Get Model Name List Success', u'获取型号列表成功', { 'models': sorted(set(models), key=models.index) }) @logit def model_cameras(request): brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) kw = request.POST.get('kw', '') page = request.POST.get('page', 1) num = request.POST.get('num', 20) cameras = ModelCameraBodyInfo.objects.filter(brand_id=brand_id, status=True) if kw: cameras = cameras.filter(Q(model_name__icontains=kw) | Q(model_full_name__icontains=kw) | Q(camera_name__icontains=kw)) cameras = cameras.order_by('-is_important', 'model_name', '-camera_market_time') count = cameras.count() cameras, left = pagination(cameras, page, num) cameras = [camera.data for camera in cameras] return response(200, 'Get Model Adaptive Camera List Success', u'获取型号适配机身列表成功', { 'cameras': cameras, 'count': count, 'left': left, })