goods buy

This commit is contained in:
devil_gong
2018-09-13 18:36:54 +08:00
parent 0f7b59978a
commit 81bf8470da
24 changed files with 717 additions and 130 deletions

View File

@ -45,6 +45,11 @@ class GoodsController extends CommonController
'is_attribute' => true,
];
$goods = GoodsService::GoodsList($params);
// 当前登录用户是否已收藏
$ret_favor = GoodsService::IsUserGoodsFavor(['goods_id'=>$id, 'user'=>$this->user]);
$goods[0]['is_favor'] = ($ret_favor['code'] == 0) ? $ret_favor['data'] : 0;
$this->assign('goods', $goods[0]);
$this->assign('home_seo_site_title', $goods[0]['title']);
@ -78,5 +83,25 @@ class GoodsController extends CommonController
$this->display('Index');
}
/**
* 商品收藏
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-13
* @desc description
*/
public function Favor()
{
// 是否登录
$this->Is_Login();
// 开始处理
$params = $_POST;
$params['user'] = $this->user;
$ret = GoodsService::GoodsFavor($params);
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
}
}
?>