添加网站文件
This commit is contained in:
53
application/api/controller/Points.php
Normal file
53
application/api/controller/Points.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
use app\api\logic\PointsLogic;
|
||||
use app\api\logic\UserLogic;
|
||||
|
||||
class Points extends ApiBase
|
||||
{
|
||||
public $like_not_need_login = ['classify',''];
|
||||
|
||||
/**
|
||||
* 获取积分商品的分类
|
||||
* @return mixed
|
||||
*/
|
||||
public function classify()
|
||||
{
|
||||
$lists = PointsLogic::classify();
|
||||
$this->_success('获取数据成功',$lists);
|
||||
}
|
||||
/**
|
||||
* 获取积分的商品内容
|
||||
* @return mixed
|
||||
*/
|
||||
public function goodslist(){
|
||||
$lists = PointsLogic::goodslist();
|
||||
$this->_success('获取数据成功',$lists);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function goodsIofo(){
|
||||
|
||||
$id = $this->request->get('id');
|
||||
$data = PointsLogic::goodsIofo($id);
|
||||
$this->_success('获取数据成功',$data);
|
||||
|
||||
}
|
||||
|
||||
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']){
|
||||
$this->_error('积分不足');
|
||||
}else{
|
||||
$data = PointsLogic::goodsSub($data);
|
||||
$this->_success('兑换成功',$data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user