71 lines
3.3 KiB
PHP
71 lines
3.3 KiB
PHP
<?php
|
|
namespace addon\saas\api\controller;
|
|
use app\api\controller\BaseApi;
|
|
use addon\saas\model\ManageUser;
|
|
use addon\aliapp\model\AliPayApplet;
|
|
class Manage extends BaseApi
|
|
{
|
|
/***
|
|
*渠道商信息
|
|
* @return false|string
|
|
*/
|
|
public function detail()
|
|
{
|
|
$token = $this->checkToken();
|
|
if ($token['code'] < 0) return $this->response($token);
|
|
$manage_user_model = new ManageUser();
|
|
$condition = [
|
|
['f.site_id', '=', $this->site_id],
|
|
];
|
|
$condition[] = ['f.member_id', '=', $this->member_id];
|
|
$manage_user_info = $manage_user_model->getManageInfo($condition);
|
|
if (!empty($manage_user_info['data'])) {
|
|
$manage_user_info['data']['in_progress_money'] = '--'; //预计收入待完成
|
|
$manage_user_info['data']['in_extra_reward'] = '--'; //预计收入待完成
|
|
$one_commission = model('manage_order')->getSum([['one_manage_id', '=', $manage_user_info['data']['id']], ['is_settlement', '=', 0]], 'one_commission');
|
|
$two_commission = model('manage_order')->getSum([['two_manage_id', '=', $manage_user_info['data']['id']], ['is_settlement', '=', 0]], 'two_commission');
|
|
$three_commission = model('manage_order')->getSum([['three_manage_id', '=', $manage_user_info['data']['id']], ['is_settlement', '=', 0]], 'three_commission');
|
|
$manage_user_info['data']['in_progress_money'] = $one_commission;
|
|
$manage_user_info['data']['in_extra_reward'] = $two_commission + $three_commission + $manage_user_info['data']['contribute_number'];
|
|
$manage_user_info['data']['siteNum'] = model('site')->getCount([['manage_id', '=', $manage_user_info['data']['id']]]); //商家数量
|
|
$manage_user_info['data']['teamNum'] = $manage_user_info['data']['one_child_num'] + $manage_user_info['data']['two_child_num']; //团队数量
|
|
$condition_result = $manage_user_model->geNextLevel($manage_user_info['data'], $manage_user_info['data']['site_id']);
|
|
$manage_user_info['data']['condition'] = $condition_result; //团队数量
|
|
$manage_user_info['data']['mini_app_status'] = 0;
|
|
unset($manage_user_info['data']['chain']);
|
|
if ($manage_user_info['data']['my_site_id'] > 0) {
|
|
$ver = (new AliPayApplet($manage_user_info['data']['my_site_id']))->getNewVersionInfo();
|
|
if ($ver && in_array($ver['version_status'], ['AUDIT_REJECT', 'RELEASE'])) {
|
|
$manage_user_info['data']['mini_app_status'] = 1;
|
|
}
|
|
}
|
|
}else{
|
|
$manage_user_info['data'] = [
|
|
'id'=>0
|
|
];
|
|
}
|
|
return $this->response($manage_user_info);
|
|
}
|
|
|
|
|
|
/***
|
|
* 我的团队
|
|
* @return false|string
|
|
*/
|
|
public function team()
|
|
{
|
|
$token = $this->checkToken();
|
|
if ($token['code'] < 0) return $this->response($token);
|
|
$page = $this->params['page'] ?? 1;
|
|
$page_size = $this->params['page_size'] ?? PAGE_LIST_ROWS;
|
|
$level = $this->params['level'] ?? 1;
|
|
$model = new ManageUser();
|
|
// if ($this->member_id == 5) { //测试
|
|
// $this->member_id = 13;
|
|
// $level = 1;
|
|
// }
|
|
$list = $model->getManageTeam($level, $this->member_id, $page, $page_size);
|
|
return $this->response($list);
|
|
}
|
|
}
|