-        viewModel.delegate = self
24
+        photoDetailViewController.viewModel = viewModel        
28 25
     }
29 26
     
30
-    func start() {
31
-        
27
+    override func start() -> Observable<Void> {
28
+        photoDetailViewController.viewModel.delegate = self
29
+        return .never()
32 30
     }
33 31
 }
34 32
 
@@ -37,14 +35,15 @@ extension PhotoDetailCoordinator: PhotoDetailViewModelDelegate {
37 35
         let vc = GroupViewController.instantiate()
38 36
         vc.viewModel = GroupViewModel(groupItem: item)
39 37
         let coordinator = GroupCoordinator(vc,
40
-                                           navigationController: navigationController)
41
-        coordinators[.group] = coordinator
38
+                                           navigationController: navigationController,
39
+                                           navigationSource: .photoDetail)
42 40
         
41
+        coordinate(to: coordinator).subscribe().disposed(by: disposeBag)
43 42
         navigationController.pushViewController(vc)
44 43
     }
45 44
     
46 45
     func didSelected() {
47
-        let vc = UIStoryboard.photoDetail.instantiateController(PhotoPreviewViewController.self)
46
+        let vc = PhotoPreviewViewController.instantiate()
48 47
         vc.viewModel = shareViewModel
49 48
         photoDetailViewController.presentController(vc)
50 49
     }

+ 2 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailImageCell.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoDetailImageCell.swift
3 3
 //  Paiai_iOS
4 4
 //
5
-//  Created by ffib on 2019/3/19.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/3/19.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import UIKit

+ 13 - 7
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailViewController.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  PhotoDetailViewController.swift
3
-//  PaiAi
3
+//  Paiai_iOS
4 4
 //
5
-//  Created by zhengjianfei on 16/4/6.
5
+//  Created by FFIB on 16/4/6.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.
7 7
 //
8 8
 
