122 lines
3.2 KiB
PHP
Executable File
122 lines
3.2 KiB
PHP
Executable File
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 宏驰云科技开发团队 版权所有 拥有最终解释权
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: HcyShop-竹
|
|
// +----------------------------------------------------------------------
|
|
namespace app\api\controller;
|
|
use app\api\logic\BargainLogic;
|
|
|
|
class Bargain extends ApiBase{
|
|
|
|
public $like_not_need_login = ['barginNumber', 'lists','detail','closeBargain'];
|
|
|
|
/**
|
|
* Notes:获取砍价成功人数
|
|
* @author: kiki
|
|
*/
|
|
public function barginNumber(){
|
|
$number = BargainLogic::barginNumber();
|
|
$this->_success('获取成功',$number);
|
|
}
|
|
|
|
|
|
/**
|
|
* Notes: 砍价列表
|
|
* @author:kiki
|
|
*/
|
|
public function lists(){
|
|
|
|
$list = BargainLogic::lists($this->page_no, $this->page_size);
|
|
$this->_success('获取成功',$list);
|
|
}
|
|
|
|
/**
|
|
* Notes:砍价活动详情
|
|
* @author:kiki
|
|
*/
|
|
public function detail(){
|
|
$bargain_id = $this->request->get('bargain_id');
|
|
$result = $this->validate(['bargain_id'=>$bargain_id],'app\api\validate\Bargain.detail');
|
|
if(true === $result){
|
|
$detail = BargainLogic::detail($bargain_id);
|
|
$this->_success('获取成功',$detail);
|
|
}
|
|
$this->_error($result);
|
|
|
|
}
|
|
|
|
/**
|
|
* Notes:发起砍价
|
|
* @author:kiki
|
|
*/
|
|
public function sponsor(){
|
|
$post_data = $this->request->post();
|
|
$result = $this->validate($post_data,'app\api\validate\Bargain.sponsor');
|
|
if(true === $result){
|
|
$data = BargainLogic::sponsor($post_data,$this->user_id);
|
|
$this->_success($data['msg'],$data['data'],$data['code'],$data['show']);
|
|
}
|
|
$this->_error($result);
|
|
}
|
|
|
|
/**
|
|
* Notes:砍价助力
|
|
* @author:kiki
|
|
*/
|
|
public function knife(){
|
|
$id = $this->request->post('id');
|
|
$result = $this->validate(['id'=>$id,'user_id'=>$this->user_id],'app\api\validate\Bargain.knife');
|
|
if(true === $result){
|
|
$data = BargainLogic::knife($id,$this->user_id);
|
|
$this->_success($data['msg'],$data['data'],$data['code'],$data['show']);
|
|
}
|
|
$this->_error($result);
|
|
}
|
|
|
|
/**
|
|
* Notes:砍价订单列表
|
|
* @author:kiki
|
|
*/
|
|
public function orderList(){
|
|
$type = $this->request->get('type','-1');
|
|
$list = BargainLogic::orderList($type,$this->user_id,$this->page_no,$this->page_size);
|
|
$this->_success('获取成功',$list);
|
|
}
|
|
|
|
|
|
/**
|
|
* Notes:砍价详情
|
|
* @author:kiki
|
|
*/
|
|
public function bargainDetail(){
|
|
$id = $this->request->get('id');
|
|
$result = $this->validate(['id'=>$id,'user_id'=>$this->user_id],'app\api\validate\Bargain.bargainDetail');
|
|
if(true === $result){
|
|
$detail = BargainLogic::bargainDetail($id,$this->user_id);
|
|
$this->_success('获取成功',$detail);
|
|
}
|
|
$this->_error($result);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* Notes:关闭砍价订单
|
|
* @author:kiki
|
|
*/
|
|
public function closeBargain(){
|
|
$id = $this->request->post('id');
|
|
if($id){
|
|
BargainLogic::closeBargain($id);
|
|
}
|
|
$this->_success('');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |