246 lines
8.0 KiB
PHP
246 lines
8.0 KiB
PHP
<?php
|
|
|
|
namespace addon\commission\shop\controller;
|
|
|
|
use addon\commission\model\Account;
|
|
use addon\commission\model\CommissionRecord;
|
|
use addon\commission\model\Legumes;
|
|
use addon\commission\model\Partner;
|
|
use addon\commission\model\WeightValue;
|
|
use app\model\NewBaseModel;
|
|
use app\shop\controller\BaseShop;
|
|
use addon\commission\model\Setting;
|
|
use Exception;
|
|
|
|
class Index extends BaseShop{
|
|
/**
|
|
* Common: 记录列表
|
|
* Author: wu-hui
|
|
* Time: 2024/05/03 17:36
|
|
* @return array|mixed
|
|
*/
|
|
public function index(){
|
|
if (request()->isAjax()) {
|
|
// 参数获取
|
|
$page = input('page', 1);
|
|
$params = [
|
|
'member_id' => input('member_id', ''),
|
|
'site_id' => input('site_id', ''),
|
|
'order_no' => input('order_no', ''),
|
|
'goods_id' => input('goods_id', ''),
|
|
];
|
|
return (new CommissionRecord())->getPageList($page, $params, $this->site_id);
|
|
}
|
|
$this->forthMenu();
|
|
return $this->fetch("index/index");
|
|
}
|
|
/**
|
|
* Common: 获取抽成记录统计信息
|
|
* Author: wu-hui
|
|
* Time: 2024/05/13 9:48
|
|
* @return array
|
|
*/
|
|
public function recordStatistics(){
|
|
$params = [
|
|
'member_id' => input('member_id', ''),
|
|
'site_id' => input('site_id', ''),
|
|
'order_no' => input('order_no', ''),
|
|
'goods_id' => input('goods_id', ''),
|
|
];
|
|
$data = (new CommissionRecord())->getStatistics($params, $this->site_id);
|
|
|
|
return success(0, 'success', [
|
|
['className' => 'el-icon-coin','count' => $data['total_real_goods_money'],'name' => '订单总金额'],
|
|
['className' => 'el-icon-coin','count' => $data['total_integral_money'],'name' => '积分抽成总金额'],
|
|
['className' => 'el-icon-coin','count' => $data['total_operations_money'],'name' => '运营抽成总金额'],
|
|
['className' => 'el-icon-coin','count' => $data['total_partner_money'],'name' => '合伙人抽成总金额'],
|
|
['className' => 'el-icon-coin','count' => $data['total_merchants_money'],'name' => '招商员抽成总金额'],
|
|
['className' => 'el-icon-coin','count' => $data['total_promoter_money'],'name' => '推广员抽成总金额'],
|
|
]);
|
|
}
|
|
/**
|
|
* Common: 权重值 - 持有列表
|
|
* Author: wu-hui
|
|
* Time: 2024/05/04 16:01
|
|
* @return array|mixed
|
|
*/
|
|
public function weightValue(){
|
|
if (request()->isAjax()) {
|
|
// 参数获取
|
|
$page = input('page', 1);
|
|
$params = [
|
|
'member_id' => input('member_id', '')
|
|
];
|
|
return (new WeightValue())->getPageList($page, $params, $this->site_id);
|
|
}
|
|
|
|
$this->forthMenu();
|
|
return $this->fetch("index/weight_value");
|
|
}
|
|
/**
|
|
* Common: 权重值 - 变更记录明细
|
|
* Author: wu-hui
|
|
* Time: 2024/05/04 16:07
|
|
* @return array
|
|
*/
|
|
public function weightValueLog(){
|
|
$page = input('page', 1);
|
|
$params = [
|
|
'site_id' => input('site_id',''),
|
|
'member_id' => input('member_id',''),
|
|
'level_id' => input('level_id',''),
|
|
];
|
|
|
|
return (new WeightValue())->getLogPageList($page, $params);
|
|
}
|
|
/**
|
|
* Common: 合伙人佣金 - 周期记录
|
|
* Author: wu-hui
|
|
* Time: 2024/05/09 10:54
|
|
* @return array|mixed
|
|
*/
|
|
public function partner(){
|
|
if (request()->isAjax()) {
|
|
// 参数获取
|
|
$page = input('page', 1);
|
|
$params = [];
|
|
return (new Partner())->getPageList($page, $params, $this->site_id);
|
|
}
|
|
|
|
$this->forthMenu();
|
|
return $this->fetch("index/partner");
|
|
}
|
|
/**
|
|
* Common: 合伙人佣金 - 分红记录
|
|
* Author: wu-hui
|
|
* Time: 2024/05/09 10:54
|
|
* @return array
|
|
*/
|
|
public function partnerLog(){
|
|
$page = input('page', 1);
|
|
$params = [
|
|
'site_id' => input('site_id',''),
|
|
'member_id' => input('member_id',''),
|
|
'cycle_id' => input('cycle_id',''),
|
|
];
|
|
|
|
return (new Partner())->getLogPageList($page, $params);
|
|
}
|
|
/**
|
|
* Common: 获取豆豆积分
|
|
* Author: wu-hui
|
|
* Time: 2024/05/13 10:30
|
|
* @return array
|
|
*/
|
|
public function getLegumesStatistics(){
|
|
// 获取实时豆豆价格
|
|
$legumesPrice = (new Setting())->getLegumesPrice();
|
|
$params = [
|
|
'legumes_id' => input('legumes_id',''),
|
|
'member_id' => input('member_id',''),
|
|
'status' => input('status',''),
|
|
];
|
|
$data = (new Legumes())->getTotalStatistics($params);
|
|
|
|
return success(0, 'success', [
|
|
['className' => 'el-icon-coin','count' => $legumesPrice,'name' => '当前豆豆价格'],
|
|
['className' => 'el-icon-coin','count' => $data['total_get_legumes'],'name' => '已分配豆豆'],
|
|
['className' => 'el-icon-coin','count' => $data['total_order_money'],'name' => '订单总金额(积分上限)'],
|
|
['className' => 'el-icon-coin','count' => $data['total_get_integral'],'name' => '已产生积分'],
|
|
['className' => 'el-icon-coin','count' => $data['total_use_integral'],'name' => '已使用积分'],
|
|
['className' => 'el-icon-coin','count' => $data['total_freeze_integral'],'name' => '冻结中积分'],
|
|
]);
|
|
}
|
|
/**
|
|
* Common: 豆豆积分 - 周期记录
|
|
* Author: wu-hui
|
|
* Time: 2024/05/09 11:55
|
|
* @return array|mixed
|
|
*/
|
|
public function legumes(){
|
|
if (request()->isAjax()) {
|
|
// 参数获取
|
|
$page = input('page', 1);
|
|
$params = [];
|
|
return (new Legumes())->getCycleList($page, $params);
|
|
}
|
|
|
|
$this->forthMenu();
|
|
return $this->fetch("index/legumes");
|
|
}
|
|
/**
|
|
* Common: 豆豆积分 - 分配记录
|
|
* Author: wu-hui
|
|
* Time: 2024/05/09 11:58
|
|
* @return array
|
|
*/
|
|
public function legumesLog(){
|
|
$page = input('page', 1);
|
|
$params = [
|
|
'legumes_id' => input('legumes_id',''),
|
|
'member_id' => input('member_id',''),
|
|
'status' => input('status',''),
|
|
];
|
|
|
|
return (new Legumes())->getLegumesLogList($page, $params);
|
|
}
|
|
/**
|
|
* Common: 豆豆积分 - 持有记录
|
|
* Author: wu-hui
|
|
* Time: 2024/05/09 13:46
|
|
* @return array
|
|
*/
|
|
public function legumesHoldList(){
|
|
$page = input('page', 1);
|
|
$params = [
|
|
'member_id' => input('member_id',''),
|
|
];
|
|
|
|
return (new Legumes())->getHoldList($page, $params);
|
|
}
|
|
// 佣金流水列表
|
|
public function accountList(){
|
|
if (request()->isAjax()) {
|
|
// 参数获取
|
|
$params = [
|
|
'member_id' => input('member_id',''),
|
|
'account_type' => input('account_type',''),
|
|
'status' => input('status',''),
|
|
'page' => input('page',1),
|
|
'page_size' => input('limit',10),
|
|
];
|
|
|
|
return (new Account())->accountListV2($params);
|
|
}
|
|
$this->forthMenu();
|
|
return $this->fetch("index/account_list");
|
|
}
|
|
|
|
|
|
/**
|
|
* Common: 基本设置
|
|
* Author: wu-hui
|
|
* Time: 2024/04/29 16:36
|
|
* @return array|mixed
|
|
*/
|
|
public function set(){
|
|
if (request()->isAjax()) {
|
|
// 参数获取
|
|
$info = input('set',[]);
|
|
(new Setting())->setConfig((int)$this->site_id, (array)$info);
|
|
|
|
return success(0, '修改成功');
|
|
}
|
|
else {
|
|
$set = (new Setting())->getConfig((int)$this->site_id);
|
|
$adminSet = (new Setting())->getConfig();
|
|
$this->forthMenu();
|
|
|
|
return $this->fetch("index/set",[
|
|
'set' => json_encode($set, JSON_UNESCAPED_UNICODE),
|
|
'admin_set' => json_encode($adminSet, JSON_UNESCAPED_UNICODE),
|
|
]);
|
|
}
|
|
}
|
|
}
|