|
@@ -1,20 +1,24 @@
|
|
|
<?php
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
+
|
|
|
use think\facade\Db;
|
|
|
+
|
|
|
/**
|
|
|
- * ============================================================================
|
|
|
+
|
|
|
*
|
|
|
- * ============================================================================
|
|
|
+
|
|
|
*
|
|
|
* ----------------------------------------------------------------------------
|
|
|
*
|
|
|
- * ============================================================================
|
|
|
+
|
|
|
* 公共数据控制器
|
|
|
*/
|
|
|
-class Index extends MobileMall {
|
|
|
+class Index extends MobileMall
|
|
|
+{
|
|
|
|
|
|
- public function initialize() {
|
|
|
+ public function initialize()
|
|
|
+ {
|
|
|
parent::initialize();
|
|
|
}
|
|
|
|
|
@@ -44,55 +48,54 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {String} result.editable_page_config_list.editable_page_config_content 配置内容
|
|
|
|
|
|
*/
|
|
|
- public function getEditablePageConfigList() {
|
|
|
- $store_id=intval(input('param.store_id'));
|
|
|
- $editable_page_id=intval(input('param.editable_page_id'));
|
|
|
- $editable_page_path=input('param.editable_page_path');
|
|
|
- $editable_page_item_id=intval(input('param.editable_page_item_id'));
|
|
|
- $editable_page_model=model('editable_page');
|
|
|
- if(!$editable_page_id && !$editable_page_path){
|
|
|
- ds_json_encode(10001,lang('param_error'));
|
|
|
+ public function getEditablePageConfigList()
|
|
|
+ {
|
|
|
+ $store_id = intval(input('param.store_id'));
|
|
|
+ $editable_page_id = intval(input('param.editable_page_id'));
|
|
|
+ $editable_page_path = input('param.editable_page_path');
|
|
|
+ $editable_page_item_id = intval(input('param.editable_page_item_id'));
|
|
|
+ $editable_page_model = model('editable_page');
|
|
|
+ if (!$editable_page_id && !$editable_page_path) {
|
|
|
+ ds_json_encode(10001, lang('param_error'));
|
|
|
}
|
|
|
$condition = array();
|
|
|
- $condition[] = array('editable_page_client','=','h5');
|
|
|
- if($editable_page_id){
|
|
|
- $condition[] = array('editable_page_id','=',$editable_page_id);
|
|
|
- }else{
|
|
|
- $condition[] = array('editable_page_path','=',$editable_page_path);
|
|
|
- $condition[] = array('editable_page_item_id','=',$editable_page_item_id);
|
|
|
+ $condition[] = array('editable_page_client', '=', 'h5');
|
|
|
+ if ($editable_page_id) {
|
|
|
+ $condition[] = array('editable_page_id', '=', $editable_page_id);
|
|
|
+ } else {
|
|
|
+ $condition[] = array('editable_page_path', '=', $editable_page_path);
|
|
|
+ $condition[] = array('editable_page_item_id', '=', $editable_page_item_id);
|
|
|
}
|
|
|
- if($store_id){
|
|
|
- $condition[] = array('store_id','=',$store_id);
|
|
|
+ if ($store_id) {
|
|
|
+ $condition[] = array('store_id', '=', $store_id);
|
|
|
}
|
|
|
- $editable_page_config_list=false;
|
|
|
- $editable_page=$editable_page_model->getOneEditablePage($condition);
|
|
|
- if($editable_page){
|
|
|
- $editable_page['editable_page_theme_config']= json_decode($editable_page['editable_page_theme_config'],true);
|
|
|
+ $editable_page_config_list = false;
|
|
|
+ $editable_page = $editable_page_model->getOneEditablePage($condition);
|
|
|
+ if ($editable_page) {
|
|
|
+ $editable_page['editable_page_theme_config'] = json_decode($editable_page['editable_page_theme_config'], true);
|
|
|
|
|
|
$editable_page_config_model = model('editable_page_config');
|
|
|
- $editable_page_config_list=$editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page['editable_page_id'])));
|
|
|
- foreach($editable_page_config_list as $key => $val){
|
|
|
- $config_info=json_decode($val['editable_page_config_content'], true);
|
|
|
- $model_id=$val['editable_page_model_id'];
|
|
|
- if(!empty($config_info)){
|
|
|
- require_once PLUGINS_PATH.'/editable_page_model/h5_'.$model_id.'/config.php';
|
|
|
- $model_name='Model'.$model_id;
|
|
|
- $model=new $model_name();
|
|
|
- $res=$model->filterData($config_info);
|
|
|
- if($res['code']){
|
|
|
- $res=$model->formatData(json_encode($res['data']),$store_id);
|
|
|
- if($res['code']){
|
|
|
- $editable_page_config_list[$key]['editable_page_config_content']=$res['data'];
|
|
|
+ $editable_page_config_list = $editable_page_config_model->getEditablePageConfigList(array(array('editable_page_id', '=', $editable_page['editable_page_id'])));
|
|
|
+ foreach ($editable_page_config_list as $key => $val) {
|
|
|
+ $config_info = json_decode($val['editable_page_config_content'], true);
|
|
|
+ $model_id = $val['editable_page_model_id'];
|
|
|
+ if (!empty($config_info)) {
|
|
|
+ require_once PLUGINS_PATH . '/editable_page_model/h5_' . $model_id . '/config.php';
|
|
|
+ $model_name = 'Model' . $model_id;
|
|
|
+ $model = new $model_name();
|
|
|
+ $res = $model->filterData($config_info);
|
|
|
+ if ($res['code']) {
|
|
|
+ $res = $model->formatData(json_encode($res['data']), $store_id);
|
|
|
+ if ($res['code']) {
|
|
|
+ $editable_page_config_list[$key]['editable_page_config_content'] = $res['data'];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
- }
|
|
|
- ds_json_encode(10000, '', array('editable_page_config_list' =>$editable_page_config_list ,'editable_page'=>$editable_page));
|
|
|
+ }
|
|
|
+ ds_json_encode(10000, '', array('editable_page_config_list' => $editable_page_config_list, 'editable_page' => $editable_page));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* @api {POST} api/Index/search_key_list 默认搜索词列表
|
|
|
* @apiVersion 1.0.0
|
|
@@ -104,7 +107,8 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {String[]} result.list 热门搜索列表
|
|
|
* @apiSuccess {String[]} result.his_list 历史搜索列表
|
|
|
*/
|
|
|
- public function search_key_list() {
|
|
|
+ public function search_key_list()
|
|
|
+ {
|
|
|
$list = @explode(',', config('ds_config.hot_search'));
|
|
|
if (!$list || !is_array($list)) {
|
|
|
$list = array();
|
|
@@ -142,7 +146,8 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {Int} result.ad_list.adv_sort 广告图排序
|
|
|
* @apiSuccess {Int} result.ad_list.adv_enabled 是否开启广告图 1是0否
|
|
|
*/
|
|
|
- public function getAppadList() {
|
|
|
+ public function getAppadList()
|
|
|
+ {
|
|
|
$ap_id = intval(input('param.ap_id'));
|
|
|
if ($ap_id <= 0) {
|
|
|
ds_json_encode(10001, lang('param_error'));
|
|
@@ -151,10 +156,10 @@ class Index extends MobileMall {
|
|
|
$result = rcache($ap_id, $prefix);
|
|
|
if (empty($result)) {
|
|
|
$condition = array();
|
|
|
- $condition[] = array('ap_id','=',$ap_id);
|
|
|
- $condition[] = array('adv_enabled','=',1);
|
|
|
- $condition[] = array('adv_startdate','<',TIMESTAMP);
|
|
|
- $condition[] = array('adv_enddate','>',TIMESTAMP);
|
|
|
+ $condition[] = array('ap_id', '=', $ap_id);
|
|
|
+ $condition[] = array('adv_enabled', '=', 1);
|
|
|
+ $condition[] = array('adv_startdate', '<', TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enddate', '>', TIMESTAMP);
|
|
|
$ad_list = model('appadv')->getAppadvList($condition);
|
|
|
if (!empty($ad_list)) {
|
|
|
foreach ($ad_list as $key => $banner) {
|
|
@@ -220,16 +225,17 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {Int} result.floor_ads.adv_sort 广告图排序
|
|
|
* @apiSuccess {Int} result.floor_ads.adv_enabled 是否开启广告图 1是0否
|
|
|
*/
|
|
|
- public function getIndexAdList() {
|
|
|
+ public function getIndexAdList()
|
|
|
+ {
|
|
|
$cache_key = "api-getIndexAdList";
|
|
|
$result = rcache($cache_key);
|
|
|
if (empty($result)) {
|
|
|
$condition = array();
|
|
|
- $condition[] = array('adv_enabled','=',1);
|
|
|
+ $condition[] = array('adv_enabled', '=', 1);
|
|
|
// 首页轮播图
|
|
|
- $condition[] = array('ap_id','=',1);
|
|
|
- $condition[] = array('adv_startdate','<',TIMESTAMP);
|
|
|
- $condition[] = array('adv_enddate','>',TIMESTAMP);
|
|
|
+ $condition[] = array('ap_id', '=', 1);
|
|
|
+ $condition[] = array('adv_startdate', '<', TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enddate', '>', TIMESTAMP);
|
|
|
$banners_list = model('appadv')->getAppadvList($condition);
|
|
|
if (!empty($banners_list)) {
|
|
|
foreach ($banners_list as $key => $banner) {
|
|
@@ -240,10 +246,10 @@ class Index extends MobileMall {
|
|
|
|
|
|
// 首页促销
|
|
|
$condition = array();
|
|
|
- $condition[] = array('adv_enabled','=',1);
|
|
|
- $condition[] = array('ap_id','=',2);
|
|
|
- $condition[] = array('adv_startdate','<',TIMESTAMP);
|
|
|
- $condition[] = array('adv_enddate','>',TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enabled', '=', 1);
|
|
|
+ $condition[] = array('ap_id', '=', 2);
|
|
|
+ $condition[] = array('adv_startdate', '<', TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enddate', '>', TIMESTAMP);
|
|
|
$promotion_ads = model('appadv')->getAppadvList($condition);
|
|
|
if (!empty($promotion_ads)) {
|
|
|
foreach ($promotion_ads as $key => $banner) {
|
|
@@ -254,10 +260,10 @@ class Index extends MobileMall {
|
|
|
|
|
|
// 首页Navs
|
|
|
$condition = array();
|
|
|
- $condition[] = array('adv_enabled','=',1);
|
|
|
- $condition[] = array('ap_id','=',3);
|
|
|
- $condition[] = array('adv_startdate','<',TIMESTAMP);
|
|
|
- $condition[] = array('adv_enddate','>',TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enabled', '=', 1);
|
|
|
+ $condition[] = array('ap_id', '=', 3);
|
|
|
+ $condition[] = array('adv_startdate', '<', TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enddate', '>', TIMESTAMP);
|
|
|
$navs_list = model('appadv')->getAppadvList($condition);
|
|
|
if (!empty($navs_list)) {
|
|
|
foreach ($navs_list as $key => $banner) {
|
|
@@ -268,10 +274,10 @@ class Index extends MobileMall {
|
|
|
|
|
|
// 首页横图广告
|
|
|
$condition = array();
|
|
|
- $condition[] = array('adv_enabled','=',1);
|
|
|
- $condition[] = array('ap_id','=',4);
|
|
|
- $condition[] = array('adv_startdate','<',TIMESTAMP);
|
|
|
- $condition[] = array('adv_enddate','>',TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enabled', '=', 1);
|
|
|
+ $condition[] = array('ap_id', '=', 4);
|
|
|
+ $condition[] = array('adv_startdate', '<', TIMESTAMP);
|
|
|
+ $condition[] = array('adv_enddate', '>', TIMESTAMP);
|
|
|
$floor_ads = model('appadv')->getAppadvList($condition);
|
|
|
if (!empty($floor_ads)) {
|
|
|
foreach ($floor_ads as $key => $banner) {
|
|
@@ -311,52 +317,53 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {String} result.config_list.points_signin_cycle 签到持续周期
|
|
|
* @apiSuccess {String} result.config_list.points_signin_reward 签到持续周期额外奖励
|
|
|
*/
|
|
|
- public function getConfigList() {
|
|
|
+ public function getConfigList()
|
|
|
+ {
|
|
|
$list_config = rkcache('config', true);
|
|
|
- $wechat_model=model('wechat');
|
|
|
+ $wechat_model = model('wechat');
|
|
|
$wx_config = $wechat_model->getOneWxconfig();
|
|
|
- if(!empty($list_config['business_licence'])){
|
|
|
- $list_config['business_licence'] = ds_get_pic( ATTACH_COMMON , $list_config['business_licence']);
|
|
|
+ if (!empty($list_config['business_licence'])) {
|
|
|
+ $list_config['business_licence'] = ds_get_pic(ATTACH_COMMON, $list_config['business_licence']);
|
|
|
}
|
|
|
$config_list = array(
|
|
|
- 'site_name' => $list_config['site_name'],
|
|
|
- 'site_mobile_logo' => ds_get_pic(ATTACH_COMMON , $list_config['site_mobile_logo']),
|
|
|
- 'member_auth'=>$list_config['member_auth'],
|
|
|
- 'instant_message_gateway_url'=>$list_config['instant_message_gateway_url'], //站内IM服务器地址
|
|
|
- 'instant_message_open'=>$list_config['instant_message_open'], //是否启用im
|
|
|
- 'qq_isuse'=>$list_config['qq_isuse'], //是否使用QQ互联
|
|
|
- 'sina_isuse'=>$list_config['sina_isuse'], //是否使用微博互联
|
|
|
- 'weixin_isuse'=>$list_config['weixin_isuse'], //是否使用微信互联
|
|
|
- 'member_normal_register'=>$list_config['member_normal_register'], //是否普通注册
|
|
|
- 'sms_register'=>$list_config['sms_register'], //是否手机注册
|
|
|
- 'sms_login'=>$list_config['sms_login'], //是否手机登录
|
|
|
- 'mapak_type'=>$list_config['mapak_type'], //地图类型
|
|
|
- 'gaode_ak'=>$list_config['gaode_ak'], //高德地图AK密钥
|
|
|
- 'gaode_jscode'=>$list_config['gaode_jscode'], //高德地图安全密钥
|
|
|
- 'baidu_ak'=>$list_config['baidu_ak'], //百度浏览器端地图AK密钥
|
|
|
- 'baiduservice_ak'=>$list_config['baiduservice_ak'], //百度服务端地图AK密钥
|
|
|
- 'inviter_open'=>$list_config['inviter_open'], //推广开关
|
|
|
- 'inviter_level'=>$list_config['inviter_level'], //推广级别
|
|
|
- 'inviter_show'=>$list_config['inviter_show'], //详情页显示推广佣金
|
|
|
- 'inviter_return'=>$list_config['inviter_return'], //推广员返佣
|
|
|
- 'inviter_view'=>$list_config['inviter_view'], //推广员审核
|
|
|
- 'business_licence'=>$list_config['business_licence'], //营业执照,
|
|
|
- 'points_isuse'=>$list_config['points_isuse'], //是否开启积分
|
|
|
- 'points_signin_isuse'=>$list_config['points_signin_isuse'], //是否开启签到送积分
|
|
|
- 'points_signin_cycle'=>$list_config['points_signin_cycle'], //签到持续周期
|
|
|
- 'points_signin_reward'=>$list_config['points_signin_reward'], //签到持续周期额外奖励
|
|
|
- 'wechat_appid'=>!empty($wx_config)?$wx_config['appid']:'', //微信appid
|
|
|
- 'captcha_status_register'=>$list_config['captcha_status_register'], //注册验证码
|
|
|
- 'captcha_status_login'=>$list_config['captcha_status_login'], //登录验证码
|
|
|
- 'captcha_status_goodsqa'=>$list_config['captcha_status_goodsqa'], //咨询验证码
|
|
|
- 'store_joinin_open'=>$list_config['store_joinin_open'], //店铺入驻开启
|
|
|
- 'flow_static_code'=>$list_config['flow_static_code'], //版权信息
|
|
|
- 'video_type'=>$list_config['video_type'], //视频服务商
|
|
|
- 'aliyun_user_id'=>$list_config['aliyun_user_id'], //版权信息
|
|
|
- 'live_type'=>$list_config['live_type'], //直播类型
|
|
|
- 'chain_isuse'=>$list_config['chain_isuse'], //代收是否开启
|
|
|
- 'wab_number'=>$list_config['wab_number'], //网安备
|
|
|
- 'icp_number'=>$list_config['icp_number'], //ICP
|
|
|
+ 'site_name' => $list_config['site_name'],
|
|
|
+ 'site_mobile_logo' => ds_get_pic(ATTACH_COMMON, $list_config['site_mobile_logo']),
|
|
|
+ 'member_auth' => $list_config['member_auth'],
|
|
|
+ 'instant_message_gateway_url' => $list_config['instant_message_gateway_url'], //站内IM服务器地址
|
|
|
+ 'instant_message_open' => $list_config['instant_message_open'], //是否启用im
|
|
|
+ 'qq_isuse' => $list_config['qq_isuse'], //是否使用QQ互联
|
|
|
+ 'sina_isuse' => $list_config['sina_isuse'], //是否使用微博互联
|
|
|
+ 'weixin_isuse' => $list_config['weixin_isuse'], //是否使用微信互联
|
|
|
+ 'member_normal_register' => $list_config['member_normal_register'], //是否普通注册
|
|
|
+ 'sms_register' => $list_config['sms_register'], //是否手机注册
|
|
|
+ 'sms_login' => $list_config['sms_login'], //是否手机登录
|
|
|
+ 'mapak_type' => $list_config['mapak_type'], //地图类型
|
|
|
+ 'gaode_ak' => $list_config['gaode_ak'], //高德地图AK密钥
|
|
|
+ 'gaode_jscode' => $list_config['gaode_jscode'], //高德地图安全密钥
|
|
|
+ 'baidu_ak' => $list_config['baidu_ak'], //百度浏览器端地图AK密钥
|
|
|
+ 'baiduservice_ak' => $list_config['baiduservice_ak'], //百度服务端地图AK密钥
|
|
|
+ 'inviter_open' => $list_config['inviter_open'], //推广开关
|
|
|
+ 'inviter_level' => $list_config['inviter_level'], //推广级别
|
|
|
+ 'inviter_show' => $list_config['inviter_show'], //详情页显示推广佣金
|
|
|
+ 'inviter_return' => $list_config['inviter_return'], //推广员返佣
|
|
|
+ 'inviter_view' => $list_config['inviter_view'], //推广员审核
|
|
|
+ 'business_licence' => $list_config['business_licence'], //营业执照,
|
|
|
+ 'points_isuse' => $list_config['points_isuse'], //是否开启积分
|
|
|
+ 'points_signin_isuse' => $list_config['points_signin_isuse'], //是否开启签到送积分
|
|
|
+ 'points_signin_cycle' => $list_config['points_signin_cycle'], //签到持续周期
|
|
|
+ 'points_signin_reward' => $list_config['points_signin_reward'], //签到持续周期额外奖励
|
|
|
+ 'wechat_appid' => !empty($wx_config) ? $wx_config['appid'] : '', //微信appid
|
|
|
+ 'captcha_status_register' => $list_config['captcha_status_register'], //注册验证码
|
|
|
+ 'captcha_status_login' => $list_config['captcha_status_login'], //登录验证码
|
|
|
+ 'captcha_status_goodsqa' => $list_config['captcha_status_goodsqa'], //咨询验证码
|
|
|
+ 'store_joinin_open' => $list_config['store_joinin_open'], //店铺入驻开启
|
|
|
+ 'flow_static_code' => $list_config['flow_static_code'], //版权信息
|
|
|
+ 'video_type' => $list_config['video_type'], //视频服务商
|
|
|
+ 'aliyun_user_id' => $list_config['aliyun_user_id'], //版权信息
|
|
|
+ 'live_type' => $list_config['live_type'], //直播类型
|
|
|
+ 'chain_isuse' => $list_config['chain_isuse'], //代收是否开启
|
|
|
+ 'wab_number' => $list_config['wab_number'], //网安备
|
|
|
+ 'icp_number' => $list_config['icp_number'], //ICP
|
|
|
);
|
|
|
ds_json_encode(10000, '', array('config_list' => $config_list));
|
|
|
}
|
|
@@ -430,7 +437,8 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {Int} result.good_products.store_id 店铺ID
|
|
|
* @apiSuccess {String} result.good_products.store_name 店铺名称
|
|
|
*/
|
|
|
- public function getProductList() {
|
|
|
+ public function getProductList()
|
|
|
+ {
|
|
|
$cache_key = "api-getProductList";
|
|
|
$result = rcache($cache_key);
|
|
|
if (empty($result)) {
|
|
@@ -439,14 +447,14 @@ class Index extends MobileMall {
|
|
|
$fieldstr = "goods.goods_id,goods.goods_storage,goodscommon.goods_commonid,goodscommon.store_id,goodscommon.goods_name,goodscommon.goods_advword,goodscommon.goods_price,goods.goods_promotion_price,goods.goods_promotion_type,goodscommon.goods_marketprice,goodscommon.goods_image,goods.goods_salenum,goods.evaluation_good_star,goods.evaluation_count";
|
|
|
$fieldstr .= ',goodscommon.is_virtual,goodscommon.is_goodsfcode,goods.is_have_gift,goodscommon.store_name,goodscommon.is_platform_store';
|
|
|
|
|
|
- $hot_products = $goods_model->getGoodsUnionList(array(),$fieldstr , 'goods_salenum desc','goodscommon.goods_commonid', $this->pagesize);
|
|
|
+ $hot_products = $goods_model->getGoodsUnionList(array(), $fieldstr, 'goods_salenum desc', 'goodscommon.goods_commonid', $this->pagesize);
|
|
|
if ($hot_products) {
|
|
|
foreach ($hot_products as $key => $val) {
|
|
|
- if(!$val['goods_storage']){
|
|
|
- $goods_info=$goods_model->getGoodsStorageByCommonId($val['goods_commonid']);
|
|
|
- if($goods_info){
|
|
|
- $hot_products[$key]['goods_id']=$goods_info['goods_id'];
|
|
|
- $hot_products[$key]['goods_promotion_price']=$goods_info['goods_promotion_price'];
|
|
|
+ if (!$val['goods_storage']) {
|
|
|
+ $goods_info = $goods_model->getGoodsStorageByCommonId($val['goods_commonid']);
|
|
|
+ if ($goods_info) {
|
|
|
+ $hot_products[$key]['goods_id'] = $goods_info['goods_id'];
|
|
|
+ $hot_products[$key]['goods_promotion_price'] = $goods_info['goods_promotion_price'];
|
|
|
}
|
|
|
}
|
|
|
$hot_products[$key]['goods_img_480'] = goods_thumb($val, 480);
|
|
@@ -454,14 +462,14 @@ class Index extends MobileMall {
|
|
|
}
|
|
|
$result['hot_products'] = $hot_products;
|
|
|
|
|
|
- $recently_products = $goods_model->getGoodsUnionList(array(),$fieldstr , 'goods_edittime desc','goodscommon.goods_commonid', $this->pagesize);
|
|
|
+ $recently_products = $goods_model->getGoodsUnionList(array(), $fieldstr, 'goods_edittime desc', 'goodscommon.goods_commonid', $this->pagesize);
|
|
|
if ($recently_products) {
|
|
|
foreach ($recently_products as $key => $val) {
|
|
|
- if(!$val['goods_storage']){
|
|
|
- $goods_info=$goods_model->getGoodsStorageByCommonId($val['goods_commonid']);
|
|
|
- if($goods_info){
|
|
|
- $recently_products[$key]['goods_id']=$goods_info['goods_id'];
|
|
|
- $recently_products[$key]['goods_promotion_price']=$goods_info['goods_promotion_price'];
|
|
|
+ if (!$val['goods_storage']) {
|
|
|
+ $goods_info = $goods_model->getGoodsStorageByCommonId($val['goods_commonid']);
|
|
|
+ if ($goods_info) {
|
|
|
+ $recently_products[$key]['goods_id'] = $goods_info['goods_id'];
|
|
|
+ $recently_products[$key]['goods_promotion_price'] = $goods_info['goods_promotion_price'];
|
|
|
}
|
|
|
}
|
|
|
$recently_products[$key]['goods_img_480'] = goods_thumb($val, 480);
|
|
@@ -469,36 +477,36 @@ class Index extends MobileMall {
|
|
|
}
|
|
|
$result['recently_products'] = $recently_products;
|
|
|
|
|
|
-
|
|
|
- $good_products = $goods_model->getGoodsUnionList(array(array('goodscommon.mall_goods_commend','=',1)),$fieldstr , 'goodscommon.mall_goods_sort asc','goodscommon.goods_commonid', $this->pagesize);
|
|
|
+
|
|
|
+ $good_products = $goods_model->getGoodsUnionList(array(array('goodscommon.mall_goods_commend', '=', 1)), $fieldstr, 'goodscommon.mall_goods_sort asc', 'goodscommon.goods_commonid', $this->pagesize);
|
|
|
if ($good_products) {
|
|
|
foreach ($good_products as $key => $val) {
|
|
|
- if(!$val['goods_storage']){
|
|
|
- $goods_info=$goods_model->getGoodsStorageByCommonId($val['goods_commonid']);
|
|
|
- if($goods_info){
|
|
|
- $good_products[$key]['goods_id']=$goods_info['goods_id'];
|
|
|
- $good_products[$key]['goods_promotion_price']=$goods_info['goods_promotion_price'];
|
|
|
+ if (!$val['goods_storage']) {
|
|
|
+ $goods_info = $goods_model->getGoodsStorageByCommonId($val['goods_commonid']);
|
|
|
+ if ($goods_info) {
|
|
|
+ $good_products[$key]['goods_id'] = $goods_info['goods_id'];
|
|
|
+ $good_products[$key]['goods_promotion_price'] = $goods_info['goods_promotion_price'];
|
|
|
}
|
|
|
}
|
|
|
$good_products[$key]['goods_img_480'] = goods_thumb($val, 480);
|
|
|
}
|
|
|
}
|
|
|
$result['good_products'] = $good_products;
|
|
|
-
|
|
|
- //秒杀
|
|
|
- $xianshicondition = array(
|
|
|
- array('xianshigoods_state', '=', 1),
|
|
|
- array('xianshigoods_starttime', '<', TIMESTAMP),
|
|
|
- array('xianshigoods_end_time', '>', TIMESTAMP),
|
|
|
- );
|
|
|
-
|
|
|
- $xianshi = model('pxianshigoods')->getXianshigoodsList($xianshicondition,null,'','*',3);
|
|
|
- foreach ($xianshi as $k => $v){
|
|
|
- $price_array = explode(".", $v['xianshigoods_price']);
|
|
|
- $xianshi[$k]['goods_image'] = goods_cthumb($v['goods_image'], 480);
|
|
|
- $xianshi[$k]['xianshigoods_end_time'] = date("m-d H:i", $v['xianshigoods_end_time']);
|
|
|
- }
|
|
|
- $result['xianshi_products'] = $xianshi;
|
|
|
+
|
|
|
+ //秒杀
|
|
|
+ $xianshicondition = array(
|
|
|
+ array('xianshigoods_state', '=', 1),
|
|
|
+ array('xianshigoods_starttime', '<', TIMESTAMP),
|
|
|
+ array('xianshigoods_end_time', '>', TIMESTAMP),
|
|
|
+ );
|
|
|
+
|
|
|
+ $xianshi = model('pxianshigoods')->getXianshigoodsList($xianshicondition, null, '', '*', 3);
|
|
|
+ foreach ($xianshi as $k => $v) {
|
|
|
+ $price_array = explode(".", $v['xianshigoods_price']);
|
|
|
+ $xianshi[$k]['goods_image'] = goods_cthumb($v['goods_image'], 480);
|
|
|
+ $xianshi[$k]['xianshigoods_end_time'] = date("m-d H:i", $v['xianshigoods_end_time']);
|
|
|
+ }
|
|
|
+ $result['xianshi_products'] = $xianshi;
|
|
|
wcache($cache_key, $result);
|
|
|
}
|
|
|
|
|
@@ -521,18 +529,19 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {String} result.signPackage.signature 微信签名
|
|
|
* @apiSuccess {String} result.signPackage.rawString 原始数据
|
|
|
*/
|
|
|
- public function getWechatShare(){
|
|
|
- $wechat_model=model('wechat');
|
|
|
+ public function getWechatShare()
|
|
|
+ {
|
|
|
+ $wechat_model = model('wechat');
|
|
|
$wechat_model->getOneWxconfig();
|
|
|
$signPackage = $wechat_model->GetSignPackage(urldecode(input('param.url')));
|
|
|
- $goods_detail['signPackage']=$signPackage;
|
|
|
- if($wechat_model->error_code){
|
|
|
- ds_json_encode(10001,$wechat_model->error_message);
|
|
|
- }else{
|
|
|
+ $goods_detail['signPackage'] = $signPackage;
|
|
|
+ if ($wechat_model->error_code) {
|
|
|
+ ds_json_encode(10001, $wechat_model->error_message);
|
|
|
+ } else {
|
|
|
ds_json_encode(10000, '', array('signPackage' => $signPackage));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* @api {POST} api/Index/getQrcode 获取二维码
|
|
|
* @apiVersion 1.0.0
|
|
@@ -543,15 +552,16 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {String} message 返回消息
|
|
|
* @apiSuccess {Object} result 返回数据
|
|
|
*/
|
|
|
- public function getQrcode() {
|
|
|
- include_once root_path(). 'extend/qrcode/phpqrcode.php';
|
|
|
+ public function getQrcode()
|
|
|
+ {
|
|
|
+ include_once root_path() . 'extend/qrcode/phpqrcode.php';
|
|
|
$value = strip_tags(htmlspecialchars_decode(input('get.url')));
|
|
|
$errorCorrectionLevel = "L";
|
|
|
$matrixPointSize = "4";
|
|
|
- \QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize,2);
|
|
|
+ \QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize, 2);
|
|
|
exit;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* @api {POST} api/Index/getGuessLike 猜你喜欢
|
|
|
* @apiVersion 1.0.0
|
|
@@ -562,30 +572,31 @@ class Index extends MobileMall {
|
|
|
* @apiSuccess {String} message 返回消息
|
|
|
* @apiSuccess {Object} result 返回数据
|
|
|
*/
|
|
|
- public function getGuessLike(){
|
|
|
- $member_id=intval(input('param.member_id'));
|
|
|
+ public function getGuessLike()
|
|
|
+ {
|
|
|
+ $member_id = intval(input('param.member_id'));
|
|
|
$goods_list = model('goodsbrowse')->getGuessLikeGoods($member_id, 20);
|
|
|
if ($goods_list) {
|
|
|
foreach ($goods_list as $key => $val) {
|
|
|
$goods_list[$key]['goods_img_480'] = goods_thumb($val, 480);
|
|
|
}
|
|
|
}
|
|
|
- if(empty($goods_list)){//随机请求
|
|
|
- $max_id=Db::name('goods')->where(array(array('goods_state','=',1),array('goods_verify','=',1)))->max('goods_commonid');
|
|
|
- if($max_id){
|
|
|
- $goods_model=model('goods');
|
|
|
- $goods_commonids=array();
|
|
|
- for($i=0;$i<20;$i++){
|
|
|
- $condition=array();
|
|
|
- $condition[]=array('goods_state','=',1);
|
|
|
- $condition[]=array('goods_verify','=',1);
|
|
|
- $rand_id=rand(1,$max_id);
|
|
|
- $condition[]=array('goods_commonid','>=',$rand_id);
|
|
|
- $goods=$goods_model->getGoodsInfo($condition);
|
|
|
- if($goods && !in_array($goods['goods_commonid'],$goods_commonids)){
|
|
|
- $goods_commonids[]=$goods['goods_commonid'];
|
|
|
+ if (empty($goods_list)) { //随机请求
|
|
|
+ $max_id = Db::name('goods')->where(array(array('goods_state', '=', 1), array('goods_verify', '=', 1)))->max('goods_commonid');
|
|
|
+ if ($max_id) {
|
|
|
+ $goods_model = model('goods');
|
|
|
+ $goods_commonids = array();
|
|
|
+ for ($i = 0; $i < 20; $i++) {
|
|
|
+ $condition = array();
|
|
|
+ $condition[] = array('goods_state', '=', 1);
|
|
|
+ $condition[] = array('goods_verify', '=', 1);
|
|
|
+ $rand_id = rand(1, $max_id);
|
|
|
+ $condition[] = array('goods_commonid', '>=', $rand_id);
|
|
|
+ $goods = $goods_model->getGoodsInfo($condition);
|
|
|
+ if ($goods && !in_array($goods['goods_commonid'], $goods_commonids)) {
|
|
|
+ $goods_commonids[] = $goods['goods_commonid'];
|
|
|
$goods['goods_img_480'] = goods_thumb($goods, 480);
|
|
|
- $goods_list[]=$goods;
|
|
|
+ $goods_list[] = $goods;
|
|
|
}
|
|
|
$i++;
|
|
|
}
|