细节优化
parent
985ec8f999
commit
574341ff63
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
// 先判断商品库存是否不足
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -721,8 +721,8 @@ App({
|
|||
set_nav_bg_color_main() {
|
||||
// 窗口和下拉顶部背景色
|
||||
my.setBackgroundColor({
|
||||
backgroundColor: '#d2364c',
|
||||
backgroundColorTop: '#d2364c',
|
||||
backgroundColorBottom: '#f5f5f5',
|
||||
});
|
||||
|
||||
// 下拉文字颜色
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@
|
|||
],
|
||||
"window": {
|
||||
"defaultTitle": "shopxo",
|
||||
"titleBarColor": "#d2364c"
|
||||
"titleBarColor": "#d2364c",
|
||||
"backgroundColor": "#f5f5f5"
|
||||
},
|
||||
"tabBar": {
|
||||
"textColor": "#8a8a8a",
|
||||
|
|
|
|||
|
|
@ -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() });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
|
@ -32,7 +32,9 @@
|
|||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "{{application_title}}",
|
||||
"navigationBarBackgroundColor": "#d2364c"
|
||||
"navigationBarBackgroundColor": "#d2364c",
|
||||
"backgroundColor": "#f5f5f5",
|
||||
"backgroundColorBottom": "#f5f5f5"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#8a8a8a",
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#d2364c",
|
||||
"backgroundColorTop": "#d2364c",
|
||||
"usingComponents": {
|
||||
"component-icon-nav": "/components/icon-nav/icon-nav",
|
||||
"component-banner": "/components/slider/slider"
|
||||
|
|
|
|||
|
|
@ -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'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"usingComponents": {
|
||||
"component-badge": "/components/badge/badge"
|
||||
}
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#d2364c",
|
||||
"backgroundColorTop": "#d2364c",
|
||||
"usingComponents": {
|
||||
"component-badge": "/components/badge/badge"
|
||||
}
|
||||
}
|
||||
|
|
@ -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}}",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#1d1611",
|
||||
"backgroundColor": "#1d1611"
|
||||
"backgroundColorTop": "#1d1611"
|
||||
}
|
||||
Loading…
Reference in New Issue