├── Csharp
├── README.md
└── bitkyShop
│ ├── bitkyShop
│ ├── init
│ │ ├── .gitignore
│ │ └── CloudServiceHelper.cs
│ ├── resource
│ │ ├── kyOrderSound
│ │ └── defaultCoverPhoto
│ ├── utils
│ │ ├── AsynUploadPhotoThread.cs
│ │ ├── KyMatch.cs
│ │ └── HashHelper.cs
│ ├── App.config
│ ├── App.xaml.cs
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ └── Resources.Designer.cs
│ ├── bean
│ │ ├── beanShow
│ │ │ ├── OrderStatus.cs
│ │ │ ├── CommodityPcShow.cs
│ │ │ └── OrderShow.cs
│ │ ├── CommodityOrder.cs
│ │ ├── SubCategory.cs
│ │ ├── Order.cs
│ │ ├── CommodityUploadInfo.cs
│ │ └── Commodity.cs
│ ├── App.xaml
│ └── view
│ │ ├── ICloudServiceView.cs
│ │ ├── ConfirmUploadSubCategoryInfo.xaml
│ │ ├── ConfirmUploadCommodityInfo.xaml
│ │ ├── UpdateCommodityInfoWindow.xaml
│ │ ├── UpdateCommodityInfoWindow.xaml.cs
│ │ └── ConfirmUploadSubCategoryInfo.xaml.cs
│ └── bitkyShop.sln
├── Android
├── bitkyShop
│ ├── settings.gradle
│ ├── MaterialRefreshLayout
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── res
│ │ │ │ └── values
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ ├── attrs_circle_progressbar.xml
│ │ │ │ │ └── attrs.xml
│ │ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── cjj
│ │ │ │ ├── MaterialRefreshListener.java
│ │ │ │ ├── Util.java
│ │ │ │ └── MaterialHeadListener.java
│ │ └── build.gradle
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── values
│ │ │ │ │ │ ├── strings.xml
│ │ │ │ │ │ ├── dimens.xml
│ │ │ │ │ │ ├── style_item_counter.xml
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ ├── recycler_devider.xml
│ │ │ │ │ │ ├── selector_checkable.xml
│ │ │ │ │ │ ├── selector_number_add_sub.xml
│ │ │ │ │ │ ├── cardview_style_white.xml
│ │ │ │ │ │ ├── navigationbar_selector_home.xml
│ │ │ │ │ │ ├── navigationbar_selector_user.xml
│ │ │ │ │ │ ├── navigationbar_selector_cart.xml
│ │ │ │ │ │ ├── bg_btn_style_grey.xml
│ │ │ │ │ │ ├── edittext_style_white.xml
│ │ │ │ │ │ ├── button_style_white.xml
│ │ │ │ │ │ ├── navigationbar_selector_hot.xml
│ │ │ │ │ │ ├── bg_btn_style_blue.xml
│ │ │ │ │ │ ├── bg_btn_style_red.xml
│ │ │ │ │ │ └── navigationbar_selector_category.xml
│ │ │ │ │ ├── color
│ │ │ │ │ │ ├── selector_recycler.xml
│ │ │ │ │ │ ├── selector_list_item.xml
│ │ │ │ │ │ └── selecter_tab_text.xml
│ │ │ │ │ ├── values-w820dp
│ │ │ │ │ │ └── dimens.xml
│ │ │ │ │ ├── drawable-xxhdpi
│ │ │ │ │ │ └── selector_list_item.xml
│ │ │ │ │ └── layout
│ │ │ │ │ │ ├── tab_indicator.xml
│ │ │ │ │ │ ├── recycler_categryfragment_single_text.xml
│ │ │ │ │ │ ├── activity_main.xml
│ │ │ │ │ │ ├── activity_search.xml
│ │ │ │ │ │ ├── cartfragment_toolbar.xml
│ │ │ │ │ │ ├── widget_item_counter.xml
│ │ │ │ │ │ ├── fragment_login_phone.xml
│ │ │ │ │ │ ├── activity_login.xml
│ │ │ │ │ │ ├── recycler_subcategory_show.xml
│ │ │ │ │ │ ├── activity_sub_category.xml
│ │ │ │ │ │ ├── activity_order_manager.xml
│ │ │ │ │ │ ├── fragment_hot.xml
│ │ │ │ │ │ ├── fragment_categray.xml
│ │ │ │ │ │ ├── activity_request_smscode.xml
│ │ │ │ │ │ ├── recycler_orderactivity_show.xml
│ │ │ │ │ │ ├── recycler_homefragment_show.xml
│ │ │ │ │ │ ├── widget_ky_toolbar.xml
│ │ │ │ │ │ ├── activity_create_address.xml
│ │ │ │ │ │ ├── fragment_login_legacy.xml
│ │ │ │ │ │ ├── activity_address_option.xml
│ │ │ │ │ │ ├── fragment_cart.xml
│ │ │ │ │ │ ├── recycler_cartfragment_show.xml
│ │ │ │ │ │ ├── recycler_userfragment_receive_address.xml
│ │ │ │ │ │ ├── activity_signup.xml
│ │ │ │ │ │ └── fragment_user.xml
│ │ │ │ ├── java
│ │ │ │ │ └── cc
│ │ │ │ │ │ └── bitky
│ │ │ │ │ │ └── bitkyshop
│ │ │ │ │ │ ├── fragment
│ │ │ │ │ │ ├── userfragment
│ │ │ │ │ │ │ ├── loginfragment
│ │ │ │ │ │ │ │ ├── ILoginActivity.java
│ │ │ │ │ │ │ │ ├── FindTabAdapter.java
│ │ │ │ │ │ │ │ ├── LoginPhoneFragment.java
│ │ │ │ │ │ │ │ ├── LoginLegacyFragment.java
│ │ │ │ │ │ │ │ └── RequestSMSCodeActivity.java
│ │ │ │ │ │ │ ├── orderactivity
│ │ │ │ │ │ │ │ └── OrderActivityPresenter.java
│ │ │ │ │ │ │ ├── addressactivity
│ │ │ │ │ │ │ │ ├── CreateAddressActivity.java
│ │ │ │ │ │ │ │ └── AddressOptionPresenter.java
│ │ │ │ │ │ │ └── searchActivity
│ │ │ │ │ │ │ │ └── SearchActivity.java
│ │ │ │ │ │ ├── KyFragment.java
│ │ │ │ │ │ ├── hotfragment
│ │ │ │ │ │ │ ├── IHotFragment.java
│ │ │ │ │ │ │ └── HotFragmentPresenter.java
│ │ │ │ │ │ ├── categrayfragment
│ │ │ │ │ │ │ ├── ICategrayFragment.java
│ │ │ │ │ │ │ └── SubCategrayActivityPresenter.java
│ │ │ │ │ │ ├── homefragment
│ │ │ │ │ │ │ ├── IHomeFragment.java
│ │ │ │ │ │ │ └── HomeFragmentPresenter.java
│ │ │ │ │ │ └── cartfragment
│ │ │ │ │ │ │ └── CartToolbar.java
│ │ │ │ │ │ ├── bean
│ │ │ │ │ │ ├── CardViewHomeItem.java
│ │ │ │ │ │ ├── KyTab.java
│ │ │ │ │ │ ├── cart
│ │ │ │ │ │ │ ├── KyUser.java
│ │ │ │ │ │ │ ├── CommodityOrder.java
│ │ │ │ │ │ │ ├── ReceiveAddress.java
│ │ │ │ │ │ │ ├── CommodityLocal.java
│ │ │ │ │ │ │ └── Order.java
│ │ │ │ │ │ ├── SubCategory.java
│ │ │ │ │ │ └── Commodity.java
│ │ │ │ │ │ ├── utils
│ │ │ │ │ │ ├── tools
│ │ │ │ │ │ │ ├── KyBmobHelper.java
│ │ │ │ │ │ │ ├── KySet.java
│ │ │ │ │ │ │ └── KyPattern.java
│ │ │ │ │ │ ├── KyLog.java
│ │ │ │ │ │ ├── ToastUtil.java
│ │ │ │ │ │ ├── recyclerview
│ │ │ │ │ │ │ ├── KyBaseViewHolder.java
│ │ │ │ │ │ │ ├── KyBaseRecyclerAdapter.java
│ │ │ │ │ │ │ └── DividerItemDecoration.java
│ │ │ │ │ │ ├── BitkyRecyclerAdapter.java
│ │ │ │ │ │ └── widget
│ │ │ │ │ │ │ └── ItemCounter.java
│ │ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ │ └── globalDeploy
│ │ │ │ │ │ └── GreenDaoKyHelper.java
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── test
│ │ │ │ └── java
│ │ │ │ │ └── cc
│ │ │ │ │ └── bitky
│ │ │ │ │ └── bitkyshop
│ │ │ │ │ └── ExampleUnitTest.java
│ │ │ └── androidTest
│ │ │ │ └── java
│ │ │ │ └── cc
│ │ │ │ └── bitky
│ │ │ │ └── bitkyshop
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ └── proguard-rules.pro
│ ├── build.gradle
│ ├── gradle.properties
│ └── gradlew.bat
└── .gitignore
├── mdphoto
├── main
│ ├── app01.png
│ ├── app02.png
│ ├── app03.png
│ ├── app04.png
│ ├── app05.png
│ ├── app06.png
│ ├── app07.png
│ ├── desktop0.png
│ ├── desktop1.png
│ └── desktop2.png
└── license-MIT-blue.svg
└── LICENSE
/Csharp/README.md:
--------------------------------------------------------------------------------
1 | 注意:由于安全原因,本项目屏蔽掉了PresetInfo.cs文件,该文件可根据自己的需要自行创建。
--------------------------------------------------------------------------------
/Android/bitkyShop/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':MaterialRefreshLayout'
2 |
--------------------------------------------------------------------------------
/mdphoto/main/app01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/app01.png
--------------------------------------------------------------------------------
/mdphoto/main/app02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/app02.png
--------------------------------------------------------------------------------
/mdphoto/main/app03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/app03.png
--------------------------------------------------------------------------------
/mdphoto/main/app04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/app04.png
--------------------------------------------------------------------------------
/mdphoto/main/app05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/app05.png
--------------------------------------------------------------------------------
/mdphoto/main/app06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/app06.png
--------------------------------------------------------------------------------
/mdphoto/main/app07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/app07.png
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/mdphoto/main/desktop0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/desktop0.png
--------------------------------------------------------------------------------
/mdphoto/main/desktop1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/desktop1.png
--------------------------------------------------------------------------------
/mdphoto/main/desktop2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/mdphoto/main/desktop2.png
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/init/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 |
3 | PresetInfo.cs
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/resource/kyOrderSound:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/Csharp/bitkyShop/bitkyShop/resource/kyOrderSound
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/resource/defaultCoverPhoto:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitkylin/BitkyShop/HEAD/Csharp/bitkyShop/bitkyShop/resource/defaultCoverPhoto
--------------------------------------------------------------------------------
/Android/bitkyShop/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | .idea
4 | /build
5 | /gradle
6 | /local.properties
7 | .DS_Store
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/utils/AsynUploadPhotoThread.cs:
--------------------------------------------------------------------------------
1 | namespace bitkyShop.utils
2 | {
3 | public class AsynUploadPhotoThread
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /libs
3 |
4 | # 因为隐私问题,暂时屏蔽build.gradle和BitkyApplication.java,敬请谅解
5 | build.gradle
6 | BitkyApplication.java
7 |
8 | *.png
9 | *.jpg
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace bitkyShop
4 | {
5 | ///
6 | /// App.xaml 的交互逻辑
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 生活服务超市
3 |
4 |
5 | Hello blank fragment
6 |
7 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/recycler_devider.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/color/selector_recycler.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #ffF44336
4 | #ff4CAF50
5 | #ff03A9F4
6 | #ffFFEB3B
7 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/loginfragment/ILoginActivity.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.loginfragment;
2 |
3 | interface ILoginActivity {
4 | void userLoginByLegacy(String userName, String password);
5 |
6 | void userLoginByPhone(String phone);
7 |
8 | void signUp();
9 | }
10 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/selector_checkable.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/java/com/cjj/MaterialRefreshListener.java:
--------------------------------------------------------------------------------
1 | package com.cjj;
2 |
3 | public abstract class MaterialRefreshListener {
4 | public void onfinish(){};
5 | public abstract void onRefresh(MaterialRefreshLayout materialRefreshLayout);
6 | public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout){};
7 | }
8 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/selector_number_add_sub.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/CardViewHomeItem.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean;
2 |
3 | /**
4 | * Created by bitky on 2016/11/6.
5 | */
6 |
7 | public class CardViewHomeItem {
8 | public String url;
9 | public String msg;
10 |
11 | public CardViewHomeItem(String url, String msg) {
12 | this.url = url;
13 | this.msg = msg;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/beanShow/OrderStatus.cs:
--------------------------------------------------------------------------------
1 | namespace bitkyShop.bean.beanShow
2 | {
3 | public class OrderStatus
4 | {
5 | public const int NONE = 0;
6 | public const int 已下单 = 100;
7 | public const int 已送达 = 110;
8 |
9 | public const int 已确认收货 = 200;
10 |
11 | public const int 已取消 = 500;
12 | public const int 已删除 = 600;
13 | }
14 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BRLayoutLibrary
3 |
4 | - @color/material_red
5 | - @color/material_green
6 | - @color/material_blue
7 | - @color/material_yellow
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/tools/KyBmobHelper.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils.tools;
2 |
3 | import cc.bitky.bitkyshop.bean.cart.KyUser;
4 | import cn.bmob.v3.BmobUser;
5 |
6 | public class KyBmobHelper {
7 |
8 | /**
9 | * 获取本地保存的当前用户
10 | */
11 | public static KyUser getCurrentUser() {
12 | return BmobUser.getCurrentUser(KyUser.class);
13 | }
14 |
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/color/selector_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/KyFragment.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment;
2 |
3 | import android.support.v4.app.Fragment;
4 | import cc.bitky.bitkyshop.MainActivity;
5 |
6 | public class KyFragment extends Fragment {
7 | protected MainActivity mainActivity;
8 |
9 | public void setMainActivity(MainActivity mainActivity) {
10 | this.mainActivity = mainActivity;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable-xxhdpi/selector_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/color/selecter_tab_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/cardview_style_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 | -
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/navigationbar_selector_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/navigationbar_selector_user.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/navigationbar_selector_cart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/hotfragment/IHotFragment.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.hotfragment;
2 |
3 | import static cc.bitky.bitkyshop.fragment.hotfragment.HotFragmentPresenter.RefreshType;
4 |
5 | import java.util.List;
6 |
7 | import cc.bitky.bitkyshop.bean.Commodity;
8 |
9 | public interface IHotFragment {
10 |
11 | void refreshRecyclerViewData(List list, RefreshType type);
12 |
13 | void CanNotRefreshData(RefreshType type);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/categrayfragment/ICategrayFragment.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.categrayfragment;
2 |
3 | import cc.bitky.bitkyshop.bean.SubCategory;
4 | import cc.bitky.bitkyshop.fragment.categrayfragment.CategrayFragmentPresenter.RefreshType;
5 | import java.util.List;
6 |
7 | public interface ICategrayFragment {
8 |
9 | void refreshRecyclerViewData(List list, RefreshType loadMore);
10 |
11 | void CanNotRefreshData(RefreshType loadMore);
12 | }
13 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/test/java/cc/bitky/bitkyshop/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/KyLog.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils;
2 |
3 |
4 | import android.support.annotation.Nullable;
5 |
6 | import com.socks.library.KLog;
7 |
8 | public class KyLog {
9 |
10 | public static String TAG = "bitky";
11 |
12 | public static void init(boolean isShowLog, @Nullable String tag) {
13 | TAG = tag;
14 | KLog.init(isShowLog, tag);
15 | }
16 |
17 | public static String getTAG(String msg) {
18 | return TAG + "_" + msg;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/homefragment/IHomeFragment.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.homefragment;
2 |
3 | import cc.bitky.bitkyshop.bean.Commodity;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by bitky on 2016/11/18.
8 | */
9 |
10 | public interface IHomeFragment {
11 |
12 | /**
13 | * 初始化获取数据
14 | *
15 | * @param list 获取的数据
16 | */
17 | void initRecyclerViewData(List list);
18 |
19 | void refleshRecyclerViewData(List list, HomeFragmentPresenter.RefreshType type);
20 |
21 | void CanNotRefreshData(HomeFragmentPresenter.RefreshType type);
22 | }
23 |
--------------------------------------------------------------------------------
/Android/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea/workspace.xml
38 |
39 | # Keystore files
40 | *.jks
41 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/values/style_item_counter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/bg_btn_style_grey.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 | -
7 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/tab_indicator.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
13 |
14 |
20 |
21 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/edittext_style_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 | -
7 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\developer\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/button_style_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 | -
7 |
8 |
9 |
10 |
12 |
13 |
14 |
15 | -
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/mdphoto/license-MIT-blue.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Android/bitkyShop/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | google()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.0.1'
10 | classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | google()
19 | jcenter()
20 | maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" }
21 | maven { url "https://jitpack.io" }
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/recycler_categryfragment_single_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
23 |
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/java/com/cjj/Util.java:
--------------------------------------------------------------------------------
1 | package com.cjj;
2 |
3 | import android.content.Context;
4 |
5 | public class Util {
6 |
7 | public static int dip2px(Context context, float dpValue) {
8 | final float scale = context.getResources().getDisplayMetrics().density;
9 | return (int) (dpValue * scale + 0.5f);
10 | }
11 |
12 | public static int px2dip(Context context, float pxValue) {
13 | final float scale = context.getResources().getDisplayMetrics().density;
14 | return (int) (pxValue / scale + 0.5f);
15 | }
16 |
17 | public static float limitValue(float a, float b) {
18 | float valve = 0;
19 | final float min = Math.min(a, b);
20 | final float max = Math.max(a, b);
21 | valve = valve > min ? valve : min;
22 | valve = valve < max ? valve : max;
23 | return valve;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/androidTest/java/cc/bitky/bitkyshop/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("cc.bitky.bitkyshop", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/KyTab.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean;
2 |
3 | public class KyTab {
4 |
5 | private String title;
6 | private int icon;
7 | private Class fragment;
8 |
9 | public KyTab(Class fragment, String title, int icon) {
10 | this.title = title;
11 | this.icon = icon;
12 | this.fragment = fragment;
13 | }
14 |
15 | public String getTitle() {
16 | return title;
17 | }
18 |
19 | public void setTitle(String title) {
20 | this.title = title;
21 | }
22 |
23 | public int getIcon() {
24 | return icon;
25 | }
26 |
27 | public void setIcon(int icon) {
28 | this.icon = icon;
29 | }
30 |
31 | public Class getFragment() {
32 | return fragment;
33 | }
34 |
35 | public void setFragment(Class fragment) {
36 | this.fragment = fragment;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/utils/KyMatch.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 |
3 | namespace bitkyShop.utils
4 | {
5 | public class KyMatch
6 | {
7 | ///
8 | /// 判断是自然数
9 | ///
10 | /// 待匹配的文本
11 | /// 匹配结果
12 | public static bool IsInt(string value) //判断是自然数
13 | {
14 | value = value.Trim();
15 | return Regex.IsMatch(value, @"^[1-9]\d*|0$");
16 | }
17 |
18 | ///
19 | /// 判断是正浮点数
20 | ///
21 | /// 待匹配的文本
22 | /// 匹配结果
23 | public static bool IsFloat(string value) //判断是正浮点数或自然数
24 | {
25 | value = value.Trim();
26 | return Regex.IsMatch(value, @"^[1-9]d*.d*|0.d*[1-9]d*|[1-9]\d*|0$");
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 | resourcePrefix "MaterialRefreshLayoutky" //这个随便填
6 | defaultConfig {
7 | minSdkVersion 19
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 |
20 | lintOptions {
21 | checkReleaseBuilds false
22 | // Or, if you prefer, you can continue to check for errors in release builds,
23 | // but continue the build even when errors are found:
24 | abortOnError false
25 | }
26 | }
27 |
28 | dependencies {
29 | compile fileTree(dir: 'libs', include: ['*.jar'])
30 | compile 'com.android.support:appcompat-v7:26.1.0'
31 | compile 'com.android.support:support-v4:26.1.0'
32 | }
33 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
24 |
25 |
26 | >
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
21 |
22 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/cart/KyUser.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean.cart;
2 |
3 | import cn.bmob.v3.BmobUser;
4 |
5 | public class KyUser extends BmobUser {
6 | private String pwdResumeQuestion;
7 | private String pwdResumeAnswer;
8 | private Boolean haveDetailInfo;
9 |
10 | public Boolean getHaveDetailInfo() {
11 | return haveDetailInfo;
12 | }
13 |
14 | public void setHaveDetailInfo(Boolean haveDetailInfo) {
15 | this.haveDetailInfo = haveDetailInfo;
16 | }
17 |
18 | public String getPwdResumeQuestion() {
19 | return pwdResumeQuestion;
20 | }
21 |
22 | public void setPwdResumeQuestion(String pwdResumeQuestion) {
23 | this.pwdResumeQuestion = pwdResumeQuestion;
24 | }
25 |
26 | public String getPwdResumeAnswer() {
27 | return pwdResumeAnswer;
28 | }
29 |
30 | public void setPwdResumeAnswer(String pwdResumeAnswer) {
31 | this.pwdResumeAnswer = pwdResumeAnswer;
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/cart/CommodityOrder.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean.cart;
2 |
3 | import java.io.Serializable;
4 |
5 | public class CommodityOrder implements Serializable {
6 |
7 | private String objectId;
8 | private Double price;
9 | private Integer count;
10 |
11 | public CommodityOrder(String objectId, Double price, Integer count) {
12 | this.objectId = objectId;
13 | this.price = price;
14 | this.count = count;
15 | }
16 |
17 | public String getObjectId() {
18 | return objectId;
19 | }
20 |
21 | public void setObjectId(String objectId) {
22 | this.objectId = objectId;
23 | }
24 |
25 | public Double getPrice() {
26 | return price;
27 | }
28 |
29 | public void setPrice(Double price) {
30 | this.price = price;
31 | }
32 |
33 | public Integer getCount() {
34 | return count;
35 | }
36 |
37 | public void setCount(Integer count) {
38 | this.count = count;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/CommodityOrder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 | using cn.bmob.io;
6 |
7 | namespace bitkyShop.bean
8 | {
9 | public class CommodityOrder : BmobTable
10 | {
11 | public String objectId;
12 | public BmobDouble price;
13 | public BmobInt count;
14 |
15 |
16 |
17 | //读字段信息
18 | public override void readFields(BmobInput input)
19 | {
20 | base.readFields(input);
21 | objectId = input.getString("objectId");
22 | price = input.getDouble("price");
23 | count = input.getInt("count");
24 | }
25 |
26 | //写字段信息
27 | public override void write(BmobOutput output, bool all)
28 | {
29 | base.write(output, all);
30 | output.Put("objectId", objectId);
31 | output.Put("price", price);
32 | output.Put("count", count);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/SubCategory.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean;
2 |
3 | import cn.bmob.v3.BmobObject;
4 |
5 | public class SubCategory extends BmobObject {
6 |
7 | private String mainCategory;
8 | private String photoUrl;
9 | public String photoName;
10 | private String name;
11 |
12 | public String getMainCategory() {
13 | return mainCategory;
14 | }
15 |
16 | public void setMainCategory(String mainCategory) {
17 | this.mainCategory = mainCategory;
18 | }
19 |
20 | public String getPhotoUrl() {
21 | return photoUrl;
22 | }
23 |
24 | public void setPhotoUrl(String photoUrl) {
25 | this.photoUrl = photoUrl;
26 | }
27 |
28 | public String getName() {
29 | return name;
30 | }
31 |
32 | public void setName(String name) {
33 | this.name = name;
34 | }
35 |
36 | public String getPhotoName() {
37 | return photoName;
38 | }
39 |
40 | public void setPhotoName(String photoName) {
41 | this.photoName = photoName;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/navigationbar_selector_hot.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bitkyShop", "bitkyShop\bitkyShop.csproj", "{BD0859AA-E531-4B52-B81A-2B4D1C22B8DF}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {BD0859AA-E531-4B52-B81A-2B4D1C22B8DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {BD0859AA-E531-4B52-B81A-2B4D1C22B8DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {BD0859AA-E531-4B52-B81A-2B4D1C22B8DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {BD0859AA-E531-4B52-B81A-2B4D1C22B8DF}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/cartfragment_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
18 |
29 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/tools/KySet.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils.tools;
2 |
3 | public class KySet {
4 | //请求
5 | public static final int USER_REQUEST_SIGN_UP = 11;
6 | public static final int USER_REQUEST_LOG_IN = 12;
7 | public static final int CART_REQUEST_SUBMIT_ORDER = 13;
8 | public static final int USER_REQUEST_CREATE_ADDRESS = 14;
9 | public static final int CART_REQUEST_SELECT_RECEIVE_ADDRESS = 15;
10 | public static final int USER_REQUEST_HISTORY_ORDER = 16;
11 | public static final int USER_REQUEST_PHONE_SIGNUP_OR_LOGIN = 18;
12 |
13 | //返回结果
14 | public static final int USER_RESULT_SIGN_UP = 21;
15 | public static final int USER_RESULT_LOG_IN = 22;
16 | public static final int CART_RESULT_SUBMIT_ORDER = 23;
17 | public static final int USER_RESULT_CREATE_ADDRESS = 24;
18 | public static final int CART_RESULT_SELECT_RECEIVE_ADDRESS = 25;
19 | public static final int USER_RESULT_REFRESH_ORDER = 27;
20 | public static final int USER_RESULT_PHONE_SIGNUP_OR_LOGIN = 28;
21 |
22 | public static final int RESULT_ERROR = -21;
23 | }
24 |
--------------------------------------------------------------------------------
/Android/bitkyShop/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Sun Oct 22 02:33:45 CST 2017
16 | systemProp.http.proxyHost=127.0.0.1
17 | org.gradle.jvmargs=-Xmx2048m -XX\:MaxPermSize\=512m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8
18 | org.gradle.daemon=true
19 | org.gradle.configureondemand=true
20 | org.gradle.parallel=true
21 | systemProp.http.proxyPort=1080
22 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace bitkyShop.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/bg_btn_style_blue.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 |
22 | -
23 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/bg_btn_style_red.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 |
22 | -
23 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/drawable/navigationbar_selector_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 123lml123
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/SubCategory.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using cn.bmob.io;
3 |
4 | namespace bitkyShop.bean
5 | {
6 | public class SubCategory : BmobTable
7 | {
8 | public string mainCategory { set; get; }
9 | public string name { set; get; }
10 | public string photoUrl { set; get; }
11 | public string photoName { set; get; }
12 |
13 | //读字段信息
14 | public override void readFields(BmobInput input)
15 | {
16 | base.readFields(input);
17 | mainCategory = input.getString("mainCategory");
18 | photoUrl = input.getString("photoUrl");
19 | photoName = input.getString("photoName");
20 | name = input.getString("name");
21 | }
22 |
23 | //写字段信息
24 | public override void write(BmobOutput output, bool all)
25 | {
26 | base.write(output, all);
27 | output.Put("mainCategory", mainCategory);
28 | output.Put("photoUrl", photoUrl);
29 | output.Put("photoName", photoName);
30 | output.Put("name", name);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/java/com/cjj/MaterialHeadListener.java:
--------------------------------------------------------------------------------
1 | package com.cjj;
2 | /*
3 | * Copyright (C) 2015 Pedro Paulo de Amorim
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | public interface MaterialHeadListener {
18 | void onComlete(MaterialRefreshLayout materialRefreshLayout);
19 | void onBegin(MaterialRefreshLayout materialRefreshLayout);
20 | void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction);
21 | void onRelease(MaterialRefreshLayout materialRefreshLayout, float fraction);
22 | void onRefreshing(MaterialRefreshLayout materialRefreshLayout);
23 | }
24 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
16 |
17 |
21 |
22 |
25 |
26 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/loginfragment/FindTabAdapter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.loginfragment;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentPagerAdapter;
6 | import java.util.List;
7 |
8 | public class FindTabAdapter extends FragmentPagerAdapter {
9 |
10 | private List list_fragment;//fragment列表
11 | private List list_Title; //tab名的列表
12 |
13 | FindTabAdapter(FragmentManager fm, List list_fragment, List list_Title) {
14 | super(fm);
15 | this.list_fragment = list_fragment;
16 | this.list_Title = list_Title;
17 | }
18 |
19 | @Override
20 | public Fragment getItem(int position) {
21 | return list_fragment.get(position);
22 | }
23 |
24 | @Override
25 | public int getCount() {
26 | return list_Title.size();
27 | }
28 |
29 | //此方法用来显示tab上的名字
30 | @Override
31 | public CharSequence getPageTitle(int position) {
32 | return list_Title.get(position % list_Title.size());
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/view/ICloudServiceView.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using bitkyShop.bean;
3 | using bitkyShop.bean.beanShow;
4 | using Qiniu.Http;
5 |
6 | namespace bitkyShop.view
7 | {
8 | public interface ICloudServiceView
9 | {
10 | ///
11 | /// 七牛上传完毕事件处理
12 | ///
13 | /// 已上传的文件名
14 | /// 返回信息
15 | /// 返回Json
16 | void OnQiniuUploadCompleted(string key, ResponseInfo respInfo, string respJson);
17 |
18 | void ConfirmUpload();
19 |
20 | ///
21 | /// Bmob上传完毕回调
22 | ///
23 | /// 错误代码,0:成功,1:失败
24 | /// 返回信息
25 | void OnBmobUploadCompleted(int code, string msg);
26 |
27 | void orderShow(List orders);
28 | void addOrderCommodity(CommodityPcShow commodityPcShow);
29 | void commodityShow(List commodities);
30 | void updateCommodity(Commodity commodity);
31 | void subCategoryShow(List subCategories);
32 | }
33 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/res/values/attrs_circle_progressbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/tools/KyPattern.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils.tools;
2 |
3 | import java.util.regex.Matcher;
4 | import java.util.regex.Pattern;
5 |
6 | /**
7 | * Created by bitky on 2016/12/7.
8 | */
9 |
10 | public class KyPattern {
11 | /**
12 | * 验证手机号码
13 | *
14 | * @param phoneNumber 手机号码
15 | * @return boolean
16 | */
17 | public static boolean checkPhoneNumber(String phoneNumber) {
18 | Pattern pattern = Pattern.compile("^1[0-9]{10}$");
19 | Matcher matcher = pattern.matcher(phoneNumber);
20 | return matcher.matches();
21 | }
22 |
23 | /**
24 | * 验证数字字母和中文字符
25 | *
26 | * @param phoneNumber 用户名
27 | * @return boolean
28 | */
29 | public static boolean checkUserName(String phoneNumber) {
30 | Pattern pattern = Pattern.compile("([a-zA-Z0-9\\u4e00-\\u9fa5]{2,24})");
31 | Matcher matcher = pattern.matcher(phoneNumber);
32 | return matcher.matches();
33 | }
34 |
35 | /**
36 | * 验证数字字母
37 | *
38 | * @param phoneNumber 密码
39 | * @return boolean
40 | */
41 | public static boolean checkNumStr(String phoneNumber) {
42 | Pattern pattern = Pattern.compile("([a-zA-Z0-9]{2,24})");
43 | Matcher matcher = pattern.matcher(phoneNumber);
44 | return matcher.matches();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/widget_item_counter.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
18 |
19 |
28 |
36 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/fragment_login_phone.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
25 |
35 |
36 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/orderactivity/OrderActivityPresenter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.orderactivity;
2 |
3 | import cc.bitky.bitkyshop.bean.cart.Order;
4 | import cn.bmob.v3.exception.BmobException;
5 | import cn.bmob.v3.listener.UpdateListener;
6 |
7 | public class OrderActivityPresenter {
8 | private final OrderActivity activity;
9 |
10 | public OrderActivityPresenter(OrderActivity activity) {
11 | this.activity = activity;
12 | }
13 |
14 | /**
15 | * 在服务器中更新订单状态
16 | *
17 | * @param orderOrigin 当前本地订单条目
18 | * @param updateStatus 欲更新到的状态
19 | */
20 | public void updateOrderStatus(final Order orderOrigin, final int updateStatus) {
21 | Order order = new Order();
22 | order.setObjectId(orderOrigin.getObjectId());
23 | order.setStatus(updateStatus);
24 | order.update(new UpdateListener() {
25 | @Override public void done(BmobException e) {
26 | if (e != null) {
27 | activity.showMessage(e.getMessage());
28 | } else {
29 | switch (updateStatus) {
30 | case Order.COMPLETED:
31 | activity.showMessage("确认收货成功");
32 | break;
33 | case Order.CANCELLED:
34 | activity.showMessage("该订单已被取消");
35 | break;
36 | }
37 | orderOrigin.setStatus(updateStatus);
38 | activity.changeOrderStatus(orderOrigin);
39 | }
40 | }
41 | });
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
21 |
30 |
35 |
40 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/recycler_subcategory_show.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
21 |
22 |
28 |
29 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_sub_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
20 |
31 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_order_manager.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
20 |
31 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/fragment_hot.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
21 |
22 |
32 |
33 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/ToastUtil.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils;
2 |
3 | import android.content.Context;
4 | import com.github.johnpersano.supertoasts.library.Style;
5 | import com.github.johnpersano.supertoasts.library.SuperActivityToast;
6 | import com.github.johnpersano.supertoasts.library.SuperToast;
7 | import com.socks.library.KLog;
8 |
9 | public class ToastUtil {
10 | private Context mContext;
11 | private SuperToast mSuperToast;
12 | int i = 1;
13 | String msg = "";
14 |
15 | public ToastUtil(Context context) {
16 | this(context, null);
17 | }
18 |
19 | public ToastUtil(Context context, Type type) {
20 | mContext = context;
21 | if (type == null) assignFlyBlue();
22 | if (type == Type.FlyBlue) assignFlyBlue();
23 | }
24 |
25 | public ToastUtil assignFlyBlue() {
26 | if (mSuperToast == null) {
27 | mSuperToast = SuperActivityToast.create(mContext, new Style(), Style.TYPE_STANDARD)
28 | .setText("New BitkyToast");
29 | mSuperToast.setDuration(Style.DURATION_VERY_SHORT)
30 | .setFrame(Style.FRAME_STANDARD)
31 | .setAnimations(Style.ANIMATIONS_FLY)
32 | .setColor(0xcc1e90ff);
33 | }
34 | return this;
35 | }
36 |
37 | public void show(String msg) {
38 | if (mSuperToast == null) {
39 | KLog.w("对象未实例化");
40 | } else {
41 | if (!this.msg.equals(msg)) {
42 | this.msg = msg;
43 | mSuperToast.setText(msg).show();
44 | } else if (!mSuperToast.isShowing()) {
45 | mSuperToast.setText(msg).show();
46 | }
47 | }
48 | }
49 |
50 | enum Type {
51 | FlyBlue
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/Order.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 | using cn.bmob.io;
6 |
7 | namespace bitkyShop.bean
8 | {
9 | public class Order : BmobTable
10 | {
11 | public string userObjectId { set; get; }
12 | public string username { set; get; }
13 | public BmobInt status { set; get; }
14 |
15 | public List commodityList { set; get; }
16 |
17 | public string name { set; get; }
18 | public string phone { set; get; }
19 | public string address { set; get; }
20 |
21 | //读字段信息
22 | public override void readFields(BmobInput input)
23 | {
24 | base.readFields(input);
25 | userObjectId = input.getString("userObjectId");
26 | username = input.getString("username");
27 | status = input.getInt("status");
28 | commodityList = input.getList("commodityList");
29 |
30 | name = input.getString("name");
31 | phone = input.getString("phone");
32 | address = input.getString("address");
33 | }
34 |
35 | //写字段信息
36 | public override void write(BmobOutput output, bool all)
37 | {
38 | base.write(output, all);
39 | output.Put("userObjectId", userObjectId);
40 | output.Put("username", username);
41 | output.Put("status", status);
42 | output.Put("commodityList", commodityList);
43 | output.Put("name", name);
44 | output.Put("phone", phone);
45 | output.Put("address", address);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/recyclerview/KyBaseViewHolder.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils.recyclerview;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.util.SparseArray;
5 | import android.view.View;
6 | import android.widget.Button;
7 | import android.widget.CheckBox;
8 | import android.widget.TextView;
9 | import com.facebook.drawee.view.SimpleDraweeView;
10 |
11 | public class KyBaseViewHolder extends RecyclerView.ViewHolder {
12 | SparseArray sparseArray;
13 | View itemView;
14 |
15 | public KyBaseViewHolder(View itemView, final HolderOnClickListener listener) {
16 | super(itemView);
17 | sparseArray = new SparseArray<>();
18 | this.itemView = itemView;
19 | if (listener != null) {
20 | itemView.setOnClickListener(new View.OnClickListener() {
21 | @Override public void onClick(View v) {
22 | listener.Onclick(v, getAdapterPosition());
23 | }
24 | });
25 | }
26 | }
27 |
28 | public T getView(int id) {
29 | View view = sparseArray.get(id);
30 | if (view == null) {
31 | view = itemView.findViewById(id);
32 | sparseArray.append(id, view);
33 | }
34 | return (T) view;
35 | }
36 |
37 | public SimpleDraweeView getSimpleDraweeView(int id) {
38 | return getView(id);
39 | }
40 |
41 | public TextView getTextView(int id) {
42 | return getView(id);
43 | }
44 |
45 | public Button getButton(int id) {
46 | return getView(id);
47 | }
48 |
49 | public CheckBox getCheckBox(int id) {
50 | return getView(id);
51 | }
52 |
53 | interface HolderOnClickListener {
54 | void Onclick(View v, int adapterPosition);
55 | }
56 | }
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/beanShow/CommodityPcShow.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using cn.bmob.io;
3 |
4 | namespace bitkyShop.bean.beanShow
5 | {
6 | public class CommodityPcShow
7 | {
8 | public string 分类 { set; get; }
9 | public string 子类 { set; get; }
10 | public string 名称 { set; get; }
11 | public BmobDouble 价格 { set; get; }
12 | public BmobInt 数量 { set; get; }
13 | public string objectId { set; get; }
14 | // public string 详细介绍 { set; get; }
15 | // public string 促销状态 { set; get; }
16 | // public string 轮播广告状态 { set; get; }
17 |
18 | public CommodityPcShow(string objectId, string category, string categorySub, string name, BmobDouble price,
19 | BmobInt count, string details, string promotion, string ad)
20 | {
21 | this.objectId = objectId;
22 | 分类 = category;
23 | 子类 = categorySub;
24 | 名称 = name;
25 | 价格 = price;
26 | 数量 = count;
27 | // 详细介绍 = details;
28 | // 促销状态 = promotion;
29 | // 轮播广告状态 = ad;
30 | }
31 |
32 | public CommodityPcShow(Commodity commodity)
33 | {
34 | objectId = commodity.objectId;
35 | 分类 = commodity.Category;
36 | 子类 = commodity.CategorySub;
37 | 名称 = commodity.Name;
38 | 价格 = commodity.Price;
39 | 数量 = commodity.Count;
40 | }
41 |
42 | public CommodityPcShow(Commodity commodity, CommodityOrder commodityOrder) : this(commodity)
43 | {
44 | 价格 = commodityOrder.price;
45 | 数量 = commodityOrder.count;
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("bitkyShop")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("bitkyShop")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | //若要开始生成可本地化的应用程序,请
23 | // 中的 .csproj 文件中
24 | //例如,如果您在源文件中使用的是美国英语,
25 | //使用的是美国英语,请将 设置为 en-US。 然后取消
26 | //对以下 NeutralResourceLanguage 特性的注释。 更新
27 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
28 |
29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
30 |
31 |
32 | [assembly: ThemeInfo(
33 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
34 | //(当资源未在页面
35 | //或应用程序资源字典中找到时使用)
36 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
37 | //(当资源未在页面
38 | //、应用程序或任何主题专用资源字典中找到时使用)
39 | )]
40 |
41 |
42 | // 程序集的版本信息由下列四个值组成:
43 | //
44 | // 主版本
45 | // 次版本
46 | // 生成号
47 | // 修订号
48 | //
49 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
50 | // 方法是按如下所示使用“*”: :
51 | // [assembly: AssemblyVersion("1.0.*")]
52 | [assembly: AssemblyVersion("1.0.0.0")]
53 | [assembly: AssemblyFileVersion("1.0.0.0")]
54 |
--------------------------------------------------------------------------------
/Android/bitkyShop/MaterialRefreshLayout/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/CommodityUploadInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Qiniu.Storage;
3 |
4 | namespace bitkyShop.bean
5 | {
6 | internal class CommodityUploadInfo
7 | {
8 | private static CommodityUploadInfo Info = null;
9 |
10 | private CommodityUploadInfo(string uploadToken, UploadOptions uploadOptions, UpCompletionHandler uploadCompleted)
11 | {
12 | UploadToken = uploadToken;
13 | UploadOptions = uploadOptions;
14 | UploadCompleted = uploadCompleted;
15 | }
16 |
17 | public static CommodityUploadInfo Builder(string uploadToken, UploadOptions uploadOptions,
18 | UpCompletionHandler uploadCompleted)
19 | {
20 | Info = Info == null ? new CommodityUploadInfo(uploadToken, uploadOptions, uploadCompleted) : Info;
21 | return Info;
22 | }
23 |
24 | public CommodityUploadInfo SetQiniuFilePath(string filePath)
25 | {
26 | if (Info == null) throw new NoThisInstanceException("没有实例化");
27 | Info.FilePath = filePath;
28 | return this;
29 | }
30 |
31 | public CommodityUploadInfo SetQiniuFileKey(string fileKey)
32 | {
33 | if (Info == null) throw new NoThisInstanceException("没有实例化");
34 | Info.FileKey = fileKey;
35 | return this;
36 | }
37 |
38 | public string FilePath { get; set; }
39 | public string FileKey { get; set; }
40 | public string UploadToken { get; set; }
41 | public UploadOptions UploadOptions { get; set; }
42 | public UpCompletionHandler UploadCompleted { get; set; }
43 | }
44 |
45 | internal class NoThisInstanceException : Exception
46 | {
47 | public NoThisInstanceException(string msg) : base(msg)
48 | {
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/view/ConfirmUploadSubCategoryInfo.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/beanShow/OrderShow.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Documents;
3 | using cn.bmob.io;
4 |
5 | namespace bitkyShop.bean.beanShow
6 | {
7 | public class OrderShow
8 | {
9 | public string 姓名 { get; set; }
10 | public string 电话 { get; set; }
11 | public string 地址 { get; set; }
12 | public string 订单状态 { get; set; }
13 | public int 商品种类数 { get; set; }
14 | public int 商品总数 { get; set; }
15 | public List commodityList { get; set; }
16 | public string objectId { get; set; }
17 |
18 |
19 | public OrderShow(Order order)
20 | {
21 | commodityList = order.commodityList;
22 | 姓名 = order.name;
23 | 电话 = order.phone;
24 | 地址 = order.address;
25 | objectId = order.objectId;
26 | int status = order.status.Get();
27 |
28 | switch (status)
29 | {
30 | case OrderStatus.已下单:
31 | 订单状态 = "已下单";
32 | break;
33 | case OrderStatus.已送达:
34 | 订单状态 = "已送达";
35 | break;
36 | case OrderStatus.已确认收货:
37 | 订单状态 = "已确认收货";
38 | break;
39 | case OrderStatus.已取消:
40 | 订单状态 = "已取消";
41 | break;
42 | case OrderStatus.已删除:
43 | 订单状态 = "已删除";
44 | break;
45 | }
46 |
47 | 商品种类数 = 0;
48 | 商品总数 = 0;
49 |
50 | var commodityOrders = order.commodityList;
51 |
52 |
53 | foreach (CommodityOrder commodityOrder in commodityOrders)
54 | {
55 | 商品种类数++;
56 | 商品总数 = 商品总数 + commodityOrder.count.Get();
57 | }
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/fragment_categray.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
17 |
18 |
24 |
25 |
26 |
39 |
40 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/loginfragment/LoginPhoneFragment.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.loginfragment;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.view.inputmethod.InputMethodManager;
10 | import android.widget.Button;
11 | import android.widget.EditText;
12 | import cc.bitky.bitkyshop.R;
13 |
14 | public class LoginPhoneFragment extends Fragment implements View.OnClickListener {
15 | private ILoginActivity activity;
16 | private EditText editTextPhone;
17 | private Context context;
18 |
19 | @Override public void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | context = getContext();
22 | }
23 |
24 | public void setActivity(ILoginActivity activity) {
25 | this.activity = activity;
26 | }
27 |
28 | @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
29 | Bundle savedInstanceState) {
30 | View view = inflater.inflate(R.layout.fragment_login_phone, container, false);
31 | Button btnLogin = (Button) view.findViewById(R.id.loginPhoneFragment_btn_login);
32 | editTextPhone = (EditText) view.findViewById(R.id.loginPhoneFragment_TextView_phone);
33 | btnLogin.setOnClickListener(this);
34 | return view;
35 | }
36 |
37 | @Override public void onAttach(Context context) {
38 | super.onAttach(context);
39 | }
40 |
41 | @Override public void onDetach() {
42 | super.onDetach();
43 | }
44 |
45 | @Override public void onClick(View v) {
46 | switch (v.getId()) {
47 | case R.id.loginPhoneFragment_btn_login:
48 | InputMethodManager imm =
49 | (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
50 | imm.hideSoftInputFromWindow(editTextPhone.getWindowToken(), 0);
51 | String phone = editTextPhone.getText().toString().trim();
52 | activity.userLoginByPhone(phone);
53 | break;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/cart/ReceiveAddress.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean.cart;
2 |
3 | import cn.bmob.v3.BmobObject;
4 | import java.io.Serializable;
5 |
6 | public class ReceiveAddress extends BmobObject implements Serializable {
7 |
8 | private String userObjectId;
9 | private String username;
10 | private String name;
11 | private String phone;
12 | private String address;
13 | private Boolean isDefault;
14 |
15 | public ReceiveAddress() {
16 | }
17 |
18 | public ReceiveAddress(String userObjectId, String username, String name, String phone,
19 | String address) {
20 | this.userObjectId = userObjectId;
21 | this.username = username;
22 | this.name = name;
23 | this.phone = phone;
24 | this.address = address;
25 | isDefault = false;
26 | }
27 |
28 | public ReceiveAddress(String userObjectId, String username, String name, String phone,
29 | String address, Boolean isDefault) {
30 | this.userObjectId = userObjectId;
31 | this.username = username;
32 | this.name = name;
33 | this.phone = phone;
34 | this.address = address;
35 | this.isDefault = isDefault;
36 | }
37 |
38 | public String getUserObjectId() {
39 | return userObjectId;
40 | }
41 |
42 | public void setUserObjectId(String userObjectId) {
43 | this.userObjectId = userObjectId;
44 | }
45 |
46 | public String getUsername() {
47 | return username;
48 | }
49 |
50 | public void setUsername(String username) {
51 | this.username = username;
52 | }
53 |
54 | public String getName() {
55 | return name;
56 | }
57 |
58 | public void setName(String name) {
59 | this.name = name;
60 | }
61 |
62 | public String getPhone() {
63 | return phone;
64 | }
65 |
66 | public void setPhone(String phone) {
67 | this.phone = phone;
68 | }
69 |
70 | public String getAddress() {
71 | return address;
72 | }
73 |
74 | public void setAddress(String address) {
75 | this.address = address;
76 | }
77 |
78 | public Boolean getDefault() {
79 | return isDefault;
80 | }
81 |
82 | public void setDefault(Boolean aDefault) {
83 | isDefault = aDefault;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/cartfragment/CartToolbar.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.cartfragment;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.widget.Toolbar;
6 | import android.util.AttributeSet;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.widget.TextView;
10 | import cc.bitky.bitkyshop.R;
11 |
12 | public class CartToolbar extends Toolbar {
13 |
14 | private TextView textViewTitle;
15 | private TextView textViewEdit;
16 | OnTextViewEditClickListener textViewEditClickListener;
17 |
18 | public CartToolbar(Context context) {
19 | this(context, null);
20 | }
21 |
22 | public CartToolbar(Context context, @Nullable AttributeSet attrs) {
23 | this(context, attrs, 0);
24 | }
25 |
26 | public CartToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | LayoutInflater inflater = LayoutInflater.from(context);
29 | View view = inflater.inflate(R.layout.cartfragment_toolbar, this, true);
30 | textViewTitle = (TextView) view.findViewById(R.id.cartFragment_toolbar_title);
31 | textViewEdit = (TextView) view.findViewById(R.id.cartFragment_toolbar_edit);
32 | textViewEdit.setOnClickListener(new OnClickListener() {
33 | @Override public void onClick(View v) {
34 | if (textViewEdit.getText().toString().equals("编辑")) {
35 | textViewEdit.setText("完成");
36 | if (textViewEditClickListener != null) {
37 | textViewEditClickListener.OnClick(TextViewEditType.edit);
38 | }
39 | } else {
40 | textViewEdit.setText("编辑");
41 | if (textViewEditClickListener != null) {
42 | textViewEditClickListener.OnClick(TextViewEditType.completed);
43 | }
44 | }
45 | }
46 | });
47 | }
48 |
49 | void setTextViewEditClickListener(OnTextViewEditClickListener textViewEditClickListener) {
50 | this.textViewEditClickListener = textViewEditClickListener;
51 | }
52 |
53 | public void setTextViewTitle(String msg) {
54 | textViewTitle.setText(msg);
55 | }
56 |
57 | enum TextViewEditType {
58 | edit,
59 | completed
60 | }
61 |
62 | interface OnTextViewEditClickListener {
63 | void OnClick(TextViewEditType type);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_request_smscode.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
21 |
27 |
28 |
36 |
49 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/recycler_orderactivity_show.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
20 |
21 |
27 |
28 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
50 |
51 |
52 |
61 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/recycler_homefragment_show.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
21 |
22 |
28 |
29 |
38 |
39 |
44 |
48 |
57 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/Android/bitkyShop/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace bitkyShop.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("bitkyShop.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/widget_ky_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
32 |
48 |
60 |
61 |
71 |
72 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/recyclerview/KyBaseRecyclerAdapter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils.recyclerview;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | public abstract class KyBaseRecyclerAdapter extends RecyclerView.Adapter {
11 | protected KyRecyclerViewItemOnClickListener listener;
12 | protected List mDatas = new ArrayList<>();
13 | protected int resourceId;
14 |
15 | /**
16 | * 初始化 RecyclerView 适配器
17 | *
18 | * @param mDatas 绑定的数据
19 | * @param resourceId 绑定的ViewItem
20 | */
21 | public KyBaseRecyclerAdapter(List mDatas, int resourceId) {
22 | this.mDatas = mDatas;
23 | this.resourceId = resourceId;
24 | }
25 |
26 | /**
27 | * 设置RecyclerView中条目的点击监听器
28 | *
29 | * @param listener 设置点击监听器
30 | */
31 | public void setOnClickListener(KyRecyclerViewItemOnClickListener listener) {
32 | this.listener = listener;
33 | }
34 |
35 | @Override public KyBaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
36 | View view = LayoutInflater.from(parent.getContext()).inflate(resourceId, parent, false);
37 | return new KyBaseViewHolder(view, new KyBaseViewHolder.HolderOnClickListener() {
38 | @Override public void Onclick(View v, int adapterPosition) {
39 | if (listener != null) listener.Onclick(v, adapterPosition, mDatas.get(adapterPosition));
40 | }
41 | });
42 | }
43 |
44 | @Override public void onBindViewHolder(KyBaseViewHolder holder, int position) {
45 | T dataItem = mDatas.get(position);
46 | setDataToViewHolder(dataItem, holder);
47 | }
48 |
49 | /**
50 | * 在ViewHolder中绑定数据
51 | *
52 | * @param dataItem 数据bean
53 | * @param holder 绑定数据的ViewHolder
54 | */
55 | public abstract void setDataToViewHolder(T dataItem, KyBaseViewHolder holder);
56 |
57 | @Override public int getItemCount() {
58 | return mDatas.size();
59 | }
60 |
61 | public List getDataItems() {
62 | return mDatas;
63 | }
64 |
65 | public void reloadData(List list) {
66 | if (mDatas != null) {
67 | int count = mDatas.size();
68 | mDatas.clear();
69 | notifyItemRangeRemoved(0, count);
70 | mDatas.addAll(list);
71 | notifyItemRangeChanged(0, list.size());
72 | }
73 | }
74 |
75 | public void loadMoreData(List list) {
76 | int count = mDatas.size();
77 | mDatas.addAll(list);
78 | notifyItemRangeChanged(count, list.size());
79 | }
80 |
81 | public interface KyRecyclerViewItemOnClickListener {
82 | void Onclick(View v, int adapterPosition, T data);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_create_address.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
21 |
27 |
28 |
42 |
56 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/addressactivity/CreateAddressActivity.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.addressactivity;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.view.inputmethod.InputMethodManager;
9 | import android.widget.TextView;
10 | import cc.bitky.bitkyshop.R;
11 | import cc.bitky.bitkyshop.utils.KyToolBar;
12 | import cc.bitky.bitkyshop.utils.ToastUtil;
13 | import cc.bitky.bitkyshop.utils.tools.KyPattern;
14 | import cc.bitky.bitkyshop.utils.tools.KySet;
15 |
16 | public class CreateAddressActivity extends AppCompatActivity implements View.OnClickListener {
17 |
18 | private TextView textViewUserName;
19 | private TextView textViewPhone;
20 | private TextView textViewAddress;
21 | private ToastUtil toastUtil;
22 |
23 | @Override protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_create_address);
26 | toastUtil = new ToastUtil(this);
27 | KyToolBar kyToolBar = (KyToolBar) findViewById(R.id.createAddressActivity_kyToolbar);
28 | kyToolBar.setNavigationOnClickListener(this);
29 | kyToolBar.setRightTextViewOnClickListener(this);
30 |
31 | textViewUserName = (TextView) findViewById(R.id.createAddressActivity_userName);
32 | textViewPhone = (TextView) findViewById(R.id.createAddressActivity_phone);
33 | textViewAddress = (TextView) findViewById(R.id.createAddressActivity_address);
34 | }
35 |
36 | @Override public void onClick(View v) {
37 | switch (v.getId()) {
38 | case R.id.kytoolbar_navigation:
39 | finish();
40 | break;
41 | case R.id.kytoolbar_rightTextView:
42 | pushNewAddress();
43 | break;
44 | }
45 | }
46 |
47 | private void pushNewAddress() {
48 | InputMethodManager imm =
49 | (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
50 | imm.hideSoftInputFromWindow(textViewUserName.getWindowToken(), 0);
51 |
52 | String name = textViewUserName.getText().toString().trim();
53 | String phone = textViewPhone.getText().toString().trim();
54 | String address = textViewAddress.getText().toString().trim();
55 |
56 | if (name.length() == 0 || address.length() == 0) {
57 | toastUtil.show("请将上面的编辑框填写完整");
58 | return;
59 | }
60 | if (!KyPattern.checkPhoneNumber(phone)) {
61 | toastUtil.show("请输入正确的手机号码");
62 | return;
63 | }
64 | Intent intent = new Intent();
65 | intent.putExtra("name", name);
66 | intent.putExtra("phone", phone);
67 | intent.putExtra("address", address);
68 | setResult(KySet.USER_RESULT_CREATE_ADDRESS, intent);
69 | finish();
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/searchActivity/SearchActivity.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.searchActivity;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.view.inputmethod.InputMethodManager;
8 | import android.widget.EditText;
9 | import cc.bitky.bitkyshop.R;
10 | import cc.bitky.bitkyshop.bean.Commodity;
11 | import cc.bitky.bitkyshop.utils.KyToolBar;
12 | import cc.bitky.bitkyshop.utils.ToastUtil;
13 | import cn.bmob.v3.BmobQuery;
14 | import cn.bmob.v3.exception.BmobException;
15 | import cn.bmob.v3.listener.FindListener;
16 | import com.socks.library.KLog;
17 | import java.util.List;
18 |
19 | public class SearchActivity extends AppCompatActivity implements View.OnClickListener {
20 |
21 | private Context context;
22 | private EditText searchEdittext;
23 | private ToastUtil toastUtil;
24 |
25 | @Override protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_search);
28 | context = this;
29 | toastUtil = new ToastUtil(this);
30 | KyToolBar kyToolBar = (KyToolBar) findViewById(R.id.searchActivity_kyToolbar);
31 | searchEdittext = (EditText) findViewById(R.id.kytoolbar_editText);
32 | kyToolBar.setNavigationOnClickListener(new View.OnClickListener() {
33 | @Override public void onClick(View v) {
34 | finish();
35 | }
36 | });
37 | kyToolBar.setRightButtonOnClickListener(this);
38 | kyToolBar.setOnSearchListener(new KyToolBar.OnSearchListener() {
39 | @Override public void searchListener(String msg) {
40 | searchCommodity();
41 | }
42 | });
43 | }
44 |
45 | @Override public void onClick(View v) {
46 | switch (v.getId()) {
47 | case R.id.kytoolbar_rightButton:
48 | searchCommodity();
49 | break;
50 | }
51 | }
52 |
53 | private void searchCommodity() {
54 | ((InputMethodManager) context.getSystemService(
55 | Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(searchEdittext.getWindowToken(),
56 | InputMethodManager.HIDE_NOT_ALWAYS);
57 | String msg = searchEdittext.getText().toString().trim();
58 | if (msg.equals("")) {
59 | toastUtil.show("请输入要搜索的商品");
60 | return;
61 | }
62 | BmobQuery bmobQuery = new BmobQuery<>();
63 | bmobQuery.addWhereEqualTo("categorySub", msg);
64 | KLog.d(msg);
65 | bmobQuery.findObjects(new FindListener() {
66 | @Override public void done(List list, BmobException e) {
67 | if (e != null) {
68 | KLog.d(e.getMessage());
69 | }
70 | if (list != null) {
71 | KLog.d(list.size());
72 | }
73 | }
74 | });
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/fragment_login_legacy.xml:
--------------------------------------------------------------------------------
1 |
9 |
15 |
16 |
28 |
29 |
41 |
51 |
52 |
53 |
59 |
67 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/cart/CommodityLocal.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean.cart;
2 |
3 | import org.greenrobot.greendao.annotation.Entity;
4 | import org.greenrobot.greendao.annotation.Generated;
5 | import org.greenrobot.greendao.annotation.Id;
6 | import org.greenrobot.greendao.annotation.Unique;
7 |
8 | @Entity public class CommodityLocal implements Cloneable {
9 | private @Id Long id;
10 | private @Unique String objectId;
11 | private String category;
12 | private String name;
13 | private String details;
14 | private Integer cartCount;
15 | private Double price;
16 | private String CoverPhotoUrl;
17 | private Boolean CartIsChecked;
18 |
19 | @Generated(hash = 449135961)
20 | public CommodityLocal(Long id, String objectId, String category, String name, String details,
21 | Integer cartCount, Double price, String CoverPhotoUrl, Boolean CartIsChecked) {
22 | this.id = id;
23 | this.objectId = objectId;
24 | this.category = category;
25 | this.name = name;
26 | this.details = details;
27 | this.cartCount = cartCount;
28 | this.price = price;
29 | this.CoverPhotoUrl = CoverPhotoUrl;
30 | this.CartIsChecked = CartIsChecked;
31 | }
32 |
33 | @Generated(hash = 252057792) public CommodityLocal() {
34 | }
35 |
36 | public Long getId() {
37 | return this.id;
38 | }
39 |
40 | public void setId(Long id) {
41 | this.id = id;
42 | }
43 |
44 | public String getObjectId() {
45 | return this.objectId;
46 | }
47 |
48 | public void setObjectId(String objectId) {
49 | this.objectId = objectId;
50 | }
51 |
52 | public String getCategory() {
53 | return this.category;
54 | }
55 |
56 | public void setCategory(String category) {
57 | this.category = category;
58 | }
59 |
60 | public String getName() {
61 | return this.name;
62 | }
63 |
64 | public void setName(String name) {
65 | this.name = name;
66 | }
67 |
68 | public String getDetails() {
69 | return this.details;
70 | }
71 |
72 | public void setDetails(String details) {
73 | this.details = details;
74 | }
75 |
76 | public Integer getCartCount() {
77 | return this.cartCount;
78 | }
79 |
80 | public void setCartCount(Integer cartCount) {
81 | this.cartCount = cartCount;
82 | }
83 |
84 | public Double getPrice() {
85 | return this.price;
86 | }
87 |
88 | public void setPrice(Double price) {
89 | this.price = price;
90 | }
91 |
92 | public String getCoverPhotoUrl() {
93 | return this.CoverPhotoUrl;
94 | }
95 |
96 | public void setCoverPhotoUrl(String CoverPhotoUrl) {
97 | this.CoverPhotoUrl = CoverPhotoUrl;
98 | }
99 |
100 | public Boolean getCartIsChecked() {
101 | return this.CartIsChecked;
102 | }
103 |
104 | public void setCartIsChecked(Boolean CartIsChecked) {
105 | this.CartIsChecked = CartIsChecked;
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_address_option.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
81 |
82 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/MainActivity.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v4.app.FragmentTabHost;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.widget.ImageView;
10 | import android.widget.LinearLayout;
11 | import android.widget.TabHost;
12 | import android.widget.TextView;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | import cc.bitky.bitkyshop.bean.KyTab;
18 | import cc.bitky.bitkyshop.fragment.cartfragment.CartFragment;
19 | import cc.bitky.bitkyshop.fragment.categrayfragment.CategrayFragment;
20 | import cc.bitky.bitkyshop.fragment.homefragment.HomeFragment;
21 | import cc.bitky.bitkyshop.fragment.hotfragment.HotFragment;
22 | import cc.bitky.bitkyshop.fragment.userfragment.UserFragment;
23 |
24 | public class MainActivity extends AppCompatActivity {
25 |
26 | Context mContext;
27 | List kyTabs = new ArrayList<>(3);
28 | public FragmentTabHost fragmentTabHost;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_main);
34 | mContext = this;
35 | initTab();
36 | }
37 |
38 | private void initTab() {
39 | HomeFragment.setMainActivity(this);
40 | KyTab tab_home = new KyTab(HomeFragment.class, "主页", R.drawable.navigationbar_selector_home);
41 | KyTab tab_hot = new KyTab(HotFragment.class, "便民", R.drawable.navigationbar_selector_hot);
42 | KyTab tab_category = new KyTab(CategrayFragment.class, "超市", R.drawable.navigationbar_selector_category);
43 | KyTab tab_cart = new KyTab(CartFragment.class, "购物车", R.drawable.navigationbar_selector_cart);
44 | KyTab tab_user = new KyTab(UserFragment.class, "个人", R.drawable.navigationbar_selector_user);
45 | kyTabs.add(tab_home);
46 | kyTabs.add(tab_hot);
47 | kyTabs.add(tab_category);
48 | kyTabs.add(tab_cart);
49 | kyTabs.add(tab_user);
50 |
51 | fragmentTabHost = (FragmentTabHost) findViewById(R.id.fragmentTabHost);
52 | fragmentTabHost.setup(mContext, getSupportFragmentManager(), R.id.fragment);
53 |
54 | for (KyTab tab : kyTabs) {
55 | TabHost.TabSpec tabSpec =
56 | fragmentTabHost.newTabSpec(tab.getTitle()).setIndicator(buildIndicator(tab));
57 | fragmentTabHost.addTab(tabSpec, tab.getFragment(), null);
58 | }
59 |
60 | fragmentTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
61 | fragmentTabHost.setCurrentTab(0);
62 | }
63 |
64 | private View buildIndicator(KyTab tab) {
65 | View view = LayoutInflater.from(mContext).inflate(R.layout.tab_indicator, null);
66 | ImageView img = (ImageView) view.findViewById(R.id.icon_tab);
67 | TextView text = (TextView) view.findViewById(R.id.txt_indicator);
68 | img.setBackgroundResource(tab.getIcon());
69 | text.setText(tab.getTitle());
70 | return view;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/view/ConfirmUploadCommodityInfo.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/fragment_cart.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
15 |
21 |
22 |
32 |
33 |
39 |
40 |
50 |
51 |
59 |
60 |
73 |
74 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/view/UpdateCommodityInfoWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/loginfragment/LoginLegacyFragment.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.loginfragment;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.view.inputmethod.InputMethodManager;
11 | import android.widget.Button;
12 | import android.widget.TextView;
13 | import cc.bitky.bitkyshop.R;
14 | import cc.bitky.bitkyshop.utils.tools.KySet;
15 |
16 | public class LoginLegacyFragment extends Fragment implements View.OnClickListener {
17 | private ILoginActivity activity;
18 | Context context;
19 | private TextView textViewUserName;
20 | private TextView textViewPassword;
21 |
22 | public void setActivity(ILoginActivity activity) {
23 | this.activity = activity;
24 | }
25 |
26 | @Override public void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | context = getContext();
29 | }
30 |
31 | @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
32 | Bundle savedInstanceState) {
33 | View view = inflater.inflate(R.layout.fragment_login_legacy, container, false);
34 | TextView textViewSignup =
35 | (TextView) view.findViewById(R.id.loginLegacyFragment_TextView_signup);
36 | TextView textViewForgetPassword =
37 | (TextView) view.findViewById(R.id.loginLegacyFragment_TextView_forgetPassword);
38 | Button btnLogin = (Button) view.findViewById(R.id.loginLegacyFragment_btn_login);
39 | textViewSignup.setOnClickListener(this);
40 | textViewForgetPassword.setOnClickListener(this);
41 | btnLogin.setOnClickListener(this);
42 | textViewUserName = (TextView) view.findViewById(R.id.loginLegacyFragment_TextView_userName);
43 | textViewPassword = (TextView) view.findViewById(R.id.loginLegacyFragment_TextView_password);
44 |
45 | return view;
46 | }
47 |
48 | @Override public void onAttach(Context context) {
49 | super.onAttach(context);
50 | }
51 |
52 | @Override public void onDetach() {
53 | super.onDetach();
54 | }
55 |
56 | @Override public void onClick(View v) {
57 | switch (v.getId()) {
58 | case R.id.loginLegacyFragment_TextView_signup:
59 | activity.signUp();
60 | break;
61 | case R.id.loginLegacyFragment_TextView_forgetPassword:
62 | break;
63 | case R.id.loginLegacyFragment_btn_login:
64 | textViewUserName.clearFocus();
65 | textViewPassword.clearFocus();
66 | InputMethodManager imm =
67 | (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
68 | imm.hideSoftInputFromWindow(textViewUserName.getWindowToken(), 0);
69 | String userName = textViewUserName.getText().toString().trim();
70 | String password = textViewPassword.getText().toString().trim();
71 | if (activity != null) activity.userLoginByLegacy(userName, password);
72 | break;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/homefragment/HomeFragmentPresenter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.homefragment;
2 |
3 | import android.content.Context;
4 | import cc.bitky.bitkyshop.bean.Commodity;
5 | import cn.bmob.v3.BmobQuery;
6 | import cn.bmob.v3.exception.BmobException;
7 | import cn.bmob.v3.listener.FindListener;
8 | import com.socks.library.KLog;
9 | import java.util.List;
10 |
11 | class HomeFragmentPresenter {
12 | private IHomeFragment mView;
13 | private int currentPosition = 0;
14 | private int countLimit = 10;
15 | private Context mContext;
16 |
17 | HomeFragmentPresenter(Context context, IHomeFragment view) {
18 | mContext = context;
19 | mView = view;
20 | }
21 |
22 | void refreshRecyclerAdapterData(RefreshType type) {
23 | switch (type) {
24 | case Refresh:
25 | new Thread(new Runnable() {
26 | @Override public void run() {
27 | currentPosition = 0;
28 | BmobQuery bmobQuery = new BmobQuery<>();
29 | bmobQuery.addWhereEqualTo("Promotion", "true")
30 | .addWhereGreaterThan("Count", 0)
31 | .setLimit(countLimit)
32 | .setSkip(currentPosition)
33 | .order("createdAt");
34 | bmobQuery.findObjects(new FindListener() {
35 | @Override public void done(List list, BmobException e) {
36 | if (e != null) {
37 | KLog.d("异常内容:" + e.getMessage());
38 | } else if (list.size() > 0) {
39 | KLog.d("list.size()=" + list.size());
40 | mView.refleshRecyclerViewData(list, RefreshType.Refresh);
41 | } else if (list.size() == 0) {
42 | mView.CanNotRefreshData(RefreshType.Refresh);
43 | }
44 | }
45 | });
46 | }
47 | }).start();
48 |
49 | break;
50 | case LoadMore:
51 | new Thread(new Runnable() {
52 | @Override public void run() {
53 | currentPosition = currentPosition + 10;
54 | BmobQuery bmobQuery = new BmobQuery<>();
55 | bmobQuery.addWhereEqualTo("Promotion", "true")
56 | .addWhereGreaterThan("Count", 0)
57 | .setLimit(countLimit)
58 | .setSkip(currentPosition)
59 | .order("createdAt");
60 | bmobQuery.findObjects(new FindListener() {
61 | @Override public void done(List list, BmobException e) {
62 | if (e != null) {
63 | KLog.d("异常内容:" + e.getMessage());
64 | } else if (list.size() > 0) {
65 | mView.refleshRecyclerViewData(list, RefreshType.LoadMore);
66 | } else if (list.size() == 0) {
67 | mView.CanNotRefreshData(RefreshType.LoadMore);
68 | }
69 | }
70 | });
71 | }
72 | }).start();
73 | break;
74 | }
75 | }
76 |
77 | enum RefreshType {
78 | Refresh,
79 | LoadMore
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/BitkyRecyclerAdapter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils;
2 |
3 | import android.net.Uri;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 | import cc.bitky.bitkyshop.R;
10 | import cc.bitky.bitkyshop.bean.Commodity;
11 | import com.facebook.drawee.view.SimpleDraweeView;
12 | import java.util.List;
13 |
14 | public class BitkyRecyclerAdapter
15 | extends RecyclerView.Adapter {
16 | private BitkyOnClickListener listener;
17 | private List mDatas;
18 |
19 | public BitkyRecyclerAdapter(List mDatas) {
20 | this.mDatas = mDatas;
21 | }
22 |
23 | public void setOnClickListener(BitkyOnClickListener listener) {
24 | this.listener = listener;
25 | }
26 |
27 | @Override public BitkyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
28 | View view =
29 | LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_homefragment_show, parent, false);
30 | return new BitkyViewHolder(view);
31 | }
32 |
33 | @Override public void onBindViewHolder(BitkyViewHolder holder, int position) {
34 | Commodity item = mDatas.get(position);
35 | // KLog.d("位置: " + position + "; name: " + item.getName() + "; image: " + item.getCoverPhotoUrl());
36 | holder.textViewTitle.setText(item.getName());
37 | holder.draweeView.setImageURI(Uri.parse(item.getCoverPhotoUrl()));
38 | holder.textViewPrice.setText(item.getPrice().toString() + " 元");
39 | }
40 |
41 | @Override public int getItemCount() {
42 | return mDatas.size();
43 | }
44 |
45 | public void reloadData(List list) {
46 | if (mDatas != null) {
47 | mDatas.clear();
48 | mDatas.addAll(list);
49 | notifyDataSetChanged();
50 | }
51 | }
52 |
53 | public void loadMoreData(List list) {
54 | int count = mDatas.size();
55 | mDatas.addAll(list);
56 | notifyItemRangeChanged(count, list.size());
57 | }
58 |
59 | public class BitkyViewHolder extends RecyclerView.ViewHolder {
60 | View itemView;
61 | TextView textViewTitle;
62 | TextView textViewPrice;
63 | SimpleDraweeView draweeView;
64 |
65 | public BitkyViewHolder(View itemView) {
66 | super(itemView);
67 | this.itemView = itemView;
68 | textViewTitle = (TextView) itemView.findViewById(R.id.recycler_homeshow_text_title);
69 | textViewPrice = (TextView) itemView.findViewById(R.id.recycler_homeshow_text_price);
70 | draweeView = (SimpleDraweeView) itemView.findViewById(R.id.recycler_homeshow_draweeview);
71 |
72 | itemView.setOnClickListener(new View.OnClickListener() {
73 | @Override public void onClick(View view) {
74 | if (listener != null) {
75 | listener.Onclick(view, getAdapterPosition(),
76 | mDatas.get(getAdapterPosition()).getName());
77 | }
78 | }
79 | });
80 | }
81 | }
82 |
83 | public interface BitkyOnClickListener {
84 | void Onclick(View v, int positon, String msg);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/recycler_cartfragment_show.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
19 |
27 |
28 |
34 |
35 |
47 |
53 |
65 |
66 |
67 |
68 |
69 |
70 |
74 |
75 |
76 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/view/UpdateCommodityInfoWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Shapes;
13 | using bitkyShop.bean;
14 | using bitkyShop.utils;
15 |
16 | namespace bitkyShop.view
17 | {
18 | ///
19 | /// UpdateCommodityInfoWindow.xaml 的交互逻辑
20 | ///
21 | public partial class UpdateCommodityInfoWindow : Window
22 | {
23 | private Commodity _commodity;
24 | private ICloudServiceView _view;
25 |
26 | public UpdateCommodityInfoWindow(ICloudServiceView view, Commodity commodity)
27 | {
28 | InitializeComponent();
29 | _commodity = commodity;
30 | _view = view;
31 |
32 | textBoxName.Text = commodity.Name;
33 | textBoxCategory.Text = commodity.Category;
34 | textBoxSubCategory.Text = commodity.CategorySub;
35 | textBoxCount.Text = commodity.Count.ToString();
36 | textBoxPrice.Text = commodity.Price.ToString();
37 | textBoxDetails.Text = commodity.Details;
38 | }
39 |
40 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
41 | {
42 | DragMove();
43 | }
44 |
45 | private void btnClose_Click(object sender, RoutedEventArgs e)
46 | {
47 | Close();
48 | }
49 |
50 | private void btnConfirmUpdate_Click(object sender, RoutedEventArgs e)
51 | {
52 | if (textBoxName.Text.Trim().Equals(string.Empty) ||
53 | textBoxCategory.Text.Trim().Equals(string.Empty) ||
54 | !KyMatch.IsInt(textBoxCount.Text.Trim()) ||
55 | !KyMatch.IsFloat(textBoxPrice.Text.Trim()))
56 | {
57 | MessageBox.Show("输入文本有误,请检查!", "警告");
58 | return;
59 | }
60 | if (textBoxSubCategory.Text.Trim().Equals(string.Empty))
61 | {
62 | var category = textBoxCategory.Text.Trim();
63 | if (
64 | !(category.Equals("水果") || category.Equals("烧烤") || category.Equals("旅游") ||
65 | category.Equals("广告与促销")))
66 | {
67 | MessageBox.Show("输入文本有误,请检查!", "警告");
68 | return;
69 | }
70 | }
71 | Commodity commodity = new Commodity
72 | {
73 | Name = textBoxName.Text.Trim(),
74 | Category = textBoxCategory.Text.Trim(),
75 | CategorySub = textBoxSubCategory.Text.Trim(),
76 | Count = int.Parse(textBoxCount.Text.Trim()),
77 | Price = double.Parse(textBoxPrice.Text.Trim()),
78 | Details = textBoxDetails.Text.Trim()
79 | };
80 |
81 | commodity.objectId = _commodity.objectId;
82 | Close();
83 | _view.updateCommodity(commodity);
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/utils/HashHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 |
3 | namespace bitkyShop.utils
4 | {
5 | ///
6 | /// 提供用于计算指定文件哈希值的方法
7 | /// 例如计算文件的MD5值:
8 | ///
9 | /// String hashMd5=HashHelper.ComputeMD5("MyFile.txt");
10 | ///
11 | ///
12 | /// 例如计算文件的CRC32值:
13 | ///
14 | /// String hashCrc32 = HashHelper.ComputeCRC32("MyFile.txt");
15 | ///
16 | ///
17 | /// 例如计算文件的SHA1值:
18 | ///
19 | /// String hashSha1 =HashHelper.ComputeSHA1("MyFile.txt");
20 | ///
21 | ///
22 | ///
23 | public sealed class HashHelper
24 | {
25 | ///
26 | /// 计算指定文件的MD5值
27 | ///
28 | /// 指定文件的完全限定名称
29 | /// 返回值的字符串形式
30 | public static string ComputeMd5(string fileName)
31 | {
32 | string hashMd5 = string.Empty;
33 | //检查文件是否存在,如果文件存在则进行计算,否则返回空值
34 | if (System.IO.File.Exists(fileName))
35 | {
36 | using (
37 | var fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read))
38 | {
39 | //计算文件的MD5值
40 | var calculator = System.Security.Cryptography.MD5.Create();
41 | var buffer = calculator.ComputeHash(fs);
42 | calculator.Clear();
43 | //将字节数组转换成十六进制的字符串形式
44 | var stringBuilder = new StringBuilder();
45 | foreach (var t in buffer)
46 | {
47 | stringBuilder.Append(t.ToString("x2"));
48 | }
49 | hashMd5 = stringBuilder.ToString();
50 | } //关闭文件流
51 | } //结束计算
52 | return hashMd5;
53 | } //ComputeMD5
54 |
55 | ///
56 | /// 计算指定文件的SHA1值
57 | ///
58 | /// 指定文件的完全限定名称
59 | /// 返回值的字符串形式
60 | public static string ComputeSha1(string fileName)
61 | {
62 | var hashSha1 = string.Empty;
63 | //检查文件是否存在,如果文件存在则进行计算,否则返回空值
64 | if (System.IO.File.Exists(fileName))
65 | {
66 | using (
67 | var fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read))
68 | {
69 | //计算文件的SHA1值
70 | var calculator = System.Security.Cryptography.SHA1.Create();
71 | var buffer = calculator.ComputeHash(fs);
72 | calculator.Clear();
73 | //将字节数组转换成十六进制的字符串形式
74 | var stringBuilder = new StringBuilder();
75 | foreach (var t in buffer)
76 | {
77 | stringBuilder.Append(t.ToString("x2"));
78 | }
79 | hashSha1 = stringBuilder.ToString();
80 | } //关闭文件流
81 | }
82 | return hashSha1;
83 | } //ComputeSHA1
84 | } //end class: HashHelper
85 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/categrayfragment/SubCategrayActivityPresenter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.categrayfragment;
2 |
3 | import cc.bitky.bitkyshop.bean.Commodity;
4 | import cn.bmob.v3.BmobQuery;
5 | import cn.bmob.v3.exception.BmobException;
6 | import cn.bmob.v3.listener.FindListener;
7 | import com.socks.library.KLog;
8 | import java.util.List;
9 |
10 | public class SubCategrayActivityPresenter {
11 | private SubCategoryActivity activity;
12 | private int currentPosition = 0;
13 | private int countLimit = 10;
14 | private String currentSubCategoryStr;
15 |
16 | SubCategrayActivityPresenter(SubCategoryActivity activity) {
17 | this.activity = activity;
18 | }
19 |
20 | void refreshRecyclerAdapterData(String subCategory, RefreshType type) {
21 | switch (type) {
22 | case Refresh:
23 | if (subCategory != null) {
24 | currentSubCategoryStr = subCategory;
25 | }
26 | new Thread(new Runnable() {
27 | @Override public void run() {
28 | currentPosition = 0;
29 | BmobQuery bmobQuery = new BmobQuery<>();
30 | bmobQuery.addWhereEqualTo("CategorySub", currentSubCategoryStr)
31 | .addWhereGreaterThan("Count", 0)
32 | .setLimit(countLimit)
33 | .setSkip(currentPosition)
34 | .order("createdAt");
35 | bmobQuery.findObjects(new FindListener() {
36 | @Override public void done(List list, BmobException e) {
37 | if (e != null) {
38 | KLog.d("异常内容:" + e.getMessage());
39 | } else if (list.size() >= 0) {
40 | KLog.d("list.size()=" + list.size());
41 | activity.refreshRecyclerViewData(list, RefreshType.Refresh);
42 | }
43 | if (list.size() == 0) {
44 | activity.CanNotRefreshData(RefreshType.Refresh);
45 | }
46 | }
47 | });
48 | }
49 | }).start();
50 |
51 | break;
52 | case LoadMore:
53 | new Thread(new Runnable() {
54 | @Override public void run() {
55 | currentPosition = currentPosition + 10;
56 | BmobQuery bmobQuery = new BmobQuery<>();
57 | bmobQuery.addWhereEqualTo("CategorySub", currentSubCategoryStr)
58 | .addWhereGreaterThan("Count", 0)
59 | .setLimit(countLimit)
60 | .setSkip(currentPosition)
61 | .order("createdAt");
62 | bmobQuery.findObjects(new FindListener() {
63 | @Override public void done(List list, BmobException e) {
64 | if (e != null) {
65 | KLog.d("异常内容:" + e.getMessage());
66 | } else if (list.size() > 0) {
67 | activity.refreshRecyclerViewData(list, RefreshType.LoadMore);
68 | } else if (list.size() == 0) {
69 | activity.CanNotRefreshData(RefreshType.LoadMore);
70 | }
71 | }
72 | });
73 | }
74 | }).start();
75 | break;
76 | }
77 | }
78 |
79 | enum RefreshType {
80 | Refresh,
81 | LoadMore
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/addressactivity/AddressOptionPresenter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.addressactivity;
2 |
3 | import cc.bitky.bitkyshop.bean.cart.ReceiveAddress;
4 | import cn.bmob.v3.BmobQuery;
5 | import cn.bmob.v3.exception.BmobException;
6 | import cn.bmob.v3.listener.FindListener;
7 | import cn.bmob.v3.listener.SaveListener;
8 | import cn.bmob.v3.listener.UpdateListener;
9 | import com.socks.library.KLog;
10 | import java.util.List;
11 |
12 | public class AddressOptionPresenter {
13 | private AddressOptionActivity activity;
14 |
15 | public AddressOptionPresenter(AddressOptionActivity activity) {
16 | this.activity = activity;
17 | }
18 |
19 | public void getCurrentUserAddress(String userObjectId) {
20 | BmobQuery bmobQuery = new BmobQuery<>();
21 | bmobQuery.addWhereEqualTo("userObjectId", userObjectId);
22 | bmobQuery.setLimit(50);
23 | bmobQuery.findObjects(new FindListener() {
24 | @Override public void done(List list, BmobException e) {
25 | if (e != null) {
26 | activity.showMessage("您还没有添加收货地址哦!", null);
27 | return;
28 | }
29 | activity.initReceiveAddress(list);
30 | }
31 | });
32 | }
33 |
34 | /**
35 | * 插入指定的Item
36 | *
37 | * @param createdAddress 待插入的Item
38 | */
39 | public void insertUserAddress(final ReceiveAddress createdAddress) {
40 | createdAddress.save(new SaveListener() {
41 | @Override public void done(String s, BmobException e) {
42 | if (e != null) {
43 | activity.showMessage(e.getMessage(), null);
44 | return;
45 | }
46 | KLog.d("insertUserAddress:" + s);
47 | activity.showMessage("新建收货地址成功", null);
48 | getCurrentUserAddress(createdAddress.getUserObjectId());
49 | }
50 | });
51 | }
52 |
53 | /**
54 | * 更新指定的Item
55 | *
56 | * @param addressObjectId Item的objectId
57 | * @param isDefault Item的默认状态
58 | */
59 | public void updateUserAddressDefault(final String addressObjectId, final Boolean isDefault) {
60 | ReceiveAddress receiveAddress = new ReceiveAddress();
61 | receiveAddress.setObjectId(addressObjectId);
62 | receiveAddress.setDefault(isDefault);
63 | receiveAddress.update(new UpdateListener() {
64 | @Override public void done(BmobException e) {
65 | if (e != null) {
66 | activity.showMessage(e.getMessage(), null);
67 | }
68 | }
69 | });
70 | }
71 |
72 | /**
73 | * 删除指定的Item
74 | *
75 | * @param addressObjectId 指定的Item的ObjectId
76 | */
77 | public void deleteUserAddress(final String addressObjectId) {
78 | ReceiveAddress receiveAddress = new ReceiveAddress();
79 | receiveAddress.setObjectId(addressObjectId);
80 | receiveAddress.delete(new UpdateListener() {
81 | @Override public void done(BmobException e) {
82 | if (e != null) {
83 | activity.showMessage(e.getMessage(), null);
84 | } else {
85 | activity.showMessage(addressObjectId, Type.deleteAddressSuccess);
86 | }
87 | }
88 | });
89 | }
90 |
91 | enum Type {
92 | insertCreatedAddressSuccessful,
93 | insertCreatedAddressfailed,
94 | deleteAddressSuccess
95 |
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/cart/Order.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean.cart;
2 |
3 | import cn.bmob.v3.BmobObject;
4 | import java.io.Serializable;
5 | import java.util.List;
6 |
7 | /**
8 | * Created by bitky on 2016/12/4.
9 | */
10 |
11 | public class Order extends BmobObject implements Serializable {
12 | public static final int NONE = 0;
13 | public static final int POSTED = 100;
14 | public static final int CONFIRMED = 110;
15 |
16 | public static final int COMPLETED = 200;
17 |
18 | public static final int CANCELLED = 500;
19 | public static final int DELETED = 600;
20 | private String userObjectId;
21 | private String username;
22 | private Integer status;
23 |
24 | private ReceiveAddress receiveAddress;
25 | private List commodityList;
26 |
27 | private String name;
28 | private String phone;
29 | private String address;
30 |
31 | public Order() {
32 | status = POSTED;
33 | }
34 |
35 | public Order(List commodityList) {
36 | this.commodityList = commodityList;
37 | status = POSTED;
38 | }
39 |
40 | /**
41 | * 设置收货地址以及当前用户信息
42 | */
43 | public void setAddressAndUserInfo(ReceiveAddress receiveAddress) {
44 | this.receiveAddress = receiveAddress;
45 | userObjectId = receiveAddress.getUserObjectId();
46 | username = receiveAddress.getUsername();
47 |
48 | name = receiveAddress.getName();
49 | phone = receiveAddress.getPhone();
50 | address = receiveAddress.getAddress();
51 | status = POSTED;
52 | }
53 |
54 | /**
55 | * JavaBean是否填写完整
56 | *
57 | * @return 填写完整的状态
58 | */
59 | public Boolean isDone() {
60 | if (userObjectId != null
61 | && username != null
62 | && receiveAddress != null
63 | && commodityList != null) {
64 | return true;
65 | }
66 | return false;
67 | }
68 |
69 | public String getName() {
70 | return name;
71 | }
72 |
73 | public void setName(String name) {
74 | this.name = name;
75 | }
76 |
77 | public String getPhone() {
78 | return phone;
79 | }
80 |
81 | public void setPhone(String phone) {
82 | this.phone = phone;
83 | }
84 |
85 | public String getAddress() {
86 | return address;
87 | }
88 |
89 | public void setAddress(String address) {
90 | this.address = address;
91 | }
92 |
93 | public Integer getStatus() {
94 | return status;
95 | }
96 |
97 | public void setStatus(Integer status) {
98 | this.status = status;
99 | }
100 |
101 | public ReceiveAddress getReceiveAddress() {
102 | return receiveAddress;
103 | }
104 |
105 | public void setReceiveAddress(ReceiveAddress receiveAddress) {
106 | this.receiveAddress = receiveAddress;
107 | }
108 |
109 | public String getUserObjectId() {
110 | return userObjectId;
111 | }
112 |
113 | public void setUserObjectId(String userObjectId) {
114 | this.userObjectId = userObjectId;
115 | }
116 |
117 | public String getUsername() {
118 | return username;
119 | }
120 |
121 | public void setUsername(String username) {
122 | this.username = username;
123 | }
124 |
125 | public List getCommodityList() {
126 | return commodityList;
127 | }
128 |
129 | public void setCommodityList(List commodityList) {
130 | this.commodityList = commodityList;
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/hotfragment/HotFragmentPresenter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.hotfragment;
2 |
3 | import cc.bitky.bitkyshop.bean.Commodity;
4 | import cn.bmob.v3.BmobQuery;
5 | import cn.bmob.v3.exception.BmobException;
6 | import cn.bmob.v3.listener.FindListener;
7 | import com.socks.library.KLog;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | class HotFragmentPresenter {
12 | private IHotFragment mView;
13 | private int currentPosition = 0;
14 | private int countLimit = 10;
15 | private String currentCategoryStr = "水果";
16 |
17 | HotFragmentPresenter(IHotFragment view) {
18 | mView = view;
19 | }
20 |
21 | public List getCategoryNames() {
22 | List strings = new ArrayList<>();
23 | strings.add("水果");
24 | strings.add("烧烤");
25 | strings.add("旅游");
26 | return strings;
27 | }
28 |
29 | public void refreshRecyclerAdapterData(String category, RefreshType type) {
30 | switch (type) {
31 | case Refresh:
32 | if (category != null) {
33 | currentCategoryStr = category;
34 | }
35 | new Thread(new Runnable() {
36 | @Override public void run() {
37 | currentPosition = 0;
38 | BmobQuery bmobQuery = new BmobQuery<>();
39 | bmobQuery.addWhereEqualTo("Category", currentCategoryStr)
40 | .addWhereGreaterThan("Count", 0)
41 | .setLimit(countLimit)
42 | .setSkip(currentPosition)
43 | .order("createdAt");
44 | bmobQuery.findObjects(new FindListener() {
45 | @Override public void done(List list, BmobException e) {
46 | if (e != null) {
47 | KLog.d("异常内容:" + e.getMessage());
48 | } else if (list.size() >= 0) {
49 | KLog.d("list.size()=" + list.size());
50 | mView.refreshRecyclerViewData(list, RefreshType.Refresh);
51 | }
52 | if (list.size() == 0) {
53 | mView.CanNotRefreshData(RefreshType.Refresh);
54 | }
55 | }
56 | });
57 | }
58 | }).start();
59 |
60 | break;
61 | case LoadMore:
62 | new Thread(new Runnable() {
63 | @Override public void run() {
64 | currentPosition = currentPosition + 10;
65 | BmobQuery bmobQuery = new BmobQuery<>();
66 | bmobQuery.addWhereEqualTo("Category", currentCategoryStr)
67 | .addWhereGreaterThan("Count", 0)
68 | .setLimit(countLimit)
69 | .setSkip(currentPosition)
70 | .order("createdAt");
71 | bmobQuery.findObjects(new FindListener() {
72 | @Override public void done(List list, BmobException e) {
73 | if (e != null) {
74 | KLog.d("异常内容:" + e.getMessage());
75 | } else if (list.size() > 0) {
76 | mView.refreshRecyclerViewData(list, RefreshType.LoadMore);
77 | } else if (list.size() == 0) {
78 | mView.CanNotRefreshData(RefreshType.LoadMore);
79 | }
80 | }
81 | });
82 | }
83 | }).start();
84 | break;
85 | }
86 | }
87 |
88 | enum RefreshType {
89 | Refresh,
90 | LoadMore
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/globalDeploy/GreenDaoKyHelper.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.globalDeploy;
2 |
3 | import android.database.sqlite.SQLiteDatabase;
4 | import cc.bitky.bitkyshop.BuildConfig;
5 | import cc.bitky.bitkyshop.bean.Commodity;
6 | import cc.bitky.bitkyshop.bean.cart.CommodityLocal;
7 | import cc.bitky.bitkyshop.bean.cart.CommodityLocalDao;
8 | import cc.bitky.bitkyshop.bean.cart.DaoMaster;
9 | import cc.bitky.bitkyshop.bean.cart.DaoSession;
10 | import com.socks.library.KLog;
11 | import java.util.List;
12 | import org.greenrobot.greendao.query.QueryBuilder;
13 |
14 | public class GreenDaoKyHelper {
15 |
16 | private static DaoSession daoSession;
17 |
18 | static void init(DaoMaster.DevOpenHelper helper) {
19 | // do this once, for example in your Application class
20 | QueryBuilder.LOG_SQL = BuildConfig.BITKY_LOG_DEBUG;
21 | QueryBuilder.LOG_VALUES = BuildConfig.BITKY_LOG_DEBUG;
22 |
23 | SQLiteDatabase db = helper.getWritableDatabase();
24 | DaoMaster daoMaster = new DaoMaster(db);
25 | daoSession = daoMaster.newSession();
26 | }
27 |
28 | public static DaoSession getDaoSession() {
29 | if (daoSession != null) {
30 | return daoSession;
31 | } else {
32 | throw new NullPointerException("未初始化DaoSession");
33 | }
34 | }
35 |
36 | /**
37 | * 更新数据库中商品被选中的状态
38 | * @param c 数据库中的商品
39 | */
40 | public static void updateChecked(CommodityLocal c) {
41 | CommodityLocalDao commodityLocalDao = GreenDaoKyHelper.getDaoSession().getCommodityLocalDao();
42 | commodityLocalDao.update(c);
43 | }
44 |
45 | /**
46 | * 在[本地数据库]购物车中插入商品或增加其数量
47 | *
48 | * @param c 商品bean
49 | */
50 | public static void insertOrIncrease(Commodity c) {
51 | CommodityLocalDao commodityLocalDao = GreenDaoKyHelper.getDaoSession().getCommodityLocalDao();
52 | QueryBuilder queryBuilder = commodityLocalDao.queryBuilder();
53 | queryBuilder.where(CommodityLocalDao.Properties.ObjectId.eq(c.getObjectId()));
54 | List localList = queryBuilder.list();
55 | KLog.d("查询到的结果数:" + localList.size());
56 | CommodityLocal commodityLocal =
57 | new CommodityLocal(null, c.getObjectId(), c.getCategory(), c.getName(), c.getDetails(), 1,
58 | c.getPrice(), c.getCoverPhotoUrl(), false);
59 | if (localList.size() >= 1) {
60 | commodityLocal.setId(localList.get(0).getId());
61 | commodityLocal.setCartCount(localList.get(0).getCartCount() + 1);
62 | commodityLocalDao.update(commodityLocal);
63 | } else {
64 | commodityLocalDao.insert(commodityLocal);
65 | }
66 | }
67 |
68 | /**
69 | * 查询[本地数据库]购物车中的所有商品
70 | *
71 | * @return 查询到的所有商品
72 | */
73 | public static List queryAll() {
74 | CommodityLocalDao commodityLocalDao = GreenDaoKyHelper.getDaoSession().getCommodityLocalDao();
75 | QueryBuilder queryBuilder = commodityLocalDao.queryBuilder();
76 | return queryBuilder.list();
77 | }
78 |
79 | public static void deleteItem(CommodityLocal dataItem) {
80 | CommodityLocalDao commodityLocalDao = GreenDaoKyHelper.getDaoSession().getCommodityLocalDao();
81 | commodityLocalDao.delete(dataItem);
82 | }
83 |
84 | public static void deleteItems(List dataItems) {
85 | if (dataItems == null || dataItems.size() == 0) return;
86 | CommodityLocalDao commodityLocalDao = GreenDaoKyHelper.getDaoSession().getCommodityLocalDao();
87 | commodityLocalDao.deleteInTx(dataItems);
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/bean/Commodity.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using cn.bmob.io;
3 |
4 | namespace bitkyShop.bean
5 | {
6 | public class Commodity : BmobTable
7 | {
8 | public string Category { set; get; }
9 | public string CategorySub { set; get; }
10 | public string Name { set; get; }
11 | public BmobDouble Price { set; get; }
12 | public BmobInt Count { set; get; }
13 | public string Details { set; get; }
14 | public string Promotion { set; get; }
15 | public string AD { set; get; }
16 | public string BitkyId { set; get; }
17 | public BmobInt BitkyMode { set; get; }
18 | public string BitkyModeStr { set; get; }
19 | public string CoverPhotoUrl { set; get; }
20 | public List CoverPhotoUrlSet { set; get; }
21 | public string CoverPhotoName { get; set; }
22 | public List CoverPhotoNameSet { set; get; }
23 |
24 | public Commodity()
25 | {
26 | CategorySub = "";
27 | BitkyModeStr = "none";
28 | BitkyId = "default";
29 | BitkyMode = 0;
30 | CoverPhotoUrlSet = new List();
31 | CoverPhotoNameSet = new List();
32 | }
33 |
34 | public Commodity SetStamp(string msg)
35 | {
36 | BitkyId = msg;
37 | return this;
38 | }
39 |
40 | public Commodity SetMode(int msg)
41 | {
42 | BitkyMode = msg;
43 | return this;
44 | }
45 |
46 | //读字段信息
47 | public override void readFields(BmobInput input)
48 | {
49 | base.readFields(input);
50 |
51 | BitkyId = input.getString("BitkyId");
52 | BitkyMode = input.getInt("BitkyMode");
53 | BitkyModeStr = input.getString("BitkyModeStr");
54 | Promotion = input.getString("Promotion");
55 | AD = input.getString("AD");
56 | Category = input.getString("Category");
57 | CategorySub = input.getString("CategorySub");
58 | Name = input.getString("Name");
59 | Price = input.getDouble("Price");
60 | Count = input.getInt("Count");
61 | Details = input.getString("Details");
62 | CoverPhotoName = input.getString("CoverPhotoName");
63 | CoverPhotoUrl = input.getString("CoverPhotoUrl");
64 | CoverPhotoNameSet = input.getList("CoverPhotoNameSet");
65 | CoverPhotoUrlSet = input.getList("CoverPhotoUrlSet");
66 | }
67 |
68 | //写字段信息
69 | public override void write(BmobOutput output, bool all)
70 | {
71 | base.write(output, all);
72 |
73 | output.Put("BitkyId", BitkyId);
74 | output.Put("BitkyMode", BitkyMode);
75 | output.Put("BitkyModeStr", BitkyModeStr);
76 | output.Put("Promotion", Promotion);
77 | output.Put("AD", AD);
78 | output.Put("Category", Category);
79 | output.Put("CategorySub", CategorySub);
80 | output.Put("Name", Name);
81 | output.Put("Price", Price);
82 | output.Put("Count", Count);
83 | output.Put("Details", Details);
84 | output.Put("CoverPhotoName", CoverPhotoName);
85 | output.Put("CoverPhotoUrl", CoverPhotoUrl);
86 | output.Put("CoverPhotoNameSet", CoverPhotoNameSet);
87 | output.Put("CoverPhotoUrlSet", CoverPhotoUrlSet);
88 | }
89 | }
90 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/bean/Commodity.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.bean;
2 |
3 | import cn.bmob.v3.BmobObject;
4 | import java.io.Serializable;
5 | import java.util.List;
6 |
7 | public class Commodity extends BmobObject implements Serializable{
8 | private String BitkyId;
9 | private Integer BitkyMode;
10 | private String BitkyModeStr;
11 | private String Promotion;
12 | private String AD;
13 | private String Category;
14 | private String CategorySub;
15 | private String Name;
16 | private Double Price;
17 | private Integer Count;
18 | private String Details;
19 | private String CoverPhotoUrl;
20 | private List CoverPhotoUrlSet;
21 | private String CoverPhotoName;
22 | private List CoverPhotoNameSet;
23 |
24 | public String getPromotion() {
25 | return Promotion;
26 | }
27 |
28 | public void setPromotion(String promotion) {
29 | Promotion = promotion;
30 | }
31 |
32 | public String getAD() {
33 | return AD;
34 | }
35 |
36 | public void setAD(String AD) {
37 | this.AD = AD;
38 | }
39 |
40 | public String getCategorySub() {
41 | return CategorySub;
42 | }
43 |
44 | public void setCategorySub(String categorySub) {
45 | CategorySub = categorySub;
46 | }
47 |
48 | public String getBitkyModeStr() {
49 | return BitkyModeStr;
50 | }
51 |
52 | public void setBitkyModeStr(String bitkyModeStr) {
53 | BitkyModeStr = bitkyModeStr;
54 | }
55 |
56 | public String getBitkyId() {
57 | return BitkyId;
58 | }
59 |
60 | public void setBitkyId(String bitkyId) {
61 | BitkyId = bitkyId;
62 | }
63 |
64 | public Integer getBitkyMode() {
65 | return BitkyMode;
66 | }
67 |
68 | public void setBitkyMode(Integer bitkyMode) {
69 | BitkyMode = bitkyMode;
70 | }
71 |
72 | public String getCategory() {
73 | return Category;
74 | }
75 |
76 | public void setCategory(String category) {
77 | Category = category;
78 | }
79 |
80 | public String getName() {
81 | return Name;
82 | }
83 |
84 | public void setName(String name) {
85 | Name = name;
86 | }
87 |
88 | public Double getPrice() {
89 | return Price;
90 | }
91 |
92 | public void setPrice(Double price) {
93 | Price = price;
94 | }
95 |
96 | public Integer getCount() {
97 | return Count;
98 | }
99 |
100 | public void setCount(Integer count) {
101 | Count = count;
102 | }
103 |
104 | public String getDetails() {
105 | return Details;
106 | }
107 |
108 | public void setDetails(String details) {
109 | Details = details;
110 | }
111 |
112 | public String getCoverPhotoUrl() {
113 | return CoverPhotoUrl;
114 | }
115 |
116 | public void setCoverPhotoUrl(String coverPhotoUrl) {
117 | CoverPhotoUrl = coverPhotoUrl;
118 | }
119 |
120 | public List getCoverPhotoUrlSet() {
121 | return CoverPhotoUrlSet;
122 | }
123 |
124 | public void setCoverPhotoUrlSet(List coverPhotoUrlSet) {
125 | CoverPhotoUrlSet = coverPhotoUrlSet;
126 | }
127 |
128 | public String getCoverPhotoName() {
129 | return CoverPhotoName;
130 | }
131 |
132 | public void setCoverPhotoName(String coverPhotoName) {
133 | CoverPhotoName = coverPhotoName;
134 | }
135 |
136 | public List getCoverPhotoNameSet() {
137 | return CoverPhotoNameSet;
138 | }
139 |
140 | public void setCoverPhotoNameSet(List coverPhotoNameSet) {
141 | CoverPhotoNameSet = coverPhotoNameSet;
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/fragment/userfragment/loginfragment/RequestSMSCodeActivity.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.fragment.userfragment.loginfragment;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.view.inputmethod.InputMethodManager;
9 | import android.widget.Button;
10 | import android.widget.EditText;
11 | import cc.bitky.bitkyshop.R;
12 | import cc.bitky.bitkyshop.bean.cart.KyUser;
13 | import cc.bitky.bitkyshop.utils.KyToolBar;
14 | import cc.bitky.bitkyshop.utils.ToastUtil;
15 | import cc.bitky.bitkyshop.utils.tools.KyBmobHelper;
16 | import cc.bitky.bitkyshop.utils.tools.KySet;
17 | import cn.bmob.v3.BmobUser;
18 | import cn.bmob.v3.exception.BmobException;
19 | import cn.bmob.v3.listener.LogInListener;
20 | import com.socks.library.KLog;
21 |
22 | public class RequestSMSCodeActivity extends AppCompatActivity implements View.OnClickListener {
23 |
24 | private ToastUtil toastUtil;
25 | private EditText editTextSMSCode;
26 |
27 | @Override protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_request_smscode);
30 | toastUtil = new ToastUtil(this);
31 | KyToolBar kyToolBar = (KyToolBar) findViewById(R.id.requestSMSCodeActivity_toolbar);
32 | kyToolBar.setNavigationOnClickListener(new View.OnClickListener() {
33 | @Override public void onClick(View v) {
34 | finish();
35 | }
36 | });
37 | editTextSMSCode = (EditText) findViewById(R.id.requestSMSCodeActivity_textView_SMSCode);
38 | Button btnLoginOrSignUp = (Button) findViewById(R.id.requestSMSCodeActivity_btn_loginOrSignUp);
39 | btnLoginOrSignUp.setOnClickListener(this);
40 | }
41 |
42 | @Override public void onClick(View v) {
43 | switch (v.getId()) {
44 | case R.id.requestSMSCodeActivity_btn_loginOrSignUp:
45 | InputMethodManager imm =
46 | (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
47 | imm.hideSoftInputFromWindow(editTextSMSCode.getWindowToken(), 0);
48 | String SMSCode = editTextSMSCode.getText().toString().trim();
49 | if (SMSCode.length() == 0) {
50 | toastUtil.show("请输入手机验证码");
51 | return;
52 | }
53 | String phone = getIntent().getStringExtra("phone");
54 | if (phone == null) {
55 | toastUtil.show("未知错误");
56 | finish();
57 | return;
58 | }
59 | KLog.d("phone:" + phone + ",SMSCode:" + SMSCode);
60 |
61 | BmobUser.signOrLoginByMobilePhone(phone, SMSCode, new LogInListener() {
62 |
63 | @Override public void done(final KyUser kyUser, BmobException e) {
64 | if (kyUser == null) KLog.d("kyUser是null");
65 | KyUser kyCurrentUser = KyBmobHelper.getCurrentUser();
66 | if (kyCurrentUser == null) {
67 | KLog.d("kyCurrentUser是null");
68 | } else {
69 | Intent intent = new Intent();
70 | intent.putExtra("userObjectId", kyCurrentUser.getObjectId());
71 | intent.putExtra("username", kyCurrentUser.getUsername());
72 | intent.putExtra("phone", kyCurrentUser.getMobilePhoneNumber());
73 | if (kyCurrentUser.getHaveDetailInfo() != null && kyCurrentUser.getHaveDetailInfo()) {
74 | intent.putExtra("haveDetailInfo", true);
75 | } else {
76 | intent.putExtra("haveDetailInfo", false);
77 | }
78 | setResult(KySet.USER_RESULT_PHONE_SIGNUP_OR_LOGIN, intent);
79 | finish();
80 | }
81 | }
82 | });
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/widget/ItemCounter.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils.widget;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.TintTypedArray;
5 | import android.util.AttributeSet;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.LinearLayout;
10 | import android.widget.TextView;
11 | import cc.bitky.bitkyshop.R;
12 |
13 | /**
14 | * 注:需要传入两个监听器
15 | */
16 | public class ItemCounter extends LinearLayout implements View.OnClickListener {
17 |
18 | private LayoutInflater inflater;
19 | private Button buttonAdd;
20 | private Button buttonMinus;
21 | private TextView textViewShow;
22 |
23 | private int value = 1;
24 | private int valueMax = 99;
25 | private int valueMin = 1;
26 |
27 | OnCounterOverflowListener overflowListener;
28 | OnCounterClickListener counterClickListener;
29 |
30 | public ItemCounter(Context context) {
31 | this(context, null);
32 | }
33 |
34 | public ItemCounter(Context context, AttributeSet attrs) {
35 | this(context, attrs, 0);
36 | }
37 |
38 | public ItemCounter(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | inflater = LayoutInflater.from(context);
41 |
42 | View view = inflater.inflate(R.layout.widget_item_counter, this, true);
43 |
44 | buttonAdd = (Button) view.findViewById(R.id.btnAdd_widget_itemCounter);
45 | buttonMinus = (Button) view.findViewById(R.id.btnMinus_widget_itemCounter);
46 | textViewShow = (TextView) view.findViewById(R.id.textViewShow_widget_itemCounter);
47 | textViewShow.setText(value + "");
48 | buttonAdd.setOnClickListener(this);
49 | buttonMinus.setOnClickListener(this);
50 |
51 | //if (attrs != null) {
52 | // TintTypedArray typedArray =
53 | // TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.ItemCounter,
54 | // defStyleAttr, 0);
55 | //
56 | // typedArray.recycle();
57 | //}
58 | }
59 |
60 | public void setOnCounterOverflowListener(OnCounterOverflowListener overflowListener) {
61 | this.overflowListener = overflowListener;
62 | }
63 |
64 | public void setOnCounterClickListener(OnCounterClickListener counterClickListener) {
65 | this.counterClickListener = counterClickListener;
66 | }
67 |
68 | public int getValue() {
69 | return value;
70 | }
71 |
72 | public void setValue(int value) {
73 | this.value = value;
74 | textViewShow.setText(value + "");
75 | }
76 |
77 | @Override public void onClick(View v) {
78 | switch (v.getId()) {
79 | case R.id.btnAdd_widget_itemCounter:
80 | if (value < valueMax) {
81 | value++;
82 | textViewShow.setText(value + "");
83 | if (counterClickListener != null) {
84 | counterClickListener.OnButtonClick(value, ButtonType.add);
85 | }
86 | } else {
87 | if (overflowListener != null) overflowListener.addOverflow();
88 | }
89 | break;
90 |
91 | case R.id.btnMinus_widget_itemCounter:
92 | if (value > valueMin) {
93 | value--;
94 | textViewShow.setText(value + "");
95 | if (counterClickListener != null) {
96 | counterClickListener.OnButtonClick(value, ButtonType.minus);
97 | }
98 | } else {
99 | if (overflowListener != null) overflowListener.minusOverflow();
100 | }
101 | break;
102 | }
103 | }
104 |
105 | public enum ButtonType {
106 | add,
107 | minus
108 | }
109 |
110 | public interface OnCounterClickListener {
111 |
112 | void OnButtonClick(int currentCount, ButtonType type);
113 | }
114 |
115 | public interface OnCounterOverflowListener {
116 |
117 | void addOverflow();
118 |
119 | void minusOverflow();
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/view/ConfirmUploadSubCategoryInfo.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.IO;
5 | using System.Net;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Data;
11 | using System.Windows.Documents;
12 | using System.Windows.Input;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Shapes;
16 | using bitkyShop.bean;
17 |
18 | namespace bitkyShop.view
19 | {
20 | ///
21 | /// ConfirmUploadSubCategoryInfo.xaml 的交互逻辑
22 | ///
23 | public partial class ConfirmUploadSubCategoryInfo : Window
24 | {
25 | private static ConfirmUploadSubCategoryInfo _confirmUploadSubCategoryInfo;
26 | private string _photoLocalUrl;
27 | private WebClient _webClient;
28 | private static ICloudServiceView _window;
29 | private SubCategory _subCategory;
30 |
31 |
32 | public ConfirmUploadSubCategoryInfo()
33 | {
34 | InitializeComponent();
35 | _confirmUploadSubCategoryInfo = this;
36 | }
37 |
38 | public static ConfirmUploadSubCategoryInfo Builder(ICloudServiceView window)
39 | {
40 | _window = window;
41 | return _confirmUploadSubCategoryInfo != null
42 | ? _confirmUploadSubCategoryInfo
43 | : new ConfirmUploadSubCategoryInfo();
44 | }
45 |
46 | public ConfirmUploadSubCategoryInfo SetSubCategoryInfo(SubCategory subCategory)
47 | {
48 | _subCategory = subCategory;
49 | labelName.Content = subCategory.name;
50 | labelCategory.Content = subCategory.mainCategory;
51 | var info = new FileInfo(@"./resource/defaultCoverPhoto");
52 | if (info.Exists)
53 | imageShow.Source = new BitmapImage((new Uri(info.FullName, UriKind.Absolute)));
54 |
55 | var builder = new StringBuilder();
56 | _photoLocalUrl = @"./photoCache/" + subCategory.photoName;
57 | _webClient = new WebClient();
58 | _webClient.DownloadFileAsync(new Uri(subCategory.photoUrl), _photoLocalUrl);
59 | _webClient.DownloadFileCompleted += DownloadFileCompleted;
60 | imageShow.Stretch = Stretch.Uniform;
61 | return this;
62 | }
63 | ///
64 | /// 图片下载完成回调
65 | ///
66 | ///
67 | ///
68 | private void DownloadFileCompleted(object sender, AsyncCompletedEventArgs asyncCompletedEventArgs)
69 | {
70 | var info = new FileInfo(_photoLocalUrl);
71 | if (info.Exists)
72 | {
73 | imageShow.Source = new BitmapImage(new Uri(info.FullName, UriKind.Absolute));
74 | }
75 | }
76 |
77 |
78 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
79 | {
80 | DragMove();
81 | }
82 |
83 | private void btnClose_Click(object sender, RoutedEventArgs e)
84 | {
85 | Close();
86 | }
87 | private void Window_Closed(object sender, EventArgs e)
88 | {
89 | _confirmUploadSubCategoryInfo = null;
90 | }
91 |
92 |
93 | private void btnConfirmUpload_Click(object sender, RoutedEventArgs e)
94 | {
95 | _window.ConfirmUpload();
96 | }
97 | public void UploadSuccessful()
98 | {
99 | Close();
100 | MessageBox.Show("商品上传成功", "提示");
101 | }
102 |
103 | public void UploadFailed(string msg)
104 | {
105 | MessageBox.Show("商品上传失败\n错误信息: " + msg, "提示");
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/java/cc/bitky/bitkyshop/utils/recyclerview/DividerItemDecoration.java:
--------------------------------------------------------------------------------
1 | package cc.bitky.bitkyshop.utils.recyclerview;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Rect;
7 | import android.graphics.drawable.Drawable;
8 | import android.support.v7.widget.LinearLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.view.View;
11 |
12 | public class DividerItemDecoration extends RecyclerView.ItemDecoration {
13 | /*
14 | * Copyright (C) 2014 The Android Open Source Project
15 | *
16 | * Licensed under the Apache License, Version 2.0 (the "License");
17 | * you may not use this file except in compliance with the License.
18 | * You may obtain a copy of the License at
19 | *
20 | * http://www.apache.org/licenses/LICENSE-2.0
21 | *
22 | * Unless required by applicable law or agreed to in writing, software
23 | * distributed under the License is distributed on an "AS IS" BASIS,
24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 | * See the License for the specific language governing permissions and
26 | * limitations under the License.
27 | */
28 |
29 | private static final int[] ATTRS = new int[] {
30 | android.R.attr.listDivider
31 | };
32 |
33 | public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL;
34 |
35 | public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;
36 |
37 | private Drawable mDivider;
38 |
39 | private int mOrientation;
40 |
41 | public DividerItemDecoration(Context context, int orientation) {
42 | final TypedArray a = context.obtainStyledAttributes(ATTRS);
43 | mDivider = a.getDrawable(0);
44 | a.recycle();
45 | setOrientation(orientation);
46 | }
47 |
48 | public void setOrientation(int orientation) {
49 | if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) {
50 | throw new IllegalArgumentException("invalid orientation");
51 | }
52 | mOrientation = orientation;
53 | }
54 |
55 | @Override public void onDraw(Canvas c, RecyclerView parent) {
56 | if (mOrientation == VERTICAL_LIST) {
57 | drawVertical(c, parent);
58 | } else {
59 | drawHorizontal(c, parent);
60 | }
61 | }
62 |
63 | public void drawVertical(Canvas c, RecyclerView parent) {
64 | final int left = parent.getPaddingLeft();
65 | final int right = parent.getWidth() - parent.getPaddingRight();
66 |
67 | final int childCount = parent.getChildCount();
68 | for (int i = 0; i < childCount; i++) {
69 | final View child = parent.getChildAt(i);
70 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
71 | final int top = child.getBottom() + params.bottomMargin;
72 | final int bottom = top + mDivider.getIntrinsicHeight();
73 | mDivider.setBounds(left, top, right, bottom);
74 | mDivider.draw(c);
75 | }
76 | }
77 |
78 | public void drawHorizontal(Canvas c, RecyclerView parent) {
79 | final int top = parent.getPaddingTop();
80 | final int bottom = parent.getHeight() - parent.getPaddingBottom();
81 |
82 | final int childCount = parent.getChildCount();
83 | for (int i = 0; i < childCount; i++) {
84 | final View child = parent.getChildAt(i);
85 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
86 | final int left = child.getRight() + params.rightMargin;
87 | final int right = left + mDivider.getIntrinsicHeight();
88 | mDivider.setBounds(left, top, right, bottom);
89 | mDivider.draw(c);
90 | }
91 | }
92 |
93 | @Override public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) {
94 | if (mOrientation == VERTICAL_LIST) {
95 | outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
96 | } else {
97 | outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
98 | }
99 | }
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/recycler_userfragment_receive_address.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
22 |
27 |
28 |
36 |
37 |
46 |
47 |
48 |
49 |
58 |
59 |
63 |
64 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/activity_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
18 |
19 |
25 |
26 |
39 |
40 |
54 |
55 |
69 |
70 |
83 |
96 |
106 |
107 |
--------------------------------------------------------------------------------
/Csharp/bitkyShop/bitkyShop/init/CloudServiceHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO;
3 | using System.Threading;
4 | using bitkyShop.bean;
5 | using bitkyShop.utils;
6 | using cn.bmob.api;
7 | using cn.bmob.tools;
8 | using Qiniu.Http;
9 | using Qiniu.Storage;
10 | using Qiniu.Util;
11 |
12 | namespace bitkyShop.init
13 | {
14 | class CloudServiceHelper
15 | {
16 | private CommPresenter _presenter;
17 | private string _filePath = string.Empty;
18 | private string _fileKey = string.Empty;
19 | private string _uploadToken = string.Empty;
20 | private UploadOptions _uploadOptions = null;
21 | private UpCompletionHandler _uploadCompleted;
22 | private BmobWindows _bmobWindows;
23 |
24 |
25 | public CloudServiceHelper(CommPresenter presenter)
26 | {
27 | _presenter = presenter;
28 | PathInit();
29 | BmobBuilder();
30 | QiniuInit();
31 | }
32 |
33 | ///
34 | /// 初始化图片缓存路径
35 | ///
36 | private void PathInit()
37 | {
38 | if (!Directory.Exists("./photoCache"))
39 | {
40 | Directory.CreateDirectory("./photoCache");
41 | }
42 | }
43 |
44 | ///
45 | /// Bmob初始化
46 | ///
47 | public BmobWindows BmobBuilder()
48 | {
49 | if (_bmobWindows == null)
50 | {
51 | _bmobWindows = new BmobWindows();
52 | _bmobWindows.initialize(PresetInfo.BmobApplicationId, PresetInfo.BmobRestApiKey);
53 | BmobDebug.Register(msg => { Debug.WriteLine("BmobDebug:" + msg); });
54 | }
55 | return _bmobWindows;
56 | }
57 |
58 |
59 | ///
60 | /// 七牛初始化
61 | ///
62 | private void QiniuInit()
63 | {
64 | var policy = new PutPolicy(); // 上传策略实例
65 | policy.Scope = PresetInfo.qiniuBucket; // 设置要上传的目标空间
66 | policy.SetExpires(86400); // 上传策略的过期时间(单位:秒),当前设为24小时
67 | var zoneId = Qiniu.Common.AutoZone.Query(PresetInfo.QiniuAccessKey, PresetInfo.qiniuBucket);
68 | // 这里的Zone设置(如果不设置,就默认为华东机房)
69 | Qiniu.Common.Config.ConfigZone(zoneId);
70 | var mac = new Mac(PresetInfo.QiniuAccessKey, PresetInfo.QiniuSecretKey);
71 | _uploadToken = Auth.createUploadToken(policy, mac); // 生成上传凭证
72 |
73 | // 上传完毕事件处理
74 | _uploadCompleted = new UpCompletionHandler(OnQiniuUploadCompleted);
75 | }
76 |
77 | ///
78 | /// 七牛上传完毕事件处理
79 | ///
80 | /// 已上传的文件名
81 | /// 返回信息
82 | /// 返回Json
83 | public void OnQiniuUploadCompleted(string key, ResponseInfo respInfo, string respJson)
84 | {
85 | _presenter.OnQiniuUploadCompleted(key, respInfo, respJson);
86 | }
87 |
88 | ///
89 | /// 异步执行:七牛上传文件
90 | ///
91 | /// 输入文件地址
92 | public void UploadFile(string filePath)
93 | {
94 | _filePath = filePath;
95 | _fileKey = HashHelper.ComputeMd5(filePath);
96 | var info = CommodityUploadInfo
97 | .Builder(_uploadToken, _uploadOptions, _uploadCompleted)
98 | .SetQiniuFilePath(_filePath)
99 | .SetQiniuFileKey(_fileKey);
100 | new Thread(QiniuUploadFile).Start(info);
101 | }
102 |
103 | ///
104 | /// 异步执行:七牛上传文件
105 | ///
106 | ///
107 | private static void QiniuUploadFile(object data)
108 | {
109 | var info = (CommodityUploadInfo) data;
110 | var um = new UploadManager();
111 | um.uploadFile(info.FilePath, info.FileKey, info.UploadToken, info.UploadOptions, info.UploadCompleted);
112 | }
113 | }
114 | }
--------------------------------------------------------------------------------
/Android/bitkyShop/app/src/main/res/layout/fragment_user.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
18 |
19 |
29 |
40 |
41 |
42 |
51 |
59 |
66 |
67 |
74 |
83 |
91 |
98 |
99 |
100 |
112 |
113 |
--------------------------------------------------------------------------------