修复内容
This commit is contained in:
@@ -22,7 +22,8 @@ class Points extends ApiBase
|
||||
* @return mixed
|
||||
*/
|
||||
public function goodslist(){
|
||||
$lists = PointsLogic::goodslist();
|
||||
$clsssId = $this->request->get('classify_id');
|
||||
$lists = PointsLogic::goodslist($clsssId);
|
||||
$this->_success('获取数据成功',$lists);
|
||||
}
|
||||
/**
|
||||
@@ -38,16 +39,42 @@ class Points extends ApiBase
|
||||
}
|
||||
|
||||
public function goodsSub(){
|
||||
$data = $this->request->get();
|
||||
$data['user_id']= $this->user_id;
|
||||
$user_jf=UserLogic::getUserInfo($this->user_id);
|
||||
if($user_jf['user_integral']<$data['price']){
|
||||
$data = $this->request->post();
|
||||
|
||||
// 参数校验
|
||||
if(empty($data) || !is_array($data)){
|
||||
$this->_error('参数错误');
|
||||
}
|
||||
if(empty($data['id']) || empty($data['name']) || !isset($data['price'])){
|
||||
$this->_error('参数不完整');
|
||||
}
|
||||
|
||||
$data['user_id'] = $this->user_id;
|
||||
$user_jf = UserLogic::getUserInfo($this->user_id);
|
||||
|
||||
if($user_jf['user_integral'] < $data['price']){
|
||||
$this->_error('积分不足');
|
||||
}else{
|
||||
$data = PointsLogic::goodsSub($data);
|
||||
$this->_success('兑换成功',$data);
|
||||
$result = PointsLogic::goodsSub($data);
|
||||
if($result['code'] == 1){
|
||||
$this->_success('兑换成功');
|
||||
}else{
|
||||
$this->_error($result['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//积分订单列表
|
||||
public function orderList()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
// 参数校验
|
||||
if(empty($data) || !is_array($data)){
|
||||
$this->_error('参数错误');
|
||||
}
|
||||
$userId = $this->user_id;
|
||||
$state = isset($data['state']) ? $data['state'] : null;
|
||||
$result = PointsLogic::orderList($userId, $state);
|
||||
$this->_success('获取数据成功',$result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user