From 574341ff632a753cab974007d01a7afdf9f14cb1 Mon Sep 17 00:00:00 2001 From: devil Date: Tue, 7 Jan 2020 15:32:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/User.php | 2 + application/service/BuyService.php | 19 ++++++++-- application/service/OrderService.php | 8 ++-- extend/base/BaiduAuth.php | 4 ++ public/appmini/old/alipay/app.js | 2 +- public/appmini/old/alipay/app.json | 3 +- public/appmini/old/baidu/app.js | 38 ++++++++++++++++++- public/appmini/old/baidu/app.json | 4 +- public/appmini/old/baidu/pages/cart/cart.js | 16 ++++++++ public/appmini/old/baidu/pages/index/index.js | 9 +++++ .../appmini/old/baidu/pages/index/index.json | 2 + public/appmini/old/baidu/pages/user/user.js | 8 ++++ public/appmini/old/baidu/pages/user/user.json | 10 +++-- public/appmini/old/weixin/app.js | 2 +- public/appmini/old/weixin/app.json | 6 ++- .../appmini/old/weixin/pages/index/index.json | 2 +- .../plugins/membershiplevelvip/user/user.json | 2 +- 17 files changed, 116 insertions(+), 21 deletions(-) diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 1cd41b438..ce5e97242 100755 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -306,6 +306,8 @@ class User extends Common $result['openid'] = $result['data']['openid']; $result['referrer']= isset($this->data_post['referrer']) ? $this->data_post['referrer'] : 0; return UserService::AuthUserProgram($result, 'baidu_openid'); + } else { + return DataReturn($result['msg'], -1); } } else { return DataReturn('授权成功', 0, $user); diff --git a/application/service/BuyService.php b/application/service/BuyService.php index 6607a5ba1..074ed557c 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -1305,7 +1305,7 @@ class BuyService } /** - * 库存校验 + * 订单支付前校验 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 @@ -1313,7 +1313,7 @@ class BuyService * @desc description * @param [array] $params [输入参数] */ - public static function OrderInventoryCheck($params = []) + public static function OrderPayBeginCheck($params = []) { // 请求参数 $p = [ @@ -1352,7 +1352,20 @@ class BuyService { foreach($order_detail as $v) { - $goods = Db::name('Goods')->field('is_deduction_inventory,inventory,title')->find($v['goods_id']); + // 获取商品 + $goods = Db::name('Goods')->field('is_shelves,is_deduction_inventory,inventory,title')->find($v['goods_id']); + if(empty($goods)) + { + return DataReturn('商品不存在', -10); + } + + // 商品状态 + if($goods['is_shelves'] != 1) + { + return DataReturn('商品已下架['.$goods['title'].']', -10); + } + + // 库存 if(isset($goods['is_deduction_inventory']) && $goods['is_deduction_inventory'] == 1) { // 先判断商品库存是否不足 diff --git a/application/service/OrderService.php b/application/service/OrderService.php index 9b665c521..198091bd7 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -72,8 +72,8 @@ class OrderService return DataReturn('状态不可操作['.$status_text.']', -1); } - // 库存校验 - $ret = BuyService::OrderInventoryCheck(['order_id'=>$order['id'], 'order_data'=>$order]); + // 订单支付前校验 + $ret = BuyService::OrderPayBeginCheck(['order_id'=>$order['id'], 'order_data'=>$order]); if($ret['code'] != 0) { return $ret; @@ -263,8 +263,8 @@ class OrderService return DataReturn('状态不可操作['.$status_text.']', -1); } - // 库存校验 - $ret = BuyService::OrderInventoryCheck(['order_id'=>$order['id'], 'order_data'=>$order]); + // 订单支付前校验 + $ret = BuyService::OrderPayBeginCheck(['order_id'=>$order['id'], 'order_data'=>$order]); if($ret['code'] != 0) { return $ret; diff --git a/extend/base/BaiduAuth.php b/extend/base/BaiduAuth.php index 93347db79..28e101914 100755 --- a/extend/base/BaiduAuth.php +++ b/extend/base/BaiduAuth.php @@ -79,6 +79,10 @@ class BaiduAuth if (function_exists("openssl_decrypt")) { $plaintext = openssl_decrypt($encrypted_data, "AES-192-CBC", $session_key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); } else { + if(!function_exists('mcrypt_module_open')) + { + return ['status'=>-1, 'msg'=>'mcrypt_module_open方法不支持']; + } $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, null, MCRYPT_MODE_CBC, null); mcrypt_generic_init($td, $session_key, $iv); $plaintext = mdecrypt_generic($td, $encrypted_data); diff --git a/public/appmini/old/alipay/app.js b/public/appmini/old/alipay/app.js index 92b5b6f8d..1985c5fe8 100644 --- a/public/appmini/old/alipay/app.js +++ b/public/appmini/old/alipay/app.js @@ -721,8 +721,8 @@ App({ set_nav_bg_color_main() { // 窗口和下拉顶部背景色 my.setBackgroundColor({ - backgroundColor: '#d2364c', backgroundColorTop: '#d2364c', + backgroundColorBottom: '#f5f5f5', }); // 下拉文字颜色 diff --git a/public/appmini/old/alipay/app.json b/public/appmini/old/alipay/app.json index 6ae2b52fe..1650530e8 100644 --- a/public/appmini/old/alipay/app.json +++ b/public/appmini/old/alipay/app.json @@ -32,7 +32,8 @@ ], "window": { "defaultTitle": "shopxo", - "titleBarColor": "#d2364c" + "titleBarColor": "#d2364c", + "backgroundColor": "#f5f5f5" }, "tabBar": { "textColor": "#8a8a8a", diff --git a/public/appmini/old/baidu/app.js b/public/appmini/old/baidu/app.js index b9fe4369f..60fdef700 100755 --- a/public/appmini/old/baidu/app.js +++ b/public/appmini/old/baidu/app.js @@ -62,8 +62,8 @@ App({ // 请求地址 request_url: "{{request_url}}", - // request_url: 'http://tp5-dev.com/', - // request_url: 'https://dev.shopxo.net/', + request_url: 'http://shopxo.com/', + request_url: 'https://dev.shopxo.net/', // 基础信息 application_title: "{{application_title}}", @@ -623,4 +623,38 @@ App({ return true; }, + /** + * 设置导航reddot + * index tabBar 的哪一项,从左边算起(0开始) + * type 0 移出, 1 添加 (默认 0 移出) + */ + set_tab_bar_reddot(index, type) { + if (index !== undefined && index !== null) + { + if ((type || 0) == 0) + { + swan.hideTabBarRedDot({ index: Number(index) }); + } else { + swan.showTabBarRedDot({ index: Number(index) }); + } + } + }, + + /** + * 设置导航车badge + * index tabBar 的哪一项,从左边算起(0开始) + * type 0 移出, 1 添加 (默认 0 移出) + * value 显示的文本,超过 4 个字符则显示成 ...(type参数为1的情况下有效) + */ + set_tab_bar_badge(index, type, value) { + if (index !== undefined && index !== null) + { + if ((type || 0) == 0) { + swan.removeTabBarBadge({ index: Number(index) }); + } else { + swan.setTabBarBadge({ index: Number(index), "text": value.toString() }); + } + } + }, + }); \ No newline at end of file diff --git a/public/appmini/old/baidu/app.json b/public/appmini/old/baidu/app.json index 27be7a63b..9270d59fc 100755 --- a/public/appmini/old/baidu/app.json +++ b/public/appmini/old/baidu/app.json @@ -32,7 +32,9 @@ ], "window": { "navigationBarTitleText": "{{application_title}}", - "navigationBarBackgroundColor": "#d2364c" + "navigationBarBackgroundColor": "#d2364c", + "backgroundColor": "#f5f5f5", + "backgroundColorBottom": "#f5f5f5" }, "tabBar": { "color": "#8a8a8a", diff --git a/public/appmini/old/baidu/pages/cart/cart.js b/public/appmini/old/baidu/pages/cart/cart.js index 4f27d9095..14f9f79b4 100755 --- a/public/appmini/old/baidu/pages/cart/cart.js +++ b/public/appmini/old/baidu/pages/cart/cart.js @@ -89,6 +89,14 @@ Page({ common_is_exhibition_mode_btn_text: data.common_is_exhibition_mode_btn_text || '立即咨询', customer_service_tel: data.customer_service_tel || null, }); + + // 导航购物车处理 + var cart_total = data.common_cart_total || 0; + if (cart_total <= 0) { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } } else { this.setData({ data_list_loding_status: 2, @@ -260,6 +268,14 @@ Page({ data_list_loding_status: temp_data_list.length == 0 ? 0 : this.data.data_list_loding_status }); + // 导航购物车处理 + var cart_total = res.data.data || 0; + if (cart_total <= 0) { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } + app.showToast(type == 'delete' ? '删除成功' : '收藏成功', 'success'); } else { if (app.is_login_check(res.data)) { diff --git a/public/appmini/old/baidu/pages/index/index.js b/public/appmini/old/baidu/pages/index/index.js index ba1a564d8..9f43758ff 100755 --- a/public/appmini/old/baidu/pages/index/index.js +++ b/public/appmini/old/baidu/pages/index/index.js @@ -61,6 +61,15 @@ Page({ plugins_limitedtimediscount_data: data.plugins_limitedtimediscount_data || null }); + // 导航购物车处理 + var cart_total = data.common_cart_total || 0; + if (cart_total <= 0) + { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } + // 限时秒杀倒计时 if (this.data.common_app_is_limitedtimediscount == 1 && this.data.plugins_limitedtimediscount_data != null) { this.plugins_limitedtimediscount_countdown(); diff --git a/public/appmini/old/baidu/pages/index/index.json b/public/appmini/old/baidu/pages/index/index.json index b3298e1be..facc6d737 100755 --- a/public/appmini/old/baidu/pages/index/index.json +++ b/public/appmini/old/baidu/pages/index/index.json @@ -1,5 +1,7 @@ { "enablePullDownRefresh": true, + "navigationBarBackgroundColor": "#d2364c", + "backgroundColorTop": "#d2364c", "usingComponents": { "component-icon-nav": "/components/icon-nav/icon-nav", "component-banner": "/components/slider/slider" diff --git a/public/appmini/old/baidu/pages/user/user.js b/public/appmini/old/baidu/pages/user/user.js index d0b4e2298..538fdf7ea 100755 --- a/public/appmini/old/baidu/pages/user/user.js +++ b/public/appmini/old/baidu/pages/user/user.js @@ -112,6 +112,14 @@ Page({ common_app_is_online_service: data.common_app_is_online_service || 0, common_app_is_head_vice_nav: data.common_app_is_head_vice_nav || 0, }); + + // 导航购物车处理 + var cart_total = data.common_cart_total || 0; + if (cart_total <= 0) { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } } else { if(app.is_login_check(res.data, this, 'get_data')) { diff --git a/public/appmini/old/baidu/pages/user/user.json b/public/appmini/old/baidu/pages/user/user.json index 1e8b450ba..daa19778d 100755 --- a/public/appmini/old/baidu/pages/user/user.json +++ b/public/appmini/old/baidu/pages/user/user.json @@ -1,6 +1,8 @@ { - "enablePullDownRefresh": true, - "usingComponents": { - "component-badge": "/components/badge/badge" - } + "enablePullDownRefresh": true, + "navigationBarBackgroundColor": "#d2364c", + "backgroundColorTop": "#d2364c", + "usingComponents": { + "component-badge": "/components/badge/badge" + } } \ No newline at end of file diff --git a/public/appmini/old/weixin/app.js b/public/appmini/old/weixin/app.js index 77ee670da..01ef8f136 100755 --- a/public/appmini/old/weixin/app.js +++ b/public/appmini/old/weixin/app.js @@ -71,7 +71,7 @@ App({ // 请求地址 request_url: "{{request_url}}", request_url: 'http://shopxo.com/', - // request_url: 'https://dev.shopxo.net/', + request_url: 'https://dev.shopxo.net/', // 基础信息 application_title: "{{application_title}}", diff --git a/public/appmini/old/weixin/app.json b/public/appmini/old/weixin/app.json index 9cf18dae1..01dcc5b14 100755 --- a/public/appmini/old/weixin/app.json +++ b/public/appmini/old/weixin/app.json @@ -1,6 +1,6 @@ { "pages": [ - "pages/plugins/membershiplevelvip/order/order", + "pages/index/index", "pages/goods-category/goods-category", "pages/cart/cart", @@ -36,7 +36,9 @@ ], "window": { "navigationBarTitleText": "{{application_title}}", - "navigationBarBackgroundColor": "#d2364c" + "navigationBarBackgroundColor": "#d2364c", + "backgroundColor": "#f5f5f5", + "backgroundColorBottom": "#f5f5f5" }, "tabBar": { "color": "#8a8a8a", diff --git a/public/appmini/old/weixin/pages/index/index.json b/public/appmini/old/weixin/pages/index/index.json index d98684c7d..facc6d737 100755 --- a/public/appmini/old/weixin/pages/index/index.json +++ b/public/appmini/old/weixin/pages/index/index.json @@ -1,7 +1,7 @@ { "enablePullDownRefresh": true, "navigationBarBackgroundColor": "#d2364c", - "backgroundColor": "#d2364c", + "backgroundColorTop": "#d2364c", "usingComponents": { "component-icon-nav": "/components/icon-nav/icon-nav", "component-banner": "/components/slider/slider" diff --git a/public/appmini/old/weixin/pages/plugins/membershiplevelvip/user/user.json b/public/appmini/old/weixin/pages/plugins/membershiplevelvip/user/user.json index d7bf94c8d..13fbbe252 100644 --- a/public/appmini/old/weixin/pages/plugins/membershiplevelvip/user/user.json +++ b/public/appmini/old/weixin/pages/plugins/membershiplevelvip/user/user.json @@ -1,5 +1,5 @@ { "enablePullDownRefresh": true, "navigationBarBackgroundColor": "#1d1611", - "backgroundColor": "#1d1611" + "backgroundColorTop": "#1d1611" } \ No newline at end of file -- GitLab