作者 杨谦

1.专项练习业务逻辑bug修复

2.接口回调bean定义
正在显示 21 个修改的文件 包含 1039 行增加87 行删除
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
import com.br_technology.securitytrain_master.ui.view.bank.bean.TestSubject
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import com.wjx.android.wanandroidmvvm.network.response.CommonDetail
import com.wjx.android.wanandroidmvvm.network.response.CommonList
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Field
... ... @@ -23,21 +26,21 @@ interface AllItemApi : ApiService {
*/
@FormUrlEncoded
@POST("/api/item/item_about")
fun itemAbout(): Observable<BaseResponse<String>>
fun itemAbout(): Observable<BaseResponse<AnswerAbout>>
/**
* 挑战答题规则
*/
@FormUrlEncoded
@POST("/api/item/challenge_rule")
fun itemRule(): Observable<BaseResponse<String>>
fun itemRule(): Observable<BaseResponse<ChallengeRule>>
/**
* 工种列表
*/
@FormUrlEncoded
@POST("/api/item/pos")
fun itemPos(): Observable<BaseResponse<String>>
fun itemPos(): Observable<BaseResponse<WorkerClassify>>
/**
* 专项练习列表
... ... @@ -64,7 +67,7 @@ interface AllItemApi : ApiService {
@POST("/api/item/paper_list_detail")
fun specialPracticeDetail(
@Field("paper_id") paper_id: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<PaperListDetail>>
/**
* 专项练习题目列表
... ... @@ -89,7 +92,7 @@ interface AllItemApi : ApiService {
// @Field("page") page: Int, // 页数
// @Field("pageNum") pageNum: Int, // 每页条数
@FieldMap fieldMap: HashMap<String, String>
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<PaperDaily>>>
/**
* 开始答题
... ... @@ -104,7 +107,7 @@ interface AllItemApi : ApiService {
// @Field("paper_id") paper_id: Int,
@Field("type") type: Int,
@FieldMap fieldMap: HashMap<String, String>
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<SubjectData>>>
/**
* 题目列表
... ... @@ -114,7 +117,7 @@ interface AllItemApi : ApiService {
@POST("/api/item/item_list")
fun itemList(
@Field("user_item_id") user_item_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<SubjectData>>
/**
* 获取挑战答题弹板信息
... ... @@ -124,7 +127,7 @@ interface AllItemApi : ApiService {
@POST("/api/item/get_challenge_info")
fun challengeInfo(
@Field("user_item_id") user_item_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<ChallengeInfo>>
/**
* 提交答题(某一题)
... ... @@ -150,7 +153,19 @@ interface AllItemApi : ApiService {
fun subSingle(
@Field("item_id") item_id: Int,
@Field("answer") answer: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<SubSingle>>
/**
* 提交答题
* @param item_id 题目ID
* @param answer 答题结果[{'id':1,'answer':'A'}]
*/
@FormUrlEncoded
@POST("/api/item/item_sub")
fun subAnswer(
@Field("item_id") item_id: Int,
@Field("answer") answer: String
): Observable<BaseResponse<SubResult>>
/**
* 交卷
... ... @@ -160,7 +175,7 @@ interface AllItemApi : ApiService {
@POST("/api/item/item_sub_paper")
fun subPaper(
@Field("user_item_id") user_item_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<SubResult>>
/**
* 错题列表
... ... @@ -174,7 +189,7 @@ interface AllItemApi : ApiService {
@Field("type") type: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<ErrorListItem>>>
/**
* 错题列表
... ... @@ -184,7 +199,7 @@ interface AllItemApi : ApiService {
@POST("/api/item/user_error_detail")
fun errorDetail(
@Field("id") id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<ErrorDetail>>
/**
* 提交错题
... ... @@ -224,7 +239,7 @@ interface AllItemApi : ApiService {
@Field("type") type: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<AnswerRecord>>>
/**
* 答题记录详情
... ... @@ -238,6 +253,6 @@ interface AllItemApi : ApiService {
@Field("id") id: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<AnswerDetail>>>
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.bean.UploadFileData
import com.br_technology.securitytrain_master.ui.bean.RegisterCompany
import com.br_technology.securitytrain_master.ui.bean.SearchLog
import com.br_technology.securitytrain_master.ui.bean.UserRule
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import com.wjx.android.wanandroidmvvm.network.response.CommonList
import io.reactivex.rxjava3.core.Observable
import okhttp3.MultipartBody
import retrofit2.http.*
import java.io.File
/**
* Author by YSir
... ... @@ -41,28 +42,28 @@ interface CommonApi : ApiService {
@Field("password") password: String,
@Field("business_license") business_license: String,
@Field("code") code: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<RegisterCompany>>
/**
* 用户协议
*/
@FormUrlEncoded
@POST("/api/common/user_rule")
fun userAgreement(): Observable<BaseResponse<String>>
fun userAgreement(): Observable<BaseResponse<UserRule>>
/**
* 历史搜索记录
*/
@FormUrlEncoded
@POST("/api/common/search_log")
fun searchLog(): Observable<BaseResponse<String>>
fun searchLog(): Observable<BaseResponse<CommonList<SearchLog>>>
/**
* 清除搜索记录
*/
@FormUrlEncoded
@POST("/api/common/search_log_clear")
fun searchLogClear(): Observable<BaseResponse<String>>
fun searchLogClear(): Observable<BaseResponse<CommonList<SearchLog>>>
/**
* 加载初始化
... ...
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.bean.CommonBean
import com.br_technology.securitytrain_master.ui.view.home.bean.DataBaseClassifyBean
import com.br_technology.securitytrain_master.ui.view.home.bean.NoticeBean
import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendBean
import com.br_technology.securitytrain_master.ui.bean.MaterialClassify
import com.br_technology.securitytrain_master.ui.bean.MaterialDetail
import com.br_technology.securitytrain_master.ui.bean.MaterialListItem
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import com.wjx.android.wanandroidmvvm.network.response.CommonDetail
import com.wjx.android.wanandroidmvvm.network.response.CommonList
import com.wjx.android.wanandroidmvvm.network.response.CommonPage
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
... ... @@ -26,7 +28,7 @@ interface DocApi : ApiService {
@POST("/api/material/material_sort_list")
fun getDocClassify(
@Field("type") type: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<MaterialClassify>>>
/**
* 资料库列表
... ... @@ -44,7 +46,7 @@ interface DocApi : ApiService {
@Field("keyword") keyword: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonPage<MaterialListItem>>>
/**
* 资料库详情
... ... @@ -54,5 +56,5 @@ interface DocApi : ApiService {
@POST("/api/material/material_detail")
fun getDocDetail(
@Field("id") id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<MaterialDetail>>>
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.view.home.bean.BannerBean
import com.br_technology.securitytrain_master.ui.view.home.bean.NoticeBean
import com.br_technology.securitytrain_master.ui.view.home.bean.RecommendBean
import com.br_technology.securitytrain_master.ui.bean.HomeBanner
import com.br_technology.securitytrain_master.ui.bean.HomeMaterialRec
import com.br_technology.securitytrain_master.ui.bean.HomeNotice
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST
... ... @@ -22,19 +21,19 @@ interface HomeApi : ApiService {
*/
@FormUrlEncoded
@POST("/api/index/banner")
fun getHomeBanner(): Observable<BaseResponse<BannerBean>>
fun getHomeBanner(): Observable<BaseResponse<HomeBanner>>
/**
* 最新公告
*/
@FormUrlEncoded
@POST("/api/index/notice")
fun getLatestNotice(): Observable<BaseResponse<NoticeBean>>
fun getLatestNotice(): Observable<BaseResponse<HomeNotice>>
/**
* 推荐资料
*/
@FormUrlEncoded
@POST("/api/index/material_rec")
fun getRecommendData(): Observable<BaseResponse<RecommendBean>>
fun getRecommendData(): Observable<BaseResponse<HomeMaterialRec>>
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.bean.*
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import com.wjx.android.wanandroidmvvm.network.response.CommonDetail
import com.wjx.android.wanandroidmvvm.network.response.CommonList
import com.wjx.android.wanandroidmvvm.network.response.CommonPage
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Field
import retrofit2.http.FieldMap
... ... @@ -30,7 +34,7 @@ interface LessonApi : ApiService {
@Field("page") page: String,
@Field("page_num") page_num: String,
@FieldMap fieldMap: HashMap<String, String>
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonPage<LessonWord>>>
/**
* 文本课程详情
... ... @@ -42,7 +46,7 @@ interface LessonApi : ApiService {
fun lessonTxtDetail(
@Field("id") id: String,
@Field("train_class_id") train_class_id: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<LessonWordDetail>>
/**
* 视频课程列表
... ... @@ -61,7 +65,7 @@ interface LessonApi : ApiService {
@Field("page") page: String,
@Field("page_num") page_num: String,
@FieldMap fieldMap: HashMap<String, String>
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<LessonVideo>>>
/**
* 视频课程详情
... ... @@ -73,7 +77,7 @@ interface LessonApi : ApiService {
fun lessonVideoDetail(
@Field("id") id: Int,
@Field("train_class_id") train_class_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<LessonVideoDetail>>>
/**
* 视频详情
... ... @@ -85,7 +89,7 @@ interface LessonApi : ApiService {
fun videoDetail(
@Field("id") id: Int,
@Field("train_class_id") train_class_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<LessonClassDetail>>>
/**
* 直播课程列表
... ... @@ -102,7 +106,7 @@ interface LessonApi : ApiService {
@Field("page") page: String,
@Field("page_num") page_num: String,
@FieldMap fieldMap: HashMap<String, String>
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<LessonLive>>>
/**
* 直播课程详情
... ... @@ -112,7 +116,7 @@ interface LessonApi : ApiService {
@POST("/api/lesson/lesson_live_detail")
fun lessonLiveDetail(
@Field("id") id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<LessonLive>>
/**
* 线下培训列表
... ... @@ -124,7 +128,7 @@ interface LessonApi : ApiService {
fun lessonOffList(
@Field("id") id: Int,
@Field("train_class_id") train_class_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<LessonOffline>>
/**
* 线下培训详情
... ...
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.view.mine.bean.MessageListBean
import com.br_technology.securitytrain_master.ui.bean.NoticeDetail
import com.br_technology.securitytrain_master.ui.bean.NoticeItem
import com.br_technology.securitytrain_master.ui.bean.NoticeUnread
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import com.wjx.android.wanandroidmvvm.network.response.CommonDetail
import com.wjx.android.wanandroidmvvm.network.response.CommonList
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
/**
... ... @@ -21,7 +24,7 @@ interface NotificationApi : ApiService {
*/
@FormUrlEncoded
@POST("/api/message/msg_unread_count")
fun notificationUnreadCount(): Observable<BaseResponse<String>>
fun notificationUnreadCount(): Observable<BaseResponse<NoticeUnread>>
/**
* 消息列表
... ... @@ -33,7 +36,7 @@ interface NotificationApi : ApiService {
fun notificationList(
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<MessageListBean>>
): Observable<BaseResponse<CommonList<NoticeItem>>>
/**
* 消息详情
... ... @@ -43,7 +46,7 @@ interface NotificationApi : ApiService {
@POST("/api/message/msg_detail")
fun notificationDetail(
@Field("id") id: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<NoticeDetail>>>
/**
* 批量/全部已读
... ...
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.view.home.bean.DataBaseClassifyBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.AcademicFeedbackBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.AcademicFeedbackDetailBean
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.bank.bean.SubjectData
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import com.wjx.android.wanandroidmvvm.network.response.CommonDetail
import com.wjx.android.wanandroidmvvm.network.response.CommonList
import com.wjx.android.wanandroidmvvm.network.response.CommonPage
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
... ... @@ -30,7 +32,7 @@ interface TrainApi : ApiService {
@Field("type") type: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<LessonList>>
/**
* 我的任务(练习)
... ... @@ -44,7 +46,7 @@ interface TrainApi : ApiService {
@Field("type") type: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<PractiseBean>>>
/**
* 我的任务(考试)
... ... @@ -58,7 +60,7 @@ interface TrainApi : ApiService {
@Field("type") type: Int,
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonList<ExamBean>>>
/**
* 考试详情
... ... @@ -68,7 +70,7 @@ interface TrainApi : ApiService {
@POST("/api/train/train_exam_detail")
fun getTrainExamDetail(
@Field("train_exam_id") train_exam_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<ExamDetail>>>
/**
* 开始答题(练习)
... ... @@ -78,7 +80,7 @@ interface TrainApi : ApiService {
@POST("/api/train/start_practise")
fun startPractise(
@Field("train_practise_id") train_practise_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<SubjectData>>
/**
* 开始答题(考试)
... ... @@ -88,7 +90,7 @@ interface TrainApi : ApiService {
@POST("/api/train/start_exam")
fun startExam(
@Field("train_exam_id") train_exam_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<SubjectData>>
/**
* 开始答题(模拟考试)
... ... @@ -98,7 +100,7 @@ interface TrainApi : ApiService {
@POST("/api/train/start_exam_exp")
fun startExamExp(
@Field("train_exam_id") train_exam_id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<SubjectData>>
/**
* 学情反馈列表
... ... @@ -110,7 +112,7 @@ interface TrainApi : ApiService {
fun trainChatList(
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<AcademicFeedbackBean>>
): Observable<BaseResponse<CommonPage<TrainChatItem>>>
/**
* 学情反馈详情
... ... @@ -120,7 +122,7 @@ interface TrainApi : ApiService {
@POST("/api/train/train_chat_detail")
fun trainChatDetail(
@Field("train_class_id") train_class_id: Int
): Observable<BaseResponse<AcademicFeedbackDetailBean>>
): Observable<BaseResponse<TrainDetail>>
/**
* 阅读学情反馈内容
... ... @@ -137,7 +139,7 @@ interface TrainApi : ApiService {
*/
@FormUrlEncoded
@POST("/api/train/train_report")
fun trainReport(): Observable<BaseResponse<String>>
fun trainReport(): Observable<BaseResponse<TrainReport>>
/**
* 课程备份列表
... ...
package com.br_technology.securitytrain_master.base.network.api
import com.br_technology.securitytrain_master.ui.bean.CommonBean
import com.br_technology.securitytrain_master.ui.bean.*
import com.br_technology.securitytrain_master.ui.view.login.bean.LoginBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.ContactServiceBean
import com.br_technology.securitytrain_master.ui.view.mine.bean.MineInfoBean
import com.wjx.android.wanandroidmvvm.network.ApiService
import com.wjx.android.wanandroidmvvm.network.response.BaseResponse
import com.wjx.android.wanandroidmvvm.network.response.CommonDetail
import com.wjx.android.wanandroidmvvm.network.response.CommonList
import com.wjx.android.wanandroidmvvm.network.response.CommonPage
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.*
... ... @@ -20,7 +21,7 @@ interface UserApi : ApiService {
* 会员中心
*/
@GET("/api/user/index")
fun getUserCenter(): Observable<BaseResponse<MineInfoBean>>
fun getUserCenter(): Observable<BaseResponse<UserInfo>>
/**
* 会员登录
... ... @@ -103,7 +104,7 @@ interface UserApi : ApiService {
@FormUrlEncoded
@POST("/api/user/contact")
fun userContact(
): Observable<BaseResponse<ContactServiceBean>>
): Observable<BaseResponse<ContactBean>>
/**
* 投诉与建议(h5+app)
... ... @@ -173,7 +174,7 @@ interface UserApi : ApiService {
fun favoriteMaterial(
@Field("page") page: Int,
@Field("page_num") page_num: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonPage<FavoriteData>>>
/**
* 我的收藏(文本课程)
... ... @@ -185,7 +186,7 @@ interface UserApi : ApiService {
fun favoriteLesson(
@Field("page") page: Int,
@Field("page_num") page_num: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonPage<FavoriteData>>>
/**
* 我的证件(文本课程)
... ... @@ -197,7 +198,7 @@ interface UserApi : ApiService {
fun certList(
@Field("page") page: Int,
@Field("page_num") page_num: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonPage<UserCert>>>
/**
* 证件详情
... ... @@ -207,14 +208,14 @@ interface UserApi : ApiService {
@POST("/api/user/my_cert_detail")
fun certDetail(
@Field("id") id: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonDetail<UserCertDetail>>>
/**
* 证件类型
*/
@FormUrlEncoded
@POST("/api/user/cert_list")
fun certClassify(): Observable<BaseResponse<String>>
fun certClassify(): Observable<BaseResponse<CommonList<CertType>>>
/**
* 证件失效时间
... ... @@ -226,7 +227,7 @@ interface UserApi : ApiService {
fun certEndTime(
@Field("cert_id") cert_id: Int,
@Field("start_time") start_time: String
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CertEndTime>>
/**
* 新增/重新上传证件
... ... @@ -257,7 +258,7 @@ interface UserApi : ApiService {
fun certLog(
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonPage<CertLog>>>
/**
* 删除证件
... ... @@ -279,5 +280,5 @@ interface UserApi : ApiService {
fun scoreLog(
@Field("page") page: Int,
@Field("page_num") page_num: Int
): Observable<BaseResponse<String>>
): Observable<BaseResponse<CommonPage<ScoreLog>>>
}
\ No newline at end of file
... ...
... ... @@ -7,4 +7,13 @@ package com.wjx.android.wanandroidmvvm.network.response
*/
open class BaseResponse<T>(var data: T, var code: Int = -1, var msg: String = "")
open class CommonList<T>(var list: List<T>)
\ No newline at end of file
open class CommonList<T>(var list: List<T>)
open class CommonDetail<T>(var detail: T)
open class CommonInfo<T>(var info: T)
open class CommonPage<T>(
var total: Int, // 总数
var per_page: String, // 每页数量
var current_page: Int, // 当前页数
var last_page: Int, // 总页数
var data: List<T>
)
... ...
package com.br_technology.securitytrain_master.ui.bean
/**
* Author by YSir
* Date on 2022/1/8.
* description
* PS: Not easy to write code, please indicate.
*/
/**
* 文件
*/
open class FileBean(
var name: String,
var url: String
)
open class Teacher(
var id: Int,
var name: String,//"测试讲师2", // 讲师名称
var avatar: String//"http://security.cn/assets/img/avatar.png" // 讲师头像
)
//注册企业
open class RegisterCompany(
var admin_url: String
)
//用户协议
open class UserRule(
var content: String
)
//历史搜索记录
open class SearchLog(
var id: Int,
var keyword: String
)
... ...
package com.br_technology.securitytrain_master.ui.bean
/**
* Author by YSir
* Date on 2022/1/8.
* description
* PS: Not easy to write code, please indicate.
*/
open class HomeBanner(
var id: Int,
var title: String, // 标题
var image: String,//"/uploads/20210914/d19a69b89974e3876ca6c61ff32e2f79.jpg", // 图片地址
var href: String//"https://www.baidu.com" // 跳转链接
)
open class HomeNotice(
var id: Int,
var type: String, // 发布来源:1=平台,2=企业,3=培训师
var title: String,//"测试通知", // 标题
var des: String,//"1234213", // 描述
var weigh: Int,
var num: String, // 编号
var create_time: Long,
var create_time_text: String//"2021/09/14" // 时间
)
open class HomeMaterialRec(
var id: Int,
var company_id: Int,
var material_sort_id: Int,
var name: String, // 名称
var des: String, // 描述
var image: String,//"/uploads/20210914/d19a69b89974e3876ca6c61ff32e2f79.jpg", // 图片
var video: String,
var file: String,
var content: String,
var score: Int, // 学习积分
var is_open: String, // 上架状态:0=否,1=是
var is_rec: String, // 推荐状态:0=否,1=是
var weigh: Int,
var create_time: Long,
var update_time: Long,
var delete_time: Long,
)
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.bean
import com.br_technology.securitytrain_master.ui.view.bank.bean.OptionArr
import com.br_technology.securitytrain_master.ui.view.bank.bean.PracticeBean
import com.wjx.android.wanandroidmvvm.network.response.CommonDetail
/**
* Author by YSir
* Date on 2022/1/9.
* description
* PS: Not easy to write code, please indicate.
*/
open class AnswerAbout(
var everyday: Int, // 今日是否已完成每日一练
var count: Int, // 参加答题任务
var challenge: String, // 挑战答题规则
)
open class ChallengeRule(
var challenge: String, // 挑战答题规则
)
open class WorkerClassify(
var id: Int,
var name: String, // 职位名称
var is_choose: Int, // 是否为当前登录用户工种0=否1=是
)
open class PaperListDetail(
var id: Int,
var company_id: Int,
var item_sort_id: Int,
var pos_id: String,
var name: String,
var score: Int,
var num: Int,
var spend_time: Int,//考试时长
var type: String,
var score_pass: Int, //通过分数
var quesion_num: Int, //考题数目
var create_time: Long,
var update_time: Long,
var delete_time: String,
var is_open_text: String,
var create_time_text: String,
var update_time_text: String,
var delete_time_text: String
)
open class PaperDaily(
var id: Int,
var company_id: Int,
var pos_id: Int,
var type: String,
var title: String,
var count: Int,
var date: String,
var create_time: String,
var update_time: String,
var delete_time: String,
var is_complete: Int
)
//获取挑战答题弹板信息
open class ChallengeInfo(
var total_count: Int, //总题目数
var correct_count: Int, //答对题目数
var score: Int //获取积分
)
//提交答题(某一题)
open class SubSingle(
var not_answer: Int, // 剩余未答题目数量
var correct_count: Int, // 答对题目数量
var is_correct: Int, // 本道题目答案是否正确1=正确2=错误
)
//提交答题
open class SubResult(
var score: Int, // 总分
var not_count: Int, // 未答题目数
var correct_count: Int, // 答对题目数量
)
//错题列表
open class ErrorListItem(
var id: Int,
var title: String, // 错题标题
var item_type: String, // 类型1=每日一练2=挑战答题3=专项练习4=模拟考试
var type: String, // 类型1=单选2=多选3=判断
var item_id: String, // 错题id
)
//错题详情
open class ErrorDetail(
var error_id: String,
var detail: CommonDetail<ErrorDetailData>
)
open class ErrorDetailData(
var id: Int,
var item_sort_id: Int,
var company_id: Int,
var pos_ids: String,
var title: String,
var type: String,
var difficulty: String,
var options: String,//"[{\"value\":\"Obama\",\"pic\":\"\",\"option_name\":\"A\",\"is_correct\":1},{\"value\":\"Thrump\",\"pic\":\"\",\"option_name\":\"B\",\"is_correct\":1},{\"value\":\"Joe Biden\",\"pic\":\"\",\"option_name\":\"C\",\"is_correct\":1},{\"value\":\"Liujinyong\",\"pic\":\"\",\"option_name\":\"D\",\"is_correct\":0}]",
var options_type: String,
var correct: String,
var score: Int,
var num: Int,
var remark: String,
var options_arr: List<OptionArr>
)
//答题记录
open class AnswerRecord(
var id: Int,
var type: String, // 题目类型:1=单选,2=多选,3=判断
var pos_id: Int,
var title: String, // 标题
var count: Int,
var correct: Int,
var is_complete: String, // 是否完成:0=否,1=是
var create_time_text: String, // 日期
var pos: PracticeBean.Pos
)
//答题记录详情
open class AnswerDetail(
var type: String,
var item_id: Int,
var answer: String,
var is_correct: String,
var item: AnswerDetailItem
)
open class AnswerDetailItem(
var title: String,
var options: String
)
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.bean
/**
* Author by YSir
* Date on 2022/1/8.
* description
* PS: Not easy to write code, please indicate.
*/
open class LessonWord(
var id: Int,
var name: String, // 课程名称
var des: String, // 描述
var image: String, // 图片
var intro: String // 简介信息
)
open class LessonWordDetail(
var id: Int,
var name: String, // 课程名称
var des: String, // 描述
var intro: Int, // 简介信息
var image: Int, // 图片
var content: Int, // 详情内容
var stay_time: Int, // 停留时间
var is_favorite: Int, // 收藏状态0=否1=是
var is_settle: Int, //是否结算
var new_fileBean: List<FileBean>
)
open class LessonVideo(
var id: Int,
var name: String, // 课程名称
var des: String, // 描述
var image: String, // 图片
var class_hours: Int, // 总课时
var pos_name: Int, // 工种
var teacher: Teacher
)
open class LessonClazz(
var id: Int,
var name: String,
var lessonclassdetail: List<LessonClassDetail>
)
open class LessonClassDetail(
var id: Int,
var name: String,
var video: String,//"/uploads/20211025/85a9a534b04ee1454eb97c6d6741dabf.mp4",
var video_url: String,//"http://security.cn/uploads/20211025/85a9a534b04ee1454eb97c6d6741dabf.mp4" // 视频播放地址
var video_length: String//"10.006", // 视频时长(s)
)
open class LessonLive(
var id: Int,
var name: String, // 课程名称
var image: String,//"http://security.cn/assets/img/qrcode.png", // 图片
var class_hours: Int, // 课时
var live_url: String,//"rtmp://153382.livepush.myqcloud.com/live/123456?txSecret=0c761f4fdf14b04ef745d2fb9182429d&txTime=6262D100", // rtmp直播地址
var webrtc_url: String,//"rtmp://153382.livepush.myqcloud.com/live/123456?txSecret=0c761f4fdf14b04ef745d2fb9182429d&txTime=6262D100", // web直播地址
var live_status: String, // 直播间状态:1=正在直播,2=回放,3=即将开播
var teacher: Teacher
)
open class LessonOffline(
var class_name: String,
var pos_names: String,
var end_day: String,
var image: String,//"http://security.brofirst.cn/uploads/20211215/ba800937c58d6cb860d2f0cfe5c299f7.jpeg",
var content: String,
var train_class: TrainClass,
var list: List<LessonOfflineItem>,
var is_settle: Int
)
open class TrainClass(
var train_id: Int,
var class_id: Int
)
open class LessonOfflineItem(
var id: Int,
var type: String,
var company_id: Int,
var name: String,
var image: String,//"http://security.brofirst.cn/uploads/20211215/ba800937c58d6cb860d2f0cfe5c299f7.jpeg",
var pos_ids: String,
var class_hours: Int,
var score: Int,
var is_open: String,
var is_pos: String,
var content: String,
var address: String,
var lat: String,
var lng: String,
var lessonofflineclass: List<LessonOfflineClazz>
)
open class LessonOfflineClazz(
var id: Int,
var lesson_id: Int,
var name: String,
var start_time: String,
var end_time: String,
var create_time: String,
var is_sign: Int
)
open class LessonOfflineDetail(
var id: Int,
var name: String, // 课程名称
var content: String,
var address: String, // 地址
var lat: String, // 纬度
var lng: String, // 经度
var is_pos: Int, // 是否开启定位打卡0=否1=是
var lessonofflineclass: LessonOfflineClazz
)
... ...
package com.br_technology.securitytrain_master.ui.bean
/**
* Author by YSir
* Date on 2022/1/8.
* description
* PS: Not easy to write code, please indicate.
*/
/**
* 资料库分类
*/
open class MaterialClassify(
var id: Int,
var company_id: Int,
var pid: Int,
var type: Int,
var name: String,
var weigh: Int,
var level: String,
var list: List<MaterialChild>
)
/**
* 资料库分类子分类
*/
open class MaterialChild(
var id: Int,
var company_id: Int,
var pid: Int,
var type: Int,
var name: String,
var weigh: Int,
var level: String
)
/**
* 资料库列表item
*/
open class MaterialListItem(
var id: Int,
var company_id: Int,
var material_sort_id: Int,
var name: String, // 名称
var des: String, // 描述
var image: String,///uploads/20210914/d19a69b89974e3876ca6c61ff32e2f79.jpg", // 图片
var video: String,
var file: Array<String>,
var content: String,
var score: Int, // 学习积分
var is_open: String, // 上架状态:0=否,1=是
var is_rec: String, // 推荐状态:0=否,1=是
var weigh: Int,
var new_fileBean: List<FileBean>
)
/**
* 资料库详情
*/
open class MaterialDetail(
var id: Int,
var company_id: Int,
var material_sort_id: Int,
var name: String, // 名称
var des: String, // 描述
var image: String,///uploads/20210914/d19a69b89974e3876ca6c61ff32e2f79.jpg", // 图片
var video: String,
var file: Array<String>,
var content: String, // 内容
var score: Int, // 学习积分
var is_open: String, // 上架状态:0=否,1=是
var is_rec: String, // 推荐状态:0=否,1=是
var weigh: Int,
var is_favorite: String, // 收藏状态:0=否,1=是
var view: Int, // 浏览量
var create_time_text: String//2021-10-10", // 上传时间
)
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.bean
/**
* Author by YSir
* Date on 2022/1/8.
* description
* PS: Not easy to write code, please indicate.
*/
open class UserInfo(
var id: Int,
var department_id: Int,
var pos_id: Int,
var username: String,
var nickname: String, // 昵称
var mobile: String, // 手机号
var avatar: String,//"http://security.cn/assets/img/avatar.png", // 头像
var score: Int, // 积分
var identity: String, // 身份证号
var token: String,
var user_id: Int,
var company_name: String, // 企业名称
var department_name: String, // 部门名称
var pos_name: String // 职位名称
)
open class ContactBean(
var mobile: String,//"18912345678", // 客服电话
var qrcode: String,// 客服微信二维码
var qrcode_base64: String // 二维码base64参数
)
open class FavoriteData(
var id: Int,
var object_id: String,
var user_id: Int,
var title: String,
var image: String,
var des: String,
var create_time: String
)
open class UserCert(
var id: Int,
var credentials_id: Int,
var user_id: Int,
var credentials_name: String, // 证件名称
var name: String, // 姓名
var identity: String, // 身份证号
var mobile: String, // 手机号
var valid: Int, // 有效期
var start_time: String, // 生效时间
var end_time: String, // 失效时间
var status: String, // 审核状态1=待审核2=审核通过3=审核驳回
var image_text: String,//"http://security.cn/assets/img/avatar.png", // 列表图片
var image_arr: Array<String>,
var cert: UserCertData
)
open class UserCertData(
var id: Int,
var name: String // 证书名称
)
open class CertType(
var id: Int,
var name: String, // 证件名称
var valid: Int, // 有效期
)
open class UserCertDetail(
var id: Int,
var credentials_id: Int,
var user_id: Int,
var credentials_name: String, // 证件名称
var name: String, // 姓名
var identity: String, // 身份证号
var mobile: String, // 手机号
var valid: Int, // 有效期
var start_time: String, // 生效时间
var end_time: String, // 失效时间
var status: String, // 审核状态1=待审核2=审核通过3=审核驳回
var cert: UserCertData,
var image_text: String,
var image_arr: Array<String>,
)
open class CertEndTime(
var end_time: String // 证件失效时间
)
open class CertLog(
var id: Int,
var start_time: String, // 生效时间
var before_start_time: Long,
var end_time: String, // 截止时间
var before_end_time: String, // 原本截止时间
)
open class ScoreLog(
var id: Int,
var score: Int, // 获得积分
var type: String, // 获取方式:类型:1=每日一练,2=挑战答题,3=专项练习,4=培训计划考试.5=培训计划练习,6=模拟考试[未完待续……],7=班级任务
var memo: String // 获取积分来源
)
... ...
package com.br_technology.securitytrain_master.ui.bean
/**
* Author by YSir
* Date on 2022/1/9.
* description
* PS: Not easy to write code, please indicate.
*/
//未读列表
open class NoticeUnread(
var count: Int
)
//消息列表
open class NoticeItem(
var id: Int,
var user_id: Int,
var msg_sort: String,
var type: String, // 类型:1=站内信,2=短信提醒
var content: String, // 消息内容
var is_read: String, // 阅读状态0=否1=是
var create_time: String, // 消息时间
)
//消息详情
open class NoticeDetail(
var id: Int,
var user_id: Int,
var msg_sort: String,
var type: String, // 类型:1=站内信,2=短信提醒
var content: String, // 消息内容
)
\ No newline at end of file
... ...
... ... @@ -25,5 +25,60 @@ open class OptionArr(
var option_name: String,
var value: String,
var pic: String,
var is_correct: Int
var is_correct: Int,
var pic_arr: Array<String>
)
/**
* 考试开始(练习)(考试)(模拟考试)
*/
open class SubjectData(
var user_item_id: Int, // 答题id
var type1: Int, // 单选题索引
var type2: Int, // 多选题索引
var type3: Int, // 判断题索引
var type1_num: Int, // 单选题总数
var type2_num: Int, // 多选题总数
var type3_num: Int, // 判断题总数
var over_second: Int, // 答题剩余时间
var list: List<UserSubject>,
var remark: String
)
//专项答题
open class SubjectSpecial(
user_item_id: Int, // 答题id
type1: Int, // 单选题索引
type2: Int, // 多选题索引
type3: Int, // 判断题索引
type1_num: Int, // 单选题总数
type2_num: Int, // 多选题总数
type3_num: Int, // 判断题总数
over_second: Int, // 答题剩余时间
list: List<UserSubject>,
remark: String,
var user_answer: String
) : SubjectData(
user_item_id,
type1,
type2,
type3,
type1_num,
type2_num,
type3_num,
over_second,
list,
remark
)
open class UserSubject(
var id: Int,
var title: String, // 职位名称
var type: String, // 类型1=单选2=多选3=判断
var difficulty: String, // 难度1=简单2=适中3=困难
var correct: String, // 正确答案
var remark: String, // 题目解析
var options_arr: List<OptionArr>
)
... ...
package com.br_technology.securitytrain_master.ui.bean
/**
* Author by YSir
* Date on 2022/1/8.
* description
* PS: Not easy to write code, please indicate.
*/
/**
* 我的任务(课程)
*/
open class LessonList(
var lesson_class_user: Int, // 已学课时
var lesson_class_count: Int, // 总课时
var list: List<LessonBean>
)
open class LessonBean(
var id: Int, // 课程id
var class_id: Int, // 视频/班级课程id,对应课程进度的class_id
var class_name: String, // 班级名称
var train_class_id: Int, // 班级课程id
var train_id: Int, // 培训计划id
var sort_id: String, // 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课
var name: String, // 课程名称
var des: String, // 描述
var image: String, // 图片
var status: String, // 状态0=未完成1=已完成
var class_hours: Int, // 课时
var user_hours: Int, // 已学习课时
var user_status: Int, // 是否进行过学习0=否1=是
var create_time_text: String // 时间
)
/**
* 我的任务(练习)
*/
open class PractiseBean(
var id: Int,
var name: String, // 练习名称
var is_complete: String, // 答题状态0=未完成1=已完成
var count: Int, // 题目数量
var correct_count: Int, // 答对题目数量
var create_time: String, // 创建时间
var sub_time: String, // 考试时间,需要is_complete为1
var exam_score: String, // 分数,需要is_complete为1
var is_pass: String // 是否通过,需要is_complete为1
)
/**
* 我的任务(考试)
*/
open class ExamBean(
var id: Int,
var name: String, // 考试名称
var pos_name: String, // 工种
var answer_count: Int, // 做过的人数
var is_complete: String, // 答题状态0=未完成1=已完成
var count: Int, // 题目数量
var correct_count: Int, // 答对题目数量
var create_time: String,// 创建时间
var sub_time: String, // 考试时间,需要is_complete为1 废弃
var exam_end_time: String, // 2021-12-09 13:45:00" //培训考试开始时间
var exam_score: Int, //分数
var exam_start_time: String, //2021-12-08 15:45:00"
var is_pass: String, // 是否通过,需要is_complete为1
var content: String //考试规则内容" // 考试规则
)
/**
* 考试详情
*/
open class ExamDetail(
var id: Int,
var name: String, //测试", // 考试名称
var times: String, // 考试时间(分钟)
var count: Int, // 考试题数
var pass: Int, // 合格标准分数
var content: String//2021-10-10" // 考试规则
)
/**
* 学情反馈item
*/
open class TrainChatItem(
var id: Int, // 班级id
var name: Int, // 班级名称
var image: String, //http://security.cn/assets/img/avatar.png", // 图片
var class_hours: Int, // 已学课时
var content: String, // 评析内容
var is_read: Int // 阅读状态0=未读1=已读
)
/**
* 学情反馈详情
*/
open class TrainDetail(
var id: Int, // 班级id
var name: Int, // 班级名称
var image: String, //http://security.cn/assets/img/avatar.png", // 图片
var class_hours: Int, // 已学课时
var content: String, // 评析内容
var is_read: Int // 阅读状态0=未读1=已读
)
/**
* 成长报告
*/
open class TrainReport(
var user: TrainReportUser,//上报人信息
var create_time_text: String,//var 2021-10-30 09:35", // 答题开始时间
var update_time_text: String,//var 2021-10-30 09:35" // 答题结束时间
var study_list: List<TrainReportStudy>,
var trainclass: TrainReportClass,
var exam_list: List<TrainReportExam>
)
open class TrainReportUser(
var id: Int,
var nickname: String, // 姓名
var mobile: String,//手机号", // 手机号
var gender: Int, // 性别1=男2=女
var avatar: String,//"https://security.brofirst.cn/uploads/20211030/e777a39142bf8ab8dd3e02b6eb9f9d9f.jpg", // 头像
var score: Int, // 积分
var identity: String, // 身份证号
var user_id: Int,
var createtime: Long, // 建档日期
var class_hours_count: Int, // 培训总学时
var item_count: Int, // 练习题量
var lessons: String, // 结业课程
var is_end: Int, // 是否结业0=否1=是
var class_name: String, // 班级名称
var train_sort_name: String, // 培训类型
var time: String, // 时间
var train_name: String, // 培训单位
var class_hours: Int, // 培训学时
)
open class TrainStudyTrain(
var id: Int,
var company_id: Int,
var pid: Int,
var train_sort_id: Int,
var name: String, // 培训名称
var depart_ids: String,
var pos_ids: String,
var plan_num: Int,
var plan_num_complete: Int,
var start_time: Long,
var end_time: Long,
var status: String
)
open class TrainStudySort(
var id: Int,
var company_id: Int,
var name: String, // 培训类型
var weigh: Int
)
open class TrainReportStudy(
var id: Int,
var distance: String,
var status: String, // 结业状态0=未结业1=已结业
var view_len: Int,
var class_name: String, // 课程名称
var update_time: String, // 时间
var class_hours: Int, // 学时
var train: TrainStudyTrain,
var trainsort: TrainStudySort
)
open class TrainReportClass(
var id: Int,
var name: String, // 培训班级名称
var sort_id: String,
var students: Int,
var lesson_ids: String,
var lessons: Int,
var des: String,
var status: String,
var lesson_times: Int,
)
open class TrainReportExam(
var id: Int,
var title: String,
var count: Int,
var correct: Int,
var is_complete: String, // 是否完成0=否1=是
var date: String,
var score: Int, // 积分
var is_pass: String, //是否通过0=否1=是
var trainexam: TrainReportExamMsg
)
open class TrainReportExamMsg(
var id: Int,
var name: String, // 考试名称
var times: Int,
var start_time: Int,
var end_time: Int,
var score: Int, // 总分
var pass: Int, // 通过分数
)
... ...
package com.br_technology.securitytrain_master.ui.bean;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
/**
* Author by YSir
* Date on 2022/1/8.
* description
* PS: Not easy to write code, please indicate.
*/
public class LessonVideoDetail implements Serializable {
private int id;
private String name; // 课程名称
private String des; // 描述
private String image; // 图片
private String content; // 详情内容
private String create_time_text;//"2021-10-10", // 日期
private int is_settle;//是否有结算 1:有 0:没有(没有结算的时候有弹板提示)
@SerializedName("class")
private List<LessonClazz> clazz;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getCreate_time_text() {
return create_time_text;
}
public void setCreate_time_text(String create_time_text) {
this.create_time_text = create_time_text;
}
public int getIs_settle() {
return is_settle;
}
public void setIs_settle(int is_settle) {
this.is_settle = is_settle;
}
public List<LessonClazz> getClazz() {
return clazz;
}
public void setClazz(List<LessonClazz> clazz) {
this.clazz = clazz;
}
}
... ...
... ... @@ -26,6 +26,6 @@ class AnswerSheetAdapter : BaseAdapter<String, AdapterAnswerSheetBinding>() {
@SuppressLint("SetTextI18n")
override fun onBind(holder: AdapterAnswerSheetBinding, position: Int, data: String) {
holder.txtIndex.text = "${position + 1}"
holder.iconError.visibility = if (data == "1") View.VISIBLE else View.GONE
holder.iconError.visibility = if (data == "1") View.GONE else View.VISIBLE
}
}
\ No newline at end of file
... ...
... ... @@ -121,13 +121,17 @@ class TopicAdapter : BaseAdapter<OptionArr, AdapterTopicBinding>() {
}
if (type == 2) {
var count = 0
var dataCount = 0
for (item in getData()) {
val position = getData().indexOf(item)
if (item.is_correct == 1 && mSelectIndex.contains(position)) {
count++
if (item.is_correct == 1) {
if (mSelectIndex.contains(position)) {
count++
}
dataCount++;
}
}
bool = count == mSelectIndex.size
bool = count == dataCount && mSelectIndex.size == count
}
return bool
}
... ... @@ -166,10 +170,10 @@ class PracticePaperAdapter : BaseAdapter<TestSubject, AdapterContentPracticeItem
@SuppressLint("SetTextI18n")
override fun onBind(
holder: AdapterContentPracticeItemBinding,
position: Int,
index: Int,
data: TestSubject
) {
holder.topic.text = "(${position + 1}/${itemCount})${data.title}"
holder.topic.text = "(${index + 1}/${itemCount})${data.title}"
val adapterChild = TopicAdapter()
adapterChild.addList(data.options_arr)
holder.topicRecycler.adapter = adapterChild
... ... @@ -187,9 +191,9 @@ class PracticePaperAdapter : BaseAdapter<TestSubject, AdapterContentPracticeItem
} else {
it.itemClick(position)
}
selectResultData.put(position, Pair(position, it.isTrue()))
if (!selectCount.contains(position)) {
selectCount.add(position)
selectResultData.put(index, Pair(index, it.isTrue()))
if (!selectCount.contains(index)) {
selectCount.add(index)
}
}
})
... ... @@ -211,10 +215,10 @@ class PracticePaperAdapter : BaseAdapter<TestSubject, AdapterContentPracticeItem
data.add(item)
}
val compare: Comparator<Pair<Int, Boolean>> = Comparator { o1, o2 ->
if (o2.first == o1.first) {
if (o1.first == o2.first) {
o1.first.compareTo(o2.first)
} else {
o2.first - o1.first
o1.first - o2.first
}
}
data.sortWith(compare)
... ...