87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace app\controller\api\store;
|
|
|
|
use app\common\dao\store\consumption\StoreConsumptionDao;
|
|
use app\common\dao\store\StoreActivityUserDao;
|
|
use crmeb\basic\BaseController;
|
|
|
|
class StoreActivity extends BaseController
|
|
{
|
|
|
|
/**
|
|
* 消费金列表
|
|
* @param StoreConsumptionDao $dao
|
|
* @return mixed
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function consumption(StoreConsumptionDao $dao)
|
|
{
|
|
$list = $dao->getValidList();
|
|
return app('json')->success($list);
|
|
}
|
|
|
|
/**
|
|
* 选择消费金类型
|
|
* @param StoreConsumptionDao $dao
|
|
* @return mixed
|
|
* @throws \Exception
|
|
*/
|
|
public function choose(StoreActivityUserDao $dao)
|
|
{
|
|
$userId = $this->request->uid();
|
|
$couponId = $this->request->post('coupon_id');
|
|
$activityId = $this->request->post('activity_id', 1);
|
|
$dao->choose($userId, $couponId, $activityId);
|
|
return app('json')->success('提交成功');
|
|
}
|
|
|
|
/**
|
|
* 获取用户参与活动的状态
|
|
* @param StoreActivityUserDao $dao
|
|
* @return mixed
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function status(StoreActivityUserDao $dao)
|
|
{
|
|
$userId = $this->request->uid();
|
|
$activityId = $this->request->post('activity_id', 1);
|
|
$result = $dao->status($userId, $activityId);
|
|
return app('json')->success($result);
|
|
}
|
|
|
|
/**
|
|
* 领取消费金
|
|
* @param StoreActivityUserDao $dao
|
|
* @return mixed
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function receive(StoreActivityUserDao $dao)
|
|
{
|
|
$userId = $this->request->uid();
|
|
$result = $dao->receive($userId);
|
|
return app('json')->success($result);
|
|
}
|
|
|
|
/**
|
|
* 红包获取记录
|
|
* @param StoreActivityUserDao $dao
|
|
* @return mixed
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function record(StoreActivityUserDao $dao)
|
|
{
|
|
$userId = $this->request->uid();
|
|
$result = $dao->record($userId);
|
|
return app('json')->success($result);
|
|
}
|
|
|
|
} |