소스 검색

Merge branch 'master' of http://192.168.3.207:10080/qmx/jyapp

lixianglan 7 년 전
부모
커밋
72b48d3d26
37개의 변경된 파일175개의 추가작업 그리고 136개의 파일을 삭제
  1. 1 0
      README.md
  2. 2 0
      android/app/app.iml
  3. 1 1
      android/app/build.gradle
  4. BIN
      android/app/release/app-release.apk
  5. 1 4
      android/app/src/main/AndroidManifest.xml
  6. 5 3
      android/app/src/main/java/com/topsoft/jianyu/App.java
  7. 13 42
      android/app/src/main/java/com/topsoft/jianyu/JyObj.java
  8. 6 17
      android/app/src/main/java/com/topsoft/jianyu/MainActivity.java
  9. 18 7
      android/app/src/main/java/com/topsoft/jianyu/MyReceiver.java
  10. 1 1
      android/app/src/main/java/com/topsoft/jianyu/SQLite/DBHelper.java
  11. 52 27
      android/app/src/main/java/com/topsoft/jianyu/SQLite/DbBase.java
  12. 13 4
      android/app/src/main/java/com/topsoft/jianyu/SQLite/JyMessage.java
  13. 1 6
      android/app/src/main/java/com/topsoft/jianyu/appUpdate/UpdateVersionController.java
  14. 5 22
      android/app/src/main/java/com/topsoft/jianyu/listener/CustomLoginListerner.java
  15. 1 0
      android/app/src/main/java/com/topsoft/jianyu/util/AppUtil.java
  16. BIN
      android/app/src/main/res/drawable-hdpi/border_bg.9.png
  17. BIN
      android/app/src/main/res/drawable-hdpi/bottom_bg.9.png
  18. 8 0
      android/app/src/main/res/drawable-hdpi/corners_bg.xml
  19. BIN
      android/app/src/main/res/drawable-hdpi/ic_launcher.png
  20. BIN
      android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png
  21. BIN
      android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png
  22. BIN
      android/app/src/main/res/drawable-hdpi/jpush_notification_icon.png
  23. BIN
      android/app/src/main/res/drawable-hdpi/jpush_notification_icon1.png
  24. BIN
      android/app/src/main/res/drawable-hdpi/jpush_notification_icon2.png
  25. BIN
      android/app/src/main/res/drawable-hdpi/jpush_notification_icon3.png
  26. BIN
      android/app/src/main/res/drawable-hdpi/jpush_notification_icon4.png
  27. BIN
      android/app/src/main/res/drawable-hdpi/jpush_notification_icon5.png
  28. BIN
      android/app/src/main/res/drawable-hdpi/jpush_notification_icon7.png
  29. 21 0
      android/app/src/main/res/drawable-hdpi/richpush_btn_selector.xml
  30. 20 0
      android/app/src/main/res/drawable-hdpi/richpush_progressbar.xml
  31. BIN
      android/app/src/main/res/drawable-hdpi/stripes.png
  32. 4 0
      android/app/src/main/res/drawable-hdpi/tiledstripes.xml
  33. BIN
      android/app/src/main/res/drawable-hdpi/top_bg.9.png
  34. BIN
      android/app/src/main/res/drawable/share_thumb_img.jpeg
  35. BIN
      android/app/src/main/res/drawable/share_thumb_img.png
  36. 2 2
      android/app/src/main/res/layout/activity_main.xml
  37. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher.png

+ 1 - 0
README.md

@@ -0,0 +1 @@
+剑鱼App

+ 2 - 0
android/app/app.iml

@@ -88,6 +88,7 @@
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes-jar" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
@@ -101,6 +102,7 @@
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/reports" />
       <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
     </content>
     <orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />

+ 1 - 1
android/app/build.gradle

