# JIMengMiaoMai **Repository Path**: zhao_dong_liang/jimeng-miao-mai ## Basic Information - **Project Name**: JIMengMiaoMai - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2021-01-20 - **Last Updated**: 2026-01-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 网络请求 网络库 [Retrofit2][http://square.github.io/retrofit/] ##### POST 接口示例 ```kotlin @FormUrlEncoded @POST("beautyData/useadd") fun tongjiUseBeautify(@Field("pid") id: Long, @Field("pos") pos: String, @Field("action") action: String ): Call> ``` > `@FormUrlEncoded`将会自动将请求参数的类型调整为`application/x-www-form-urlencoded` > > 使用`@Field`时记得添加`@FormUrlEncoded` > 没有参数的时候 不需要 `@FormUrlEncoded` ##### 使用示例 ```kotlin RetrofitUtil.defaultRetrofit.create(WallpaperService::class.java) .tongjiUseBeautify(id, pos, action) .enqueue(object : Callback> { override fun onFailure(call: Call>?, t:Throwable?) { LogUtils.d(call, t?.message) } override fun onResponse(call: Call>?, response:Response>?) { LogUtils.d(response) } }) ``` ## 数据库 [ObjectBox ][https://objectbox.io/] ```kotlin //保存数据 val id = boxStore.boxFor(PetEntity::class.java).put(9) //查询数据 val pet = boxStore.boxFor(PetEntity::class.java).get(9) //查询多条数据 val pets = boxStore.boxFor(PetEntity::class.java).query().build().find().take(9).sortedBy { it.pos } ``` ## H5 接口 ``` android.showShareDialog() 显示分享对话框 android.quitGame() 关闭当前页面 android.postEvent() 发送事件到友盟 android.payPack(套餐 id,金额,套餐名称) 购买套装 android.openPet(宠物实体 string) 打开宠物 android.refresh() 刷新页面 ``` ## H5 获取用户参数 ``` USERID 用户id IMEI Imei USERNAME 用户名称 运行时会把上面的参数替换为当前用户的值 如: http://192.168.1.6:5000/pay?userId=USERID&imei=IMEI&username=USERNAME 替换后: http://192.168.1.6:5000/pay?userId=305357518&imei=2f7c0fa6f19e4972a6c109f553ef6323&username=如鱼饮水冷暖自知 ```