149 lines
4.0 KiB
PHP
Executable File
149 lines
4.0 KiB
PHP
Executable File
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 宏驰云科技开发团队 版权所有 拥有最终解释权
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: HcyShop-kiki
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\api\logic\DistributionLogic;
|
|
use app\common\model\User;
|
|
|
|
class Distribution extends ApiBase
|
|
{
|
|
|
|
/**
|
|
* 填写邀请码
|
|
*/
|
|
public function code()
|
|
{
|
|
$code = $this->request->post('code');
|
|
$data = [
|
|
'user_id' => $this->user_id,
|
|
'code' => $code,
|
|
];
|
|
$result = $this->validate($data, 'app\api\validate\DistributionCode');
|
|
if ($result !== true) {
|
|
$this->_error($result, [], 0, 0);
|
|
}
|
|
$result = DistributionLogic::code($code, $this->user_id);
|
|
if ($result !== true) {
|
|
$this->_error($result, [], 0, 0);
|
|
}
|
|
$this->_success();
|
|
}
|
|
|
|
/**
|
|
* 分销会员申请
|
|
*/
|
|
public function apple()
|
|
{
|
|
$post = $this->request->post();
|
|
$post['user_id'] = $this->user_id;
|
|
$result = $this->validate($post, 'app\api\validate\DistributionApply');
|
|
if ($result !== true) {
|
|
$this->_error($result);
|
|
}
|
|
$result = DistributionLogic::apple($post,$this->user_id);
|
|
if ($result !== true) {
|
|
$this->_error($result);
|
|
}
|
|
$this->_success();
|
|
}
|
|
|
|
/**
|
|
* 最新的分销会员申请详情
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function appleDetail()
|
|
{
|
|
$this->_success('',DistributionLogic::appleDetail($this->user_id));
|
|
}
|
|
|
|
|
|
/**
|
|
* Desc: 我的分销上级
|
|
*/
|
|
public function myLeader()
|
|
{
|
|
$this->_success('', DistributionLogic::myLeader($this->user_id));
|
|
}
|
|
|
|
|
|
/**
|
|
* 分销推广主页信息
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function index()
|
|
{
|
|
$this->_success('', DistributionLogic::index($this->user_id));
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 分销订单
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function order()
|
|
{
|
|
$get = $this->request->get();
|
|
$page = $this->request->get('page_no', $this->page_no);
|
|
$size = $this->request->get('page_size', $this->page_size);
|
|
$this->_success('', DistributionLogic::order($this->user_id, $get, $page, $size));
|
|
}
|
|
|
|
|
|
/**
|
|
* 月度账单
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function monthBill()
|
|
{
|
|
$page = $this->request->get('page_no', $this->page_no);
|
|
$size = $this->request->get('page_size', $this->page_size);
|
|
$this->_success('', DistributionLogic::getMonthBill($this->user_id, $page, $size));
|
|
}
|
|
|
|
/**
|
|
* 月度账单明细
|
|
*/
|
|
public function monthDetail()
|
|
{
|
|
$get = $this->request->get();
|
|
$page = $this->request->get('page_no', $this->page_no);
|
|
$size = $this->request->get('page_size', $this->page_size);
|
|
$this->_success('', DistributionLogic::getMonth($get, $this->user_id, $page, $size));
|
|
}
|
|
|
|
|
|
/**
|
|
* Notes: 分销会员页面判断
|
|
* @author kiki
|
|
*/
|
|
public function check()
|
|
{
|
|
$user = User::get($this->user_id);
|
|
if ($user['freeze_distribution'] == 1) {
|
|
$this->_error('您已被冻结');
|
|
}
|
|
|
|
if ($user['is_distribution'] == 1) {
|
|
$this->_success('', '', 10001);//已是分销会员
|
|
} else {
|
|
$this->_success('', '',20001);//未是分销会员
|
|
}
|
|
}
|
|
} |