49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
namespace addon\saas\api\controller;
|
|
use addon\saas\model\Config as ConfigModel;
|
|
use addon\saas\model\ManageUser;
|
|
use app\api\controller\BaseApi;
|
|
class Apply extends BaseApi
|
|
{
|
|
public function status()
|
|
{
|
|
$token = $this->checkToken();
|
|
if ($token['code'] < 0) return $this->response($token);
|
|
$condition = [
|
|
['site_id', '=', $this->site_id],
|
|
['member_id', '=', $this->member_id],
|
|
];
|
|
$status = model('manage_user')->getInfo($condition, 'status');
|
|
return $this->response($this->success($status));
|
|
}
|
|
|
|
|
|
/***
|
|
* 申请灵工
|
|
* @return false|string
|
|
*/
|
|
public function applymanage()
|
|
{
|
|
$token = $this->checkToken();
|
|
if ($token['code'] < 0) return $this->response($token);
|
|
$model = new ConfigModel();
|
|
$basics_config = $model->getBasicsConfig($this->site_id)['data']['value'];
|
|
if ($basics_config['is_member_settled'] == 1) {
|
|
$ManageUser = new ManageUser();
|
|
if ($basics_config['is_invite'] && !$this->params['rcode']) return $this->response($this->error('', '请输入邀请码'));
|
|
$condition = [
|
|
['site_id', '=', $this->site_id],
|
|
['rcode', '=', $this->params['rcode']],
|
|
];
|
|
$parent = (array)model('manage_user')->getInfo($condition, 'id,parent,grand_parent');
|
|
if ($this->params['rcode'] && empty($parent['id'])) {
|
|
return $this->response($this->error('', '无效邀请码'));
|
|
}
|
|
$this->params['member_id']=$this->member_id;
|
|
$res = $ManageUser->applyManage(array_merge($this->params, $parent), $basics_config);
|
|
return $this->response($res);
|
|
} else {
|
|
return $this->response($this->error('', '未开启申请通道'));
|
|
}
|
|
}
|
|
} |