mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-07-07 06:15:29 +08:00
插件调用优化
This commit is contained in:
@ -12,6 +12,7 @@ namespace app\api\controller;
|
||||
|
||||
use app\service\GoodsService;
|
||||
use app\service\BuyService;
|
||||
use app\service\PluginsService;
|
||||
use app\service\GoodsCommentsService;
|
||||
|
||||
/**
|
||||
@ -136,9 +137,6 @@ class Goods extends Common
|
||||
// 站点模式
|
||||
'common_site_type' => (int) MyC('common_site_type', 0, true),
|
||||
'common_is_exhibition_mode_btn_text'=> MyC('common_is_exhibition_mode_btn_text', '立即咨询', true),
|
||||
|
||||
// 优惠劵
|
||||
'plugins_coupon_data' => $this->PluginsCouponGoods($goods_id),
|
||||
];
|
||||
|
||||
// 支付宝小程序在线客服
|
||||
@ -148,56 +146,26 @@ class Goods extends Common
|
||||
$result['common_app_mini_alipay_scene'] = MyC('common_app_mini_alipay_scene', null, true);
|
||||
}
|
||||
|
||||
// 秒杀
|
||||
// 限时秒杀
|
||||
if($result['common_app_is_limitedtimediscount'] == 1)
|
||||
{
|
||||
$ret = CallPluginsServiceMethod('limitedtimediscount', 'Service', 'GoodsDetailCountdown', $goods_id);
|
||||
if($ret['code'] == 0)
|
||||
$ret = PluginsService::PluginsControlCall(
|
||||
'limitedtimediscount', 'index', 'goods', 'api', ['goods_id'=>$goods_id]);
|
||||
if($ret['code'] == 0 && isset($ret['data']['code']) && $ret['data']['code'] == 0)
|
||||
{
|
||||
$result['plugins_limitedtimediscount_data'] = $ret['data'];
|
||||
$result['plugins_limitedtimediscount_data'] = $ret['data']['data'];
|
||||
}
|
||||
}
|
||||
return DataReturn('success', 0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情优惠劵
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-10-17
|
||||
* @desc description
|
||||
* @param [int] $goods_id [商品id]
|
||||
*/
|
||||
private function PluginsCouponGoods($goods_id)
|
||||
{
|
||||
// 获取基础配置信息
|
||||
$base = CallPluginsData('coupon');
|
||||
|
||||
// 优惠劵列表
|
||||
$coupon_params = [
|
||||
'where' => [
|
||||
'is_enable' => 1,
|
||||
'is_user_receive' => 1,
|
||||
],
|
||||
'm' => 0,
|
||||
'n' => 0,
|
||||
'is_sure_receive' => 1,
|
||||
'user' => $this->user,
|
||||
];
|
||||
$ret = CallPluginsServiceMethod('coupon', 'CouponService', 'CouponList', $coupon_params);
|
||||
|
||||
// 排除商品不支持的活动
|
||||
if(!empty($ret['data']))
|
||||
// 优惠券
|
||||
$ret = PluginsService::PluginsControlCall(
|
||||
'coupon', 'index', 'goods', 'api', ['goods_id'=>$goods_id]);
|
||||
if($ret['code'] == 0 && isset($ret['data']['code']) && $ret['data']['code'] == 0)
|
||||
{
|
||||
$ret['data'] = CallPluginsServiceMethod('coupon', 'BaseService', 'CouponListGoodsExclude', ['data'=>$ret['data'], 'goods_id'=>$goods_id]);
|
||||
$result['plugins_coupon_data'] = $ret['data']['data'];
|
||||
}
|
||||
|
||||
// 返回数据
|
||||
return [
|
||||
'base' => $base['data'],
|
||||
'data' => $ret['data'],
|
||||
];
|
||||
return DataReturn('success', 0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -340,22 +308,5 @@ class Goods extends Common
|
||||
];
|
||||
return DataReturn('success', 0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品海报
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2019-08-17T21:10:41+0800
|
||||
*/
|
||||
public function Poster()
|
||||
{
|
||||
// 是否开启海报功能
|
||||
if(MyC('common_app_is_poster_share') == 1)
|
||||
{
|
||||
return CallPluginsServiceMethod('distribution', 'PosterGoodsService', 'GoodsCreateMiniWechat', $this->data_post);
|
||||
}
|
||||
return DataReturn('海报功能未启用', -100);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user