提交 36e22ff6 编写于 作者: D Devil

接口统一返回处理

上级 e4032fc2
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\AnswerService; use app\service\AnswerService;
/** /**
...@@ -72,11 +73,11 @@ class Answer extends Common ...@@ -72,11 +73,11 @@ class Answer extends Common
// 返回数据 // 返回数据
$result = [ $result = [
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $data['data'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\BannerService; use app\service\BannerService;
/** /**
...@@ -44,10 +45,8 @@ class Banner extends Common ...@@ -44,10 +45,8 @@ class Banner extends Common
public function Index() public function Index()
{ {
// 获取轮播 // 获取轮播
$data = BannerService::Banner(); $result = BannerService::Banner();
return BaseService::DataReturn($result);
// 返回数据
return DataReturn('success', 0, $data);
} }
} }
?> ?>
\ No newline at end of file
...@@ -35,7 +35,7 @@ class Base extends Common ...@@ -35,7 +35,7 @@ class Base extends Common
// 参数 // 参数
$params = $this->data_post; $params = $this->data_post;
$params['user'] = $this->user; $params['user'] = $this->user;
return DataReturn('success', 0, BaseService::Common($params)); return BaseService::Common($params);
} }
} }
?> ?>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\GoodsService; use app\service\GoodsService;
use app\service\UserService; use app\service\UserService;
use app\service\PaymentService; use app\service\PaymentService;
...@@ -67,10 +68,10 @@ class Buy extends Common ...@@ -67,10 +68,10 @@ class Buy extends Common
// 数据返回组装 // 数据返回组装
$result = [ $result = [
'goods_list' => $buy_goods, 'goods_list' => $buy_goods,
'payment_list' => $payment_list, 'payment_list' => $payment_list,
'base' => $buy_base, 'base' => $buy_base,
'common_site_type' => (int) $buy_base['common_site_type'], 'common_site_type' => (int) $buy_base['common_site_type'],
]; ];
// 优惠劵 // 优惠劵
...@@ -87,7 +88,7 @@ class Buy extends Common ...@@ -87,7 +88,7 @@ class Buy extends Common
$result['plugins_points_data'] = $ret['data']['data']; $result['plugins_points_data'] = $ret['data']['data'];
} }
return DataReturn('操作成功', 0, $result); return BaseService::DataReturn($result);
} }
return $buy_ret; return $buy_ret;
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\BuyService; use app\service\BuyService;
/** /**
...@@ -47,12 +48,12 @@ class Cart extends Common ...@@ -47,12 +48,12 @@ class Cart extends Common
public function Index() public function Index()
{ {
$ret = BuyService::CartList(['user'=>$this->user]); $ret = BuyService::CartList(['user'=>$this->user]);
$ret['data'] = [ $result = [
'data' => $ret['data'], 'data' => $ret['data'],
'common_cart_total' => BuyService::UserCartTotal(['user'=>$this->user]), 'common_cart_total' => BuyService::UserCartTotal(['user'=>$this->user]),
]; ];
return $ret; return BaseService::DataReturn($result);
} }
/** /**
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\GoodsService; use app\service\GoodsService;
use app\service\BuyService; use app\service\BuyService;
use app\service\PluginsService; use app\service\PluginsService;
...@@ -166,7 +167,7 @@ class Goods extends Common ...@@ -166,7 +167,7 @@ class Goods extends Common
$result['plugins_coupon_data'] = $ret['data']['data']; $result['plugins_coupon_data'] = $ret['data']['data'];
} }
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
...@@ -239,10 +240,9 @@ class Goods extends Common ...@@ -239,10 +240,9 @@ class Goods extends Common
public function Category() public function Category()
{ {
$result = [ $result = [
'category' => GoodsService::GoodsCategoryAll($this->data_post), 'category' => GoodsService::GoodsCategoryAll($this->data_post),
//'category_show_level' => MyC('common_show_goods_category_level', 3, true),
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
...@@ -299,16 +299,16 @@ class Goods extends Common ...@@ -299,16 +299,16 @@ class Goods extends Common
'where' => $where, 'where' => $where,
'is_public' => 1, 'is_public' => 1,
); );
$data = GoodsCommentsService::GoodsCommentsList($data_params); $ret = GoodsCommentsService::GoodsCommentsList($data_params);
// 返回数据 // 返回数据
$result = [ $result = [
'number' => $number, 'number' => $number,
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $ret['data'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
} }
?> ?>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\GoodsService; use app\service\GoodsService;
use app\service\BannerService; use app\service\BannerService;
use app\service\AppHomeNavService; use app\service\AppHomeNavService;
...@@ -64,7 +65,7 @@ class Index extends Common ...@@ -64,7 +65,7 @@ class Index extends Common
} }
// 返回数据 // 返回数据
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
} }
?> ?>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\MessageService; use app\service\MessageService;
/** /**
...@@ -75,11 +76,11 @@ class Message extends Common ...@@ -75,11 +76,11 @@ class Message extends Common
// 返回数据 // 返回数据
$result = [ $result = [
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $data['data'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
} }
?> ?>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\AppHomeNavService; use app\service\AppHomeNavService;
/** /**
...@@ -44,10 +45,8 @@ class Navigation extends Common ...@@ -44,10 +45,8 @@ class Navigation extends Common
public function Index() public function Index()
{ {
// 获取轮播 // 获取轮播
$data = AppHomeNavService::AppHomeNav(); $result = AppHomeNavService::AppHomeNav();
return BaseService::DataReturn($result);
// 返回数据
return DataReturn('success', 0, $data);
} }
} }
?> ?>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\PaymentService; use app\service\PaymentService;
use app\service\OrderService; use app\service\OrderService;
use app\service\GoodsCommentsService; use app\service\GoodsCommentsService;
...@@ -80,12 +81,12 @@ class Order extends Common ...@@ -80,12 +81,12 @@ class Order extends Common
// 返回数据 // 返回数据
$result = [ $result = [
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $data['data'],
'payment_list' => $payment_list, 'payment_list' => $payment_list,
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
...@@ -131,7 +132,7 @@ class Order extends Common ...@@ -131,7 +132,7 @@ class Order extends Common
$site_fictitious = ConfigService::SiteFictitiousConfig(); $site_fictitious = ConfigService::SiteFictitiousConfig();
$result['site_fictitious'] = $site_fictitious['data']; $result['site_fictitious'] = $site_fictitious['data'];
} }
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
return DataReturn('数据不存在或已删除', -100); return DataReturn('数据不存在或已删除', -100);
} }
...@@ -178,7 +179,7 @@ class Order extends Common ...@@ -178,7 +179,7 @@ class Order extends Common
'data' => $data['data'][0], 'data' => $data['data'][0],
'editor_path_type' => 'order_comments-'.$this->user['id'].'-'.$data['data'][0]['id'], 'editor_path_type' => 'order_comments-'.$this->user['id'].'-'.$data['data'][0]['id'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
return DataReturn('没有相关数据', -100); return DataReturn('没有相关数据', -100);
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\OrderAftersaleService; use app\service\OrderAftersaleService;
/** /**
...@@ -75,11 +76,11 @@ class Orderaftersale extends Common ...@@ -75,11 +76,11 @@ class Orderaftersale extends Common
// 返回数据 // 返回数据
$result = [ $result = [
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $data['data'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
...@@ -139,7 +140,7 @@ class Orderaftersale extends Common ...@@ -139,7 +140,7 @@ class Orderaftersale extends Common
'return_goods_address' => MyC('home_order_aftersale_return_goods_address', '管理员未填写', true), 'return_goods_address' => MyC('home_order_aftersale_return_goods_address', '管理员未填写', true),
'editor_path_type' => OrderAftersaleService::EditorAttachmentPathType($this->user['id'], $order_id, $order_detail_id), 'editor_path_type' => OrderAftersaleService::EditorAttachmentPathType($this->user['id'], $order_id, $order_detail_id),
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
return DataReturn($ret['msg'], -1); return DataReturn($ret['msg'], -1);
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\RegionService; use app\service\RegionService;
/** /**
...@@ -50,8 +51,8 @@ class Region extends Common ...@@ -50,8 +51,8 @@ class Region extends Common
'pid' => isset($this->data_post['pid']) ? intval($this->data_post['pid']) : 0, 'pid' => isset($this->data_post['pid']) ? intval($this->data_post['pid']) : 0,
], ],
]; ];
$data = RegionService::RegionNode($params); $result = RegionService::RegionNode($params);
return DataReturn('success', 0, $data); return BaseService::DataReturn($result);
} }
/** /**
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\SearchService; use app\service\SearchService;
use app\service\GoodsService; use app\service\GoodsService;
...@@ -51,16 +52,12 @@ class Search extends Common ...@@ -51,16 +52,12 @@ class Search extends Common
// 获取数据 // 获取数据
$ret = SearchService::GoodsList($this->data_post); $ret = SearchService::GoodsList($this->data_post);
$result = $ret['data'];
// 分类 // 分类
if(!empty($this->data_post['category_id'])) $result['category'] = empty($this->data_post['category_id']) ? [] : GoodsService::GoodsCategoryRow(['id'=>$this->data_post['category_id']]);
{
$ret['data']['category'] = GoodsService::GoodsCategoryRow(['id'=>$this->data_post['category_id']]);
} else {
$ret['data']['category'] = [];
}
return $ret; return BaseService::DataReturn($result);
} }
} }
?> ?>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\ToutiaoService; use app\service\ToutiaoService;
/** /**
...@@ -50,7 +51,8 @@ class Toutiao extends Common ...@@ -50,7 +51,8 @@ class Toutiao extends Common
// 获取支付信息 // 获取支付信息
$params = $this->data_post; $params = $this->data_post;
$params['user'] = $this->user; $params['user'] = $this->user;
return ToutiaoService::Pay($params); $ret = ToutiaoService::Pay($params);
return BaseService::DataReturn($ret['data']);
} }
} }
?> ?>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\UserService; use app\service\UserService;
use app\service\OrderService; use app\service\OrderService;
use app\service\GoodsService; use app\service\GoodsService;
...@@ -548,7 +549,7 @@ class User extends Common ...@@ -548,7 +549,7 @@ class User extends Common
); );
// 返回数据 // 返回数据
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
......
...@@ -10,8 +10,9 @@ ...@@ -10,8 +10,9 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\UserAddressService; use app\service\BaseService;
use app\service\ConfigService; use app\service\ConfigService;
use app\service\UserAddressService;
/** /**
* 用户地址 * 用户地址
...@@ -48,7 +49,11 @@ class UserAddress extends Common ...@@ -48,7 +49,11 @@ class UserAddress extends Common
*/ */
public function Index() public function Index()
{ {
return UserAddressService::UserAddressList(['user'=>$this->user]); $ret = UserAddressService::UserAddressList(['user'=>$this->user]);
$result = [
'data' => $ret['data'],
];
return BaseService::DataReturn($result);
} }
/** /**
...@@ -70,7 +75,7 @@ class UserAddress extends Common ...@@ -70,7 +75,7 @@ class UserAddress extends Common
'data' => empty($data['data']) ? null : $data['data'], 'data' => empty($data['data']) ? null : $data['data'],
'editor_path_type' => UserAddressService::EditorAttachmentPathType($this->user['id']), 'editor_path_type' => UserAddressService::EditorAttachmentPathType($this->user['id']),
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\GoodsBrowseService; use app\service\GoodsBrowseService;
/** /**
...@@ -73,11 +74,11 @@ class UserGoodsBrowse extends Common ...@@ -73,11 +74,11 @@ class UserGoodsBrowse extends Common
// 返回数据 // 返回数据
$result = [ $result = [
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $data['data'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\GoodsFavorService; use app\service\GoodsFavorService;
/** /**
...@@ -72,11 +73,11 @@ class UserGoodsFavor extends Common ...@@ -72,11 +73,11 @@ class UserGoodsFavor extends Common
// 返回数据 // 返回数据
$result = [ $result = [
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $data['data'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
/** /**
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\api\controller; namespace app\api\controller;
use app\service\BaseService;
use app\service\IntegralService; use app\service\IntegralService;
/** /**
...@@ -73,11 +74,11 @@ class UserIntegral extends Common ...@@ -73,11 +74,11 @@ class UserIntegral extends Common
// 返回数据 // 返回数据
$result = [ $result = [
'total' => $total, 'total' => $total,
'page_total' => $page_total, 'page_total' => $page_total,
'data' => $data['data'], 'data' => $data['data'],
]; ];
return DataReturn('success', 0, $result); return BaseService::DataReturn($result);
} }
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\service; namespace app\service;
use think\Db;
use think\facade\Hook; use think\facade\Hook;
use app\service\ResourcesService; use app\service\ResourcesService;
use app\service\QuickNavService; use app\service\QuickNavService;
...@@ -108,7 +107,34 @@ class BaseService ...@@ -108,7 +107,34 @@ class BaseService
'params' => $params, 'params' => $params,
]); ]);
return $data; return DataReturn('success', 0, $data);
}
/**
* 数据返回处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-01-06
* @desc description
* @param [array] $data [返回数据]
*/
public static function DataReturn($data = [])
{
// 当前操作名称, 兼容插件模块名称
$module_name = strtolower(request()->module());
$controller_name = strtolower(request()->controller());
$action_name = strtolower(request()->action());
// 接口返回信息钩子
$hook_name = 'plugins_service_base_return_data_'.$module_name.'_'.$controller_name.'_'.$action_name;
Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'data' => &$data,
]);
return DataReturn('success', 0, $data);
} }
} }
?> ?>
\ No newline at end of file
...@@ -58,20 +58,21 @@ Page({ ...@@ -58,20 +58,21 @@ Page({
my.hideLoading(); my.hideLoading();
my.stopPullDownRefresh(); my.stopPullDownRefresh();
if (res.data.code == 0) { if (res.data.code == 0) {
if (res.data.data.length > 0) { var data = res.data.data;
if (data.data.length > 0) {
// 获取当前默认地址 // 获取当前默认地址
var is_default = 0; var is_default = 0;
for(var i in res.data.data) for(var i in data.data)
{ {
if(res.data.data[i]['is_default'] == 1) if(data.data[i]['is_default'] == 1)
{ {
is_default = res.data.data[i]['id']; is_default = data.data[i]['id'];
} }
} }
// 设置数据 // 设置数据
this.setData({ this.setData({
data_list: res.data.data, data_list: data.data,
is_default: is_default, is_default: is_default,
data_list_loding_status: 3, data_list_loding_status: 3,
data_bottom_line_status: true, data_bottom_line_status: true,
......
...@@ -57,18 +57,19 @@ Page({ ...@@ -57,18 +57,19 @@ Page({
swan.hideLoading(); swan.hideLoading();
swan.stopPullDownRefresh(); swan.stopPullDownRefresh();
if (res.data.code == 0) { if (res.data.code == 0) {
if (res.data.data.length > 0) { var data = res.data.data;
if (data.data.length > 0) {
// 获取当前默认地址 // 获取当前默认地址
var is_default = 0; var is_default = 0;
for (var i in res.data.data) { for (var i in data.data) {
if (res.data.data[i]['is_default'] == 1) { if (data.data[i]['is_default'] == 1) {
is_default = res.data.data[i]['id']; is_default = data.data[i]['id'];
} }
} }
// 设置数据 // 设置数据
this.setData({ this.setData({
data_list: res.data.data, data_list: data.data,
is_default: is_default, is_default: is_default,
data_list_loding_status: 3, data_list_loding_status: 3,
data_bottom_line_status: true data_bottom_line_status: true
......
...@@ -57,20 +57,21 @@ Page({ ...@@ -57,20 +57,21 @@ Page({
qq.hideLoading(); qq.hideLoading();
qq.stopPullDownRefresh(); qq.stopPullDownRefresh();
if (res.data.code == 0) { if (res.data.code == 0) {
if (res.data.data.length > 0) { var data = res.data.data;
if (data.data.length > 0) {
// 获取当前默认地址 // 获取当前默认地址
var is_default = 0; var is_default = 0;
for(var i in res.data.data) for(var i in data.data)
{ {
if(res.data.data[i]['is_default'] == 1) if(data.data[i]['is_default'] == 1)
{ {
is_default = res.data.data[i]['id']; is_default = data.data[i]['id'];
} }
} }
// 设置数据 // 设置数据
this.setData({ this.setData({
data_list: res.data.data, data_list: data.data,
is_default: is_default, is_default: is_default,
data_list_loding_status: 3, data_list_loding_status: 3,
data_bottom_line_status: true, data_bottom_line_status: true,
......
...@@ -57,20 +57,21 @@ Page({ ...@@ -57,20 +57,21 @@ Page({
tt.hideLoading(); tt.hideLoading();
tt.stopPullDownRefresh(); tt.stopPullDownRefresh();
if (res.data.code == 0) { if (res.data.code == 0) {
if (res.data.data.length > 0) { var data = res.data.data;
if (data.data.length > 0) {
// 获取当前默认地址 // 获取当前默认地址
var is_default = 0; var is_default = 0;
for(var i in res.data.data) for(var i in data.data)
{ {
if(res.data.data[i]['is_default'] == 1) if(data.data[i]['is_default'] == 1)
{ {
is_default = res.data.data[i]['id']; is_default = data.data[i]['id'];
} }
} }
// 设置数据 // 设置数据
this.setData({ this.setData({
data_list: res.data.data, data_list: data.data,
is_default: is_default, is_default: is_default,
data_list_loding_status: 3, data_list_loding_status: 3,
data_bottom_line_status: true, data_bottom_line_status: true,
......
...@@ -74,7 +74,7 @@ App({ ...@@ -74,7 +74,7 @@ App({
// 请求地址 // 请求地址
request_url: "{{request_url}}", request_url: "{{request_url}}",
request_url: 'http://shopxo.com/', request_url: 'http://shopxo.com/',
request_url: 'https://dev.shopxo.net/', // request_url: 'https://dev.shopxo.net/',
// 基础信息 // 基础信息
application_title: "{{application_title}}", application_title: "{{application_title}}",
......
...@@ -57,20 +57,21 @@ Page({ ...@@ -57,20 +57,21 @@ Page({
wx.hideLoading(); wx.hideLoading();
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
if (res.data.code == 0) { if (res.data.code == 0) {
if (res.data.data.length > 0) { var data = res.data.data;
if (data.data.length > 0) {
// 获取当前默认地址 // 获取当前默认地址
var is_default = 0; var is_default = 0;
for(var i in res.data.data) for(var i in data.data)
{ {
if(res.data.data[i]['is_default'] == 1) if(data.data[i]['is_default'] == 1)
{ {
is_default = res.data.data[i]['id']; is_default = data.data[i]['id'];
} }
} }
// 设置数据 // 设置数据
this.setData({ this.setData({
data_list: res.data.data, data_list: data.data,
is_default: is_default, is_default: is_default,
data_list_loding_status: 3, data_list_loding_status: 3,
data_bottom_line_status: true, data_bottom_line_status: true,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册