@@ -4,7 +4,7 @@ android {
     compileSdkVersion 26
     defaultConfig {
         applicationId "com.topsoft.jianyu"
-        minSdkVersion 23
+        minSdkVersion 21
         targetSdkVersion 26
         versionCode 1
         versionName "1.0.0"

BIN
android/app/release/app-release.apk


+ 1 - 4
android/app/src/main/AndroidManifest.xml

@@ -10,7 +10,7 @@
     <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+<!--    <uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.WRITE_SETTINGS" />
@@ -19,9 +19,6 @@
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
 
     <application
         android:name=".App"

+ 5 - 3
android/app/src/main/java/com/topsoft/jianyu/App.java

@@ -17,15 +17,17 @@ public class App extends Application {
     @Override
     public void onCreate() {
         super.onCreate();
+        Boolean isDebug=AppUtil.isApkInDebug(getApplicationContext());
         //是否开启友盟debug模式
-        Config.DEBUG = AppUtil.isApkInDebug(getApplicationContext());
+        Config.DEBUG =isDebug ;
         //是否开启极光debug模式
-        JPushInterface.setDebugMode(AppUtil.isApkInDebug(getApplicationContext()));
+        JPushInterface.setDebugMode(isDebug);
     }
 
     //各个平台的配置,建议放在全局Application或者程序入口
     {
-        PlatformConfig.setWeixin("wx0e6a5b18f4cfd10d", "bf12200554cb6edeb2be69d49dc11a3e");
+        PlatformConfig.setWeixin("wx0e6a5b18f4cfd10d", "bf12200554cb6edeb2be69d49dc11a3e");//正式
+        //PlatformConfig.setWeixin("wxd6f3e855ef4258cd", "ed5961aa2fca99d13ccff99130ba2866");//测试
         PlatformConfig.setQQZone("1106703118", "MYFVJZhtygWy5hzh");
     }
 }

+ 13 - 42
android/app/src/main/java/com/topsoft/jianyu/JyObj.java

@@ -2,30 +2,18 @@ package com.topsoft.jianyu;
 
 
 
-import android.app.Activity;
-import android.app.DownloadManager;
+
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.net.Uri;
 import android.os.Build;
-import android.os.Environment;
 import android.support.v4.app.ActivityCompat;
-import android.util.Log;
 import android.webkit.JavascriptInterface;
 import android.webkit.WebView;
 
-import com.ccit.www.mobileshieldsdk.okutils.okhttp3.Call;
-import com.ccit.www.mobileshieldsdk.okutils.okhttputils.OkHttpUtils;
-import com.ccit.www.mobileshieldsdk.okutils.okhttputils.callback.FileCallBack;
-import com.topsoft.jianyu.SQLite.DBHelper;
+
 import com.topsoft.jianyu.SQLite.DbBase;
-import com.topsoft.jianyu.SQLite.JyMessage;
-import com.topsoft.jianyu.appUpdate.UpdateVersionController;
 import com.topsoft.jianyu.listener.CustomLoginListerner;
-import com.topsoft.jianyu.listener.CustomRemoveLoginListerner;
 import com.topsoft.jianyu.listener.CustomShareListener;
 import com.topsoft.jianyu.util.AppUtil;
 import com.umeng.socialize.ShareAction;
@@ -36,11 +24,9 @@ import com.umeng.socialize.media.UMImage;
 import com.umeng.socialize.media.UMWeb;
 
 import org.json.JSONArray;
-import org.json.JSONObject;
 
-import java.io.File;
-import java.util.List;
-import java.util.Map;
+
+import cn.jpush.android.api.JPushInterface;
 
 import static android.content.Context.MODE_PRIVATE;
 
@@ -108,10 +94,7 @@ public class JyObj {
     //删除用户登录标识
     @JavascriptInterface
     public void removeUserToken(){
-        //清除授权
-        CustomRemoveLoginListerner removeLoginListerner=new CustomRemoveLoginListerner(mContext,webView);
-        UMShareAPI.get(mContext).deleteOauth(mainActivity,SHARE_MEDIA.WEIXIN,removeLoginListerner);
-        //清除共享存储区中的openid
+        //清除共享存储区中的token
         share.edit().clear().commit();
     }
 
@@ -146,7 +129,6 @@ public class JyObj {
     //获取单条消息
     @JavascriptInterface
     public String getMessage(String id){
-        System.out.println(DbBase.getInstance(mContext).findOneMessage(id));
         return DbBase.getInstance(mContext).findOneMessage(id).toString();
     }
 
@@ -159,15 +141,21 @@ public class JyObj {
     //全部标记为已读
     @JavascriptInterface
     public void updateAllUnReadMessage(String openid){
+        //修改信息状态为已读
         DbBase.getInstance(mContext).updateAllMegReaded(openid);
+        //清空通知栏
+        JPushInterface.clearAllNotifications(mContext);
     }
 
     //获取通知信息列表 取前100条
     @JavascriptInterface
     public String getMessageList(String openid){
+        String result="";
         JSONArray list= DbBase.getInstance(mContext).getMessageList(openid);
-
-        return list.toString();
+        if(list!=null){
+            result=list.toString();
+        }
+        return result;
     }
 
     //打开外部链接
@@ -180,21 +168,4 @@ public class JyObj {
         }
     }
 
-//==============================================================================================
-
-
-    @JavascriptInterface
-    public void lightStatusBar(String isLight){
-       /* if("1".equals(isLight)){
-            StatusBar.setAndroidNativeLightStatusBar(mainActivity,false);
-        }else{
-            StatusBar.setAndroidNativeLightStatusBar(mainActivity,true);
-        }*/
-    }
-
-
-    @JavascriptInterface
-    public void test(){
-
-    }
 }

+ 6 - 17
android/app/src/main/java/com/topsoft/jianyu/MainActivity.java

@@ -2,9 +2,8 @@ package com.topsoft.jianyu;
 
 
 
-import android.app.Notification;
-import android.content.Context;
 
+import android.content.Context;
 import android.content.Intent;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
@@ -23,7 +22,6 @@ import android.webkit.WebSettings;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
 import android.widget.LinearLayout;
-import android.widget.Toast;
 
 import com.topsoft.jianyu.SQLite.DBHelper;
 import com.topsoft.jianyu.appUpdate.UpdateVersionController;
@@ -36,7 +34,6 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import cn.jpush.android.api.BasicPushNotificationBuilder;
 import cn.jpush.android.api.JPushInterface;
 
 
@@ -68,7 +65,6 @@ public class MainActivity extends AppCompatActivity {
         //判断是否是点击推送打开的
         if(pushurl==null||"".equals(pushurl)){
             initWebview(AppUtil.AppUrl+"/jyapp/free/me");
-            //initWebview("http://192.168.100.68:8020/jyAppWeb/index.html");
         }else{
             initWebview(AppUtil.AppUrl+pushurl);
         }
@@ -76,11 +72,10 @@ public class MainActivity extends AppCompatActivity {
         //初始化配置
         initconfigure();
 
-        findViewById(R.id.test).setOnClickListener(new View.OnClickListener() {
+        /*findViewById(R.id.test).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                setStyleBasic();
-                /*DBHelper dbHelper = new DBHelper(ctx,"jy_db",null,1);
+                DBHelper dbHelper = new DBHelper(ctx,"jy_db",null,1);
                 SQLiteDatabase db =dbHelper.getWritableDatabase();
                 Cursor cursor = db.query("jy_message", new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "", new String[]{}, null, null, "comeintime desc");
                 while(cursor.moveToNext()){
@@ -96,9 +91,9 @@ public class MainActivity extends AppCompatActivity {
                     System.out.println("   extend="+cursor.getString(cursor.getColumnIndex("extend")));
                 }
                 System.out.println("查询完成"+cursor.getCount()+"条");
-                db.close();*/
+                db.close();
             }
-        });
+        });*/
 
     }
 
@@ -177,13 +172,7 @@ public class MainActivity extends AppCompatActivity {
         mHandler.obtainMessage(2).sendToTarget();
 
     }
-    private void setStyleBasic() {
-        BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(MainActivity.this);
-        builder.statusBarDrawable = R.mipmap.ic_launcher;
-        builder.notificationFlags = Notification.FLAG_AUTO_CANCEL;  //设置为点击后自动消失
-        builder.notificationDefaults = Notification.DEFAULT_SOUND;  //设置为铃声( Notification.DEFAULT_SOUND)或者震动( Notification.DEFAULT_VIBRATE)
-        JPushInterface.setPushNotificationBuilder(1, builder);
-    }
+
     private Handler mHandler = new Handler() {
         public void handleMessage(Message msg) {
             switch (msg.what) {

+ 18 - 7
android/app/src/main/java/com/topsoft/jianyu/MyReceiver.java

@@ -6,7 +6,6 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.Log;
-import android.widget.Toast;
 
 import com.topsoft.jianyu.SQLite.DbBase;
 import com.topsoft.jianyu.SQLite.JyMessage;
@@ -36,9 +35,9 @@ public class MyReceiver extends BroadcastReceiver {
 		if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
 			try {
 				Bundle bundle = intent.getExtras();
-				String title,content,openid,type,descript,extend,url;
+				String title,content,openid,type,descript,extend,url,pushTime;
 				String list_str=bundle.getString(EXTRA_EXTRA);
-				printBundle(bundle);
+				//printBundle(bundle);
 				if(!"".equals(list_str)&&list_str!=null){
 					JSONObject obj=new JSONObject(list_str);
 					JSONObject litObj=new JSONObject(obj.getString("info"));
@@ -49,9 +48,9 @@ public class MyReceiver extends BroadcastReceiver {
 					title=litObj.has("title")?litObj.getString("title"):"";
 					descript=litObj.has("descript")?litObj.getString("descript"):"";
 					extend=litObj.has("extend")?litObj.getJSONObject("extend")+"":"";
-
+					pushTime=litObj.has("pushTime")?litObj.getString("pushTime"):"";
 					//存入数据库
-					JyMessage oneMsg=new JyMessage(title,content,url,type,0,(int)(System.currentTimeMillis()/1000),openid,descript,extend);
+					JyMessage oneMsg=new JyMessage(title,content,url,type,0,(int)(System.currentTimeMillis()/1000),openid,descript,extend,pushTime);
 					if(DbBase.getInstance(context).insertMessage(oneMsg)){
 						System.out.println("插入推送消息成功");
 					}else{
@@ -64,12 +63,24 @@ public class MyReceiver extends BroadcastReceiver {
 
 		} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
 			Bundle bundle=intent.getExtras();
+			//printBundle(bundle);
 			try{
 				JSONObject obj=new JSONObject(bundle.getString(EXTRA_EXTRA));
 				JSONObject litObj=new JSONObject(obj.getString("info"));
-				String url=litObj.getString("url");
-				DbBase.getInstance(context).updateMessageState(url);
+				String url=litObj.has("url")?litObj.getString("url"):"";
+				String pushTime=litObj.has("pushTime")?litObj.getString("pushTime"):"";
+				String type=obj.getString("type");
+
+				//修改信息为已读信息
+				DbBase.getInstance(context).updateMessageState(pushTime);
 				Intent i = new Intent(context, MainActivity.class);
+
+				//更改url 根据推送事件获取信息id
+				Integer integer=DbBase.getInstance(context).getIDbypushTime(pushTime);
+				if(integer>0){
+					if("".equals(type)&&!"".equals(url)) url=url+integer;
+				}
+
 				i.putExtra("url",url);
 				i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
 				context.startActivity(i);

+ 1 - 1
android/app/src/main/java/com/topsoft/jianyu/SQLite/DBHelper.java

@@ -24,7 +24,7 @@ public class DBHelper extends SQLiteOpenHelper {
 
     // 当第一次创建数据库的时候,调用该方法
     public void onCreate(SQLiteDatabase db) {
-        String sql="create table jy_message (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT,content TEXT,link TEXT,category TEXT,openid TEXT NOT NULL,readed INTEGER,comeintime INTEGER,descript TEXT,extend TEXT)";
+        String sql="create table jy_message (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT,content TEXT,link TEXT,category TEXT,openid TEXT,readed INTEGER,comeintime INTEGER,descript TEXT,extend TEXT,pushTime TEXT)";
         Log.i(TAG, "首次创建数据库");
         db.execSQL(sql);
     }

+ 52 - 27
android/app/src/main/java/com/topsoft/jianyu/SQLite/DbBase.java

@@ -10,11 +10,8 @@ import android.util.Log;
 
 import org.json.JSONArray;
 import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+
 
 import static android.content.Context.MODE_PRIVATE;
 
@@ -32,7 +29,7 @@ public class DbBase {
     private static DbBase dbBase;
     private static Context context;
 
-    private final String LOG_TAG = "JC_WebView";
+    private final String LOG_TAG = "DbBase";
 
     public DbBase(Context context){
         this.context=context;
@@ -84,13 +81,6 @@ public class DbBase {
         DBHelper dbHelper = new DBHelper(context,DB_NAME,null,1);
         SQLiteDatabase db =dbHelper.getReadableDatabase();
         try{
-            //参数1:表名
-            //参数2:要想显示的列
-            //参数3:where子句
-            //参数4:where子句对应的条件值
-            //参数5:分组方式
-            //参数6:having条件
-            //参数7:排序方式
             Cursor cursor = db.query(MASSAHE_TABLE_NAME, new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "id=?", new String[]{id}, null, null, null);
             while(cursor.moveToNext()){
                 msg.put("id",cursor.getInt(cursor.getColumnIndex("id"))+"");
@@ -154,8 +144,11 @@ public class DbBase {
         }
         return result;
     }
-
-    public boolean updateMessageState(String url) {
+    //根据消息的推送时间改变为已读信息
+    public boolean updateMessageState(String pushTime) {
+        if("".equals(pushTime)){
+            return false;
+        }
         boolean result = true;
         DBHelper dbHelper = new DBHelper(context,DB_NAME,null,1);
         SQLiteDatabase db =dbHelper.getWritableDatabase();
@@ -164,8 +157,8 @@ public class DbBase {
             ContentValues cv = new ContentValues();
             cv.put("readed", 1);
 
-            String whereClause = "link=?";
-            String[] whereArgs = {url};
+            String whereClause = "pushTime=?";
+            String[] whereArgs = {pushTime};
             //参数1 是要更新的表名
             //参数2 是一个ContentValeus对象
             //参数3 是where子句
@@ -190,6 +183,30 @@ public class DbBase {
         }
         return result;
     }
+    //根据推送时间获取信息id
+    public Integer getIDbypushTime(String pushTime){
+        Integer id=-1;
+        if("".equals(pushTime)){
+            return id;
+        }
+
+        DBHelper dbHelper = new DBHelper(context,DB_NAME,null,1);
+        SQLiteDatabase db =dbHelper.getReadableDatabase();
+        try{
+            Cursor cursor=db.query(MASSAHE_TABLE_NAME, new String[]{"id"}, "pushTime=?", new String[]{pushTime}, null, null, null);
+            if(cursor.moveToNext()){
+                id=cursor.getInt(cursor.getColumnIndex("id"));
+            }
+            return id;
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            if (null != db) {
+                db.close();
+            }
+        }
+        return id;
+    }
 
     //删除一条信息
     public boolean deleteMessageById(Integer id){
@@ -265,13 +282,17 @@ public class DbBase {
 
     //按通知接收时间倒排,取前100条(或者做分页处理)。
     public JSONArray getMessageList(String openid){
-        //List<Map<String,String>> list=new ArrayList<Map<String,String>>();
         JSONArray list=new JSONArray();
         JSONObject msg=null;
         DBHelper dbHelper = new DBHelper(context,"jy_db",null,1);
         SQLiteDatabase db =dbHelper.getWritableDatabase();
         try{
-            Cursor cursor = db.query("jy_message", new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "openid=?", new String[]{openid}, null, null, "comeintime desc");
+            Cursor cursor=null;
+            if("".equals(openid)){
+                cursor  = db.query("jy_message", new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "openid=?", new String[]{""}, null, null, "comeintime desc");
+            }else{
+                cursor  = db.query("jy_message", new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "openid=? or openid=?", new String[]{openid,""}, null, null, "comeintime desc");
+            }
             int count=0;
             while(cursor.moveToNext()&&count<100){
                 count++;
@@ -300,7 +321,7 @@ public class DbBase {
                 e.printStackTrace();
             }
         }
-        return null;
+        return list;
     }
 
     //获取未读消息数量
@@ -315,7 +336,12 @@ public class DbBase {
             //参数5:分组方式
             //参数6:having条件
             //参数7:排序方式
-            Cursor cursor = db.query(MASSAHE_TABLE_NAME, new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "openid=? and readed=?", new String[]{openid,"0"}, null, null, null);
+            Cursor cursor =null;
+             if("".equals(openid)){
+                 cursor=db.query(MASSAHE_TABLE_NAME, new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "openid=? and readed=?", new String[]{"","0"}, null, null, null);
+             }else{
+                 cursor=db.query(MASSAHE_TABLE_NAME, new String[]{"id","title","content","link","category","openid","readed","comeintime","descript","extend"}, "(openid=? or openid=?)and readed=?", new String[]{openid,"","0"}, null, null, null);
+             }
             return cursor.getCount();
         }catch (Exception e){
             e.printStackTrace();
@@ -324,7 +350,7 @@ public class DbBase {
                 db.close();
             }
         }
-        return -1;
+        return 0;
     }
 
     //所有信息设置为已读
@@ -337,12 +363,11 @@ public class DbBase {
             ContentValues cv = new ContentValues();
             cv.put("readed", 1);
 
-            String whereClause = "openid=?";
-            String[] whereArgs = {openid};
-            //参数1 是要更新的表名
-            //参数2 是一个ContentValeus对象
-            //参数3 是where子句
-            num=db.update(MASSAHE_TABLE_NAME, cv, whereClause, whereArgs);
+            if("".equals(openid)){
+                num=db.update(MASSAHE_TABLE_NAME, cv, "openid=?", new String[]{""});
+            }else{
+                num=db.update(MASSAHE_TABLE_NAME, cv, "openid=? or openid=?", new String[]{openid,""});
+            }
             if (num>0) {
                 db.setTransactionSuccessful();
             }

+ 13 - 4
android/app/src/main/java/com/topsoft/jianyu/SQLite/JyMessage.java

@@ -18,6 +18,7 @@ public class JyMessage {
     private String openid;  //用户标识
     private String descript; //描述
     private String extend;  //扩展字段
+    private String pushTime; //推送时间
 
     public Integer getId() {
         return id;
@@ -99,6 +100,14 @@ public class JyMessage {
         this.extend = extend;
     }
 
+    public String getPushTime() {
+        return pushTime;
+    }
+
+    public void setPushTime(String pushTime) {
+        this.pushTime = pushTime;
+    }
+
     public JyMessage(){}
 
     /**
@@ -113,7 +122,7 @@ public class JyMessage {
      * @param descript    描述
      * @param extend    扩展字段
      */
-    public JyMessage(String title, String content, String link, String category, Integer readed, Integer comeintime, String openid,String descript,String extend) {
+    public JyMessage(String title, String content, String link, String category, Integer readed, Integer comeintime, String openid,String descript,String extend,String pushTime) {
         this.title = title;
         this.content = content;
         this.link = link;
@@ -123,6 +132,7 @@ public class JyMessage {
         this.openid = openid;
         this.descript=descript;
         this.extend=extend;
+        this.pushTime=pushTime;
     }
 
     public ContentValues getMsaagesContentValues(){
@@ -135,9 +145,8 @@ public class JyMessage {
         cv.put("readed", readed);
         cv.put("comeintime", comeintime);
         cv.put("descript",descript);
-        if(!"".equals(openid)&&openid!=null){
-            cv.put("openid",openid);
-        }
+        cv.put("openid",openid);
+        cv.put("pushTime",pushTime);
         return cv;
     }
 }

+ 1 - 6
android/app/src/main/java/com/topsoft/jianyu/appUpdate/UpdateVersionController.java

@@ -5,8 +5,6 @@ import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Environment;
@@ -25,13 +23,10 @@ import com.ccit.www.mobileshieldsdk.okutils.okhttputils.callback.StringCallback;
 import com.topsoft.jianyu.R;
 import com.topsoft.jianyu.util.AppUtil;
 import com.topsoft.jianyu.util.LoadingUtils;
-
-import org.json.JSONArray;
 import org.json.JSONObject;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
+
 
 /**
  * Created by wanghuidong on 2017/11/1.

+ 5 - 22
android/app/src/main/java/com/topsoft/jianyu/listener/CustomLoginListerner.java

@@ -6,6 +6,7 @@ import android.content.Context;
 import android.content.SharedPreferences;
 import android.util.Log;
 import android.webkit.WebView;
+import android.widget.Toast;
 
 import com.ccit.www.mobileshieldsdk.gsonutil.JsonObject;
 import com.topsoft.jianyu.MainActivity;
@@ -86,11 +87,7 @@ public class CustomLoginListerner implements UMAuthListener {
         userMsg.addProperty("unionid",unionid);
         userMsg.addProperty("sign",sign);
 
-
-
         userToken=StringUtil.getBase64(userMsg.toString());
-        //System.out.println(userMsg.toString());
-        //System.out.println(userToken);
 
         if(!"".equals(openid)&&openid!=null){
             webView.post(new Runnable() {
@@ -101,29 +98,15 @@ public class CustomLoginListerner implements UMAuthListener {
             });
 
         }
-
-        /*//获取用户信息
-        String msg="";
-        System.out.println("============================用户信息====================================");
-
-        for (Map.Entry<String, String> entry : map.entrySet()) {
-            msg+="Key = " + entry.getKey() + ", Value = " + entry.getValue()+"\n";
-            System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
-
-        }
-        System.out.println("============================用户信息结束====================================");
-        webView.post(new Runnable() {
-            @Override
-            public void run() {
-                webView.loadUrl("javascript:callBackAlertMethod('用户openid:"+map.get("openid")+"')");
-            }
-        });*/
     }
 
     @Override
     public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {
         LoadingUtils.closeDialog(dialog);
-        Log.e(LOG_TAG,"登录出错:"+throwable.getMessage());
+        Log.e(LOG_TAG,"登录出错"+i+":"+throwable.getMessage());
+        if(i==0){//没有安装app  i=0
+            Toast.makeText(context,"微信登录失败,没有安装微信",Toast.LENGTH_SHORT).show();
+        }
     }
 
     @Override

+ 1 - 0
android/app/src/main/java/com/topsoft/jianyu/util/AppUtil.java

@@ -24,6 +24,7 @@ public class AppUtil {
 
     public static String JPUSH_CLIENT_RGSID;//记录极光推送客户端id
     public static String AppUrl="http://webwcj.qmx.top";
+    //public static String AppUrl="http://w2blmjy.qmx.top";
     /**
      * 判断当前应用是否是debug状态
      */

BIN
android/app/src/main/res/drawable-hdpi/border_bg.9.png


BIN
android/app/src/main/res/drawable-hdpi/bottom_bg.9.png


+ 8 - 0
android/app/src/main/res/drawable-hdpi/corners_bg.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">  
+    <solid android:color="#fff" />  
+    <corners android:topLeftRadius="10dp" 
+                    android:topRightRadius="10dp"  
+                android:bottomRightRadius="10dp" 
+                android:bottomLeftRadius="10dp"/>  
+</shape>

BIN
android/app/src/main/res/drawable-hdpi/ic_launcher.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_notification_icon.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_notification_icon1.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_notification_icon2.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_notification_icon3.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_notification_icon4.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_notification_icon5.png


BIN
android/app/src/main/res/drawable-hdpi/jpush_notification_icon7.png


+ 21 - 0
android/app/src/main/res/drawable-hdpi/richpush_btn_selector.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<selector xmlns:android="http://schemas.android.com/apk/res/android" > 
+    <!-- 获得焦点但未按下时的背景图片 --> 
+    <item 
+        android:state_focused="true" 
+        android:state_enabled="true" 
+        android:state_pressed="false" 
+        android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
+     <!-- 按下时的背景图片 --> 
+    <item 
+        android:state_enabled="true" 
+        android:state_pressed="true" 
+        android:drawable="@android:color/darker_gray" /> 
+    <!-- 按下时的背景图片 --> 
+    <item 
+        android:state_enabled="true" 
+        android:state_checked="true" 
+        android:drawable="@android:color/darker_gray" /> 
+    <!-- 默认时的背景图片 --> 
+    <item android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
+</selector> 

+ 20 - 0
android/app/src/main/res/drawable-hdpi/richpush_progressbar.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <!-- 背景  gradient是渐变,corners定义的是圆角 -->
+    <item android:id="@android:id/background">
+        <shape>
+            <solid android:color="#ffffff" />
+        </shape>
+    </item>
+    
+    <!-- 进度条 -->
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape>
+                <solid android:color="#4393ea" />
+            </shape>
+        </clip>
+    </item>
+
+</layer-list>

BIN
android/app/src/main/res/drawable-hdpi/stripes.png


+ 4 - 0
android/app/src/main/res/drawable-hdpi/tiledstripes.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/stripes" 
+    android:tileMode="repeat" />

BIN
android/app/src/main/res/drawable-hdpi/top_bg.9.png


BIN
android/app/src/main/res/drawable/share_thumb_img.jpeg


BIN
android/app/src/main/res/drawable/share_thumb_img.png


+ 2 - 2
android/app/src/main/res/layout/activity_main.xml

@@ -15,10 +15,10 @@
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         android:orientation="vertical"></LinearLayout>
-    <Button
+<!--    <Button
         android:id="@+id/test"
         android:layout_width="100dp"
         android:layout_height="40dp"
         android:text="测试按钮"
-        />
+        />-->
 </android.support.constraint.ConstraintLayout>

BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png