@@ -97,11 +97,11 @@ extension PhotoDetailViewController {
97 97
 /// bind storyboard button action
98 98
 extension PhotoDetailViewController {
99 99
     @IBAction func share() {
100
-        let ctl = UIStoryboard.photoDetail.instantiateController(ShareViewController.self)
101
-        ctl.shareContent = "我使用拍爱分享了一张美图,你也快来试试吧"
102
-        //        ctl.shareImgUrlThumb = datas[currentPhotoIndex].photo_thumbnail_url
103
-        //        ctl.shareUrl = datas[currentPhotoIndex].photo_share_url
104
-        presentController(ctl)
100
+//        let ctl = ShareViewController UIStoryboard.photoDetail.instantiateController(ShareViewController.self)
101
+//        ctl.shareContent = "我使用拍爱分享了一张美图,你也快来试试吧"
102
+//        //        ctl.shareImgUrlThumb = datas[currentPhotoIndex].photo_thumbnail_url
103
+//        //        ctl.shareUrl = datas[currentPhotoIndex].photo_share_url
104
+//        presentController(ctl)
105 105
     }
106 106
     
107 107
     @IBAction func comment() {
@@ -380,3 +380,9 @@ extension PhotoDetailViewController: UICollectionViewDelegateFlowLayout {
380 380
 }
381 381
 
382 382
 extension PhotoDetailViewController: NavigationBackViewController {}
383
+
384
+extension PhotoDetailViewController: Storyboarded {
385
+    static func instantiate() -> PhotoDetailViewController {
386
+        return UIStoryboard.photoDetail.instantiateViewController(type: PhotoDetailViewController.self)
387
+    }
388
+}

+ 8 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoPreviewViewController.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  PhotoPreviewViewController.swift
3
-//  PaiAi
3
+//  Paiai_iOS
4 4
 //
5
-//  Created by zhengjianfei on 16/4/9.
5
+//  Created by FFIB on 16/4/9.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.
7 7
 //
8 8
 
@@ -122,3 +122,9 @@ extension PhotoPreviewViewController: UICollectionViewDelegateFlowLayout {
122 122
         return CGSize(width: collectionView.width, height: collectionView.height - 20)
123 123
     }
124 124
 }
125
+
126
+extension PhotoPreviewViewController: Storyboarded {
127
+    static func instantiate() -> PhotoPreviewViewController {
128
+        return UIStoryboard.photoDetail.instantiateViewController(type: PhotoPreviewViewController.self)
129
+    }
130
+}

+ 2 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/ShareController.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  ShareViewController.swift
3
-//  PaiAi
3
+//  Paiai_iOS
4 4
 //
5
-//  Created by zhengjianfei on 16/4/7.
5
+//  Created by FFIB on 16/4/7.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.
7 7
 //
8 8
 

+ 2 - 2
PaiAi/Paiai_iOS/Paiai_iOS.h

@@ -2,8 +2,8 @@
2 2
 //  Paiai_iOS.h
3 3
 //  Paiai_iOS
4 4
 //
5
-//  Created by ffib on 2018/12/19.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/19.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 #import <UIKit/UIKit.h>

+ 41 - 0
PaiAi/Paiai_iOS/Reusable/BaseCoordinator.swift

@@ -0,0 +1,41 @@
1
+//
2
+//  BaseCoordinator.swift
3
+//  Paiai_iOS
4
+//
5
+//  Created by FFIB on 2019/4/29.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7
+//
8
+
9
+import RxSwift
10
+import Foundation
11
+
12
+public class BaseCoordinator<ResultType> {
13
+    
14
+    typealias CoordinationResult = ResultType
15
+    
16
+    let disposeBag = DisposeBag()
17
+    let didCancel = PublishSubject<Void>()
18
+    
19
+    private let identifier = UUID()
20
+    private var childCoordinators = [UUID: Any]()
21
+    
22
+    private func store<T>(coordinator: BaseCoordinator<T>) {
23
+        childCoordinators[coordinator.identifier] = coordinator
24
+    }
25
+    
26
+    private func free<T>(coordinator: BaseCoordinator<T>) {
27
+        childCoordinators[coordinator.identifier] = nil
28
+    }
29
+    
30
+    func coordinate<T>(to coordinator: BaseCoordinator<T>) -> Observable<T> {
31
+        store(coordinator: coordinator)
32
+        return coordinator.start()
33
+            .do(onNext: { [weak self] _ in
34
+                self?.free(coordinator: coordinator)
35
+            })
36
+    }
37
+
38
+    func start() -> Observable<ResultType> {
39
+        fatalError("Start method should be implemented.")
40
+    }
41
+}

+ 2 - 2
PaiAi/Paiai_iOS/Reusable/Extension/UIImageView+Kingfisher.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  UIImageView+Kingfisher.swift
3
-//  PaiAi
3
+//  Paiai_iOS
4 4
 //
5
-//  Created by mac on 16/7/21.
5
+//  Created by FFIB on 16/7/21.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.
7 7
 //
8 8
 

+ 11 - 0
PaiAi/Paiai_iOS/Reusable/NavigationSource.swift

@@ -0,0 +1,11 @@
1
+//
2
+//  NavigationSource.swift
3
+//  Paiai_iOS
4
+//
5
+//  Created by ffib on 2019/5/5.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+
11
+enum NavigationSource {}

kodo - Gogs: Go Git Service

Нет описания

admin.py 13KB

    # -*- coding: utf-8 -*- import monetary from django.conf import settings from django.contrib import admin from django.contrib.auth.hashers import make_password from django_admin import AdvancedActionsModelAdmin, AdvancedExportExcelModelAdmin, DeleteModelAdmin, ReadOnlyModelAdmin from django_models_ext import ProvinceShortModelMixin from pysnippets.strsnippets import strip from mch.models import (ActivityInfo, AdministratorInfo, BrandInfo, CameraModelInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, LatestAppInfo, LatestAppScreenInfo, MaintenancemanInfo, ModelCameraBodyInfo, ModelInfo, OperatorInfo, SaleclerkInfo) from integral.models import SaleclerkSubmitLogInfo from utils.redis.rshot import update_member_shot_data class AdministratorInfoAdmin(admin.ModelAdmin): list_display = ('admin_id', 'admin_type', 'phone', 'password', 'encryption', 'name', 'brand_id', 'brand_name', 'user_status', 'status', 'created_at', 'updated_at') list_filter = ('admin_type', 'user_status', 'status', 'brand_name') readonly_fields = ('encryption', 'brand_name') def save_model(self, request, obj, form, change): obj.phone = strip(obj.phone) obj.password = strip(obj.password) if obj.password: obj.encryption = make_password(obj.password, settings.MAKE_PASSWORD_SALT, settings.MAKE_PASSWORD_HASHER) obj.password = '' obj.brand_id = strip(obj.brand_id) try: obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name except BrandInfo.DoesNotExist: obj.brand_name = '' obj.save() class OperatorInfoAdmin(admin.ModelAdmin): list_display = ('operator_id', 'phone', 'password', 'encryption', 'name', 'brand_id', 'brand_name', 'brand_domain', 'user_status', 'status', 'created_at', 'updated_at') list_filter = ('user_status', 'status', 'brand_name') readonly_fields = ('brand_domain', 'encryption', 'brand_name') def save_model(self, request, obj, form, change): obj.phone = strip(obj.phone) obj.password = strip(obj.password) if obj.password: obj.encryption = make_password(obj.password, settings.MAKE_PASSWORD_SALT, settings.MAKE_PASSWORD_HASHER) obj.password = '' obj.brand_id = strip(obj.brand_id) try: obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name except BrandInfo.DoesNotExist: obj.brand_name = '' obj.save() class BrandInfoAdmin(admin.ModelAdmin): list_display = ('brand_id', 'brand_name', 'brand_descr', 'brand_logo', 'brand_domain', 'position', 'status', 'created_at', 'updated_at') def save_model(self, request, obj, form, change): obj.save() OperatorInfo.objects.filter(brand_id=obj.brand_id).update(brand_domain=obj.brand_domain) class ModelInfoAdmin(AdvancedExportExcelModelAdmin, DeleteModelAdmin, admin.ModelAdmin): list_display = ('pk', 'brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr', 'image', 'url', 'image2', 'integral', 'position', 'display', 'is_important', 'shot_type_id', 'shot_member_integral', 'shot_member_image', 'shot_member_name', 'status', 'created_at', 'updated_at') list_filter = ('brand_name', 'shot_type_id', 'display', 'status') readonly_fields = ('brand_name', 'factory_fee') search_fields = ('brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr') def save_model(self, request, obj, form, change): obj.brand_id = strip(obj.brand_id) try: obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name except BrandInfo.DoesNotExist: obj.brand_name = '' obj.is_show_shot = True obj.save() ModelInfo.objects.filter(brand_id=obj.brand_id, model_uni_name=obj.model_uni_name).exclude(model_id=obj.model_id).update(is_show_shot=False) update_member_shot_data() #更新用户提交列表和销售员提交列表 SaleclerkSubmitLogInfo.objects.filter(model_pk=obj.pk).update( model_name=obj.model_name, model_uni_name=obj.model_uni_name, ) ConsumeInfoSubmitLogInfo.objects.filter(model_id=obj.model_id).update( model_uni_name=obj.model_uni_name, model_name=obj.model_name, ) # 更新"型号机身适配"型号图片 ModelCameraBodyInfo.objects.filter( brand_id=obj.brand_id, model_name=obj.model_uni_name, ).update( model_image=obj.shot_member_image, is_important=obj.is_important, ) def delete_model(self, request, obj): obj.delete() update_member_shot_data() class CameraModelInfoAdmin(admin.ModelAdmin): list_display = ('brand_id', 'brand_name', 'camera_brand_name', 'camera_name', 'camera_image', 'camera_market_time', 'status', 'created_at', 'updated_at') list_filter = ('brand_name', 'camera_brand_name', 'status') def save_model(self, request, obj, form, change): obj.save() # 更新"型号机身适配"机身图片 ModelCameraBodyInfo.objects.filter( brand_id=obj.brand_id, camera_brand_name=obj.camera_brand_name, camera_name=obj.camera_name, ).update( camera_image=obj.camera_image, camera_market_time=obj.camera_market_time, ) class ModelCameraBodyInfoAdmin(DeleteModelAdmin, admin.ModelAdmin): list_display = ('brand_id', 'brand_name', 'model_name', 'model_full_name', 'model_image', 'is_important', 'camera_brand_name', 'camera_name', 'camera_image', 'camera_market_time', 'status', 'created_at', 'updated_at') list_filter = ('brand_name', 'model_name', 'is_important', 'camera_brand_name', 'status') readonly_fields = ('model_image', 'camera_image', 'camera_market_time') search_fields = ('brand_id', 'brand_name', 'model_name', 'model_full_name', 'camera_name') class ModelImageInfoAdmin(admin.ModelAdmin): list_display = ('model_id', 'model_name', 'image', 'url', 'position', 'status', 'created_at', 'updated_at') list_filter = ('model_name', 'status') def save_model(self, request, obj, form, change): obj.model_id = strip(obj.model_id) try: obj.model_name = ModelInfo.objects.get(model_id=obj.model_id).model_name except BrandInfo.DoesNotExist: obj.model_name = '' obj.save() class DistributorInfoAdmin(admin.ModelAdmin): list_display = ('brand_id', 'brand_name', 'department_id', 'distributor_id', 'distributor_name', 'distributor_short_name', 'distributor_province_name', 'position', 'status', 'created_at', 'updated_at') list_filter = ('brand_name', 'sr_id', 'distributor_province_name', 'status') readonly_fields = ('brand_name', 'distributor_province_code') search_fields = ('brand_id', 'brand_name', 'distributor_id', 'distributor_name', 'distributor_short_name', 'distributor_descr', 'distributor_province_code', 'distributor_province_name') def save_model(self, request, obj, form, change): obj.brand_id = strip(obj.brand_id) try: obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name except BrandInfo.DoesNotExist: obj.brand_name = '' obj.distributor_province_code = ProvinceShortModelMixin.PROVINCE_NAME_CODE_DICT.get(obj.distributor_province_name, '') obj.save() class SaleclerkInfoAdmin(AdvancedExportExcelModelAdmin, AdvancedActionsModelAdmin, admin.ModelAdmin): list_display = ('brand_id', 'brand_name', 'distributor_id', 'distributor_name', 'clerk_id', 'clerk_name', 'clerk_sex', 'clerk_phone', 'unionid', 'openid', 'num', 'integral', 'total_integral', 'user_status', 'test_user', 'is_online_sales', 'status', 'created_at', 'updated_at') list_filter = ('test_user', 'user_status', 'is_online_sales', 'status') search_fields = ('brand_id', 'brand_name', 'distributor_id', 'distributor_name', 'clerk_id', 'clerk_name', 'clerk_phone', 'unionid', 'openid') actions_exclude = ('delete_selected', ) class MaintenancemanInfoAdmin(AdvancedExportExcelModelAdmin, AdvancedActionsModelAdmin, admin.ModelAdmin): list_display = ('brand_name', 'wx_userid', 'maintenance_id', 'maintenance_name', 'maintenance_phone', 'status', 'created_at', 'updated_at') search_fields = ('maintenance_id', 'maintenance_name', 'maintenance_phone') actions_exclude = ('delete_selected', ) class BrandModelDistributorPriceInfoAdmin(admin.ModelAdmin): list_display = ('brand_id', 'brand_name', 'model_id', 'model_name', 'distributor_id', 'distributor_name', 'factory_yuan', 'integral', 'status', 'created_at', 'updated_at') list_filter = ('brand_name', 'model_name', 'distributor_name', 'status') readonly_fields = ('brand_name', 'model_name', 'distributor_name', 'factory_fee', ) search_fields = ('brand_id', 'brand_name', 'model_id', 'model_name', 'distributor_id', 'distributor_name') def save_model(self, request, obj, form, change): obj.brand_id = strip(obj.brand_id) try: obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name except BrandInfo.DoesNotExist: obj.brand_name = '' obj.model_id = strip(obj.model_id) try: obj.model_name = ModelInfo.objects.get(model_id=obj.model_id).model_name except BrandInfo.DoesNotExist: obj.model_name = '' obj.distributor_id = strip(obj.distributor_id) try: obj.distributor_name = DistributorInfo.objects.get(distributor_id=obj.distributor_id).distributor_name except BrandInfo.DoesNotExist: obj.distributor_name = '' obj.save() class LatestAppInfoAdmin(admin.ModelAdmin): list_display = ('latest_adr_version_code', 'latest_adr_version_name', 'latest_adr_app', 'latest_adr_url', 'status', 'created_at', 'updated_at') list_filter = ('status', ) readonly_fields = ('status', ) def save_model(self, request, obj, form, change): if not obj.pk and LatestAppInfo.objects.filter(status=True).exists(): return obj.latest_adr_version_name = strip(obj.latest_adr_version_name) obj.latest_adr_app = strip(obj.latest_adr_app) obj.latest_adr_url = strip(obj.latest_adr_url) obj.save() class LatestAppScreenInfoAdmin(admin.ModelAdmin): list_display = ('latest_adr_version_code', 'latest_adr_version_name', 'latest_adr_app', 'latest_adr_url', 'status', 'created_at', 'updated_at') list_filter = ('status', ) readonly_fields = ('status', ) def save_model(self, request, obj, form, change): if not obj.pk and LatestAppInfo.objects.filter(status=True).exists(): return obj.latest_adr_version_name = strip(obj.latest_adr_version_name) obj.latest_adr_app = strip(obj.latest_adr_app) obj.latest_adr_url = strip(obj.latest_adr_url) obj.save() class ConsumeInfoSubmitLogInfoAdmin(AdvancedExportExcelModelAdmin, ReadOnlyModelAdmin, admin.ModelAdmin): list_display = ('user_id', 'phone', 'model_name', 'serialNo', 'dupload', 'submit_during_activity', 'integral', 'has_used', 'created_at') list_filter = ('brand_id', 'submit_during_activity', 'activity_id', 'dupload', 'test_user', 'verifyResult', 'has_used', 'status', 'code_version', 'created_at') excel_fields = ('created_at', 'phone', 'model_uni_name', 'model_name', 'serialNo') search_fields = ('user_id', 'phone', 'serialNo', 'model_name') class ActivityInfoAdmin(admin.ModelAdmin): list_display = ('activity_id', 'activity_name', 'model_uni_names', 'start_at', 'end_at', 'coupon_expire_type', 'coupon_valid_period', 'coupon_expire_at', 'coupon_value', 'status', 'created_at', 'updated_at') list_filter = ('coupon_expire_type', 'status') admin.site.register(AdministratorInfo, AdministratorInfoAdmin) admin.site.register(OperatorInfo, OperatorInfoAdmin) admin.site.register(BrandInfo, BrandInfoAdmin) admin.site.register(ModelInfo, ModelInfoAdmin) admin.site.register(CameraModelInfo, CameraModelInfoAdmin) admin.site.register(ModelCameraBodyInfo, ModelCameraBodyInfoAdmin) # admin.site.register(ModelImageInfo, ModelImageInfoAdmin) admin.site.register(DistributorInfo, DistributorInfoAdmin) admin.site.register(SaleclerkInfo, SaleclerkInfoAdmin) # admin.site.register(BrandModelDistributorPriceInfo, BrandModelDistributorPriceInfoAdmin) admin.site.register(LatestAppInfo, LatestAppInfoAdmin) admin.site.register(LatestAppScreenInfo, LatestAppScreenInfoAdmin) admin.site.register(ConsumeInfoSubmitLogInfo, ConsumeInfoSubmitLogInfoAdmin) admin.site.register(ActivityInfo, ActivityInfoAdmin) admin.site.register(MaintenancemanInfo, MaintenancemanInfoAdmin)
kodo - Gogs: Go Git Service

暂无描述

tests.py 126B

    # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase # Create your tests here.