2020-11-20 16:02:54 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
/*
|
|
|
|
|
|
* @Descripttion:
|
|
|
|
|
|
* @version:
|
|
|
|
|
|
* @Author: kangkang
|
|
|
|
|
|
* @Date: 2020-10-13 19:52:37
|
2023-08-10 17:34:39 +08:00
|
|
|
|
* @LastEditors: “wanyongkang” “937888580@qq.com”
|
2024-03-25 11:06:00 +08:00
|
|
|
|
* @LastEditTime: 2024-03-25 11:04:41
|
2020-11-20 16:02:54 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
namespace app\manager\controller;
|
|
|
|
|
|
|
|
|
|
|
|
use app\manager\model\FollowRecord;
|
|
|
|
|
|
use app\manager\model\Manager;
|
|
|
|
|
|
use app\manager\model\ProductAccount;
|
|
|
|
|
|
use app\manager\model\ProductOrder;
|
|
|
|
|
|
use app\manager\model\User;
|
|
|
|
|
|
use app\manager\model\UserScore;
|
|
|
|
|
|
use enum\account\ProductAccount as ProductAccountEnum;
|
2020-11-24 14:57:04 +08:00
|
|
|
|
use enum\order\ProductOrder as ProductOrderEnum;
|
2020-11-20 16:02:54 +08:00
|
|
|
|
use enum\order\UserScore as UserScoreEnum;
|
|
|
|
|
|
use enum\user\User as UserEnum;
|
|
|
|
|
|
use fastphp\base\Controller;
|
2024-03-20 09:42:07 +08:00
|
|
|
|
use Qiniu\Auth;
|
|
|
|
|
|
use Qiniu\Storage\UploadManager;
|
2024-03-22 11:17:35 +08:00
|
|
|
|
use app\order\model\UserChargeOrder;
|
|
|
|
|
|
use app\http\model\Recharge as httpRechargeModel;
|
|
|
|
|
|
use app\ros\model\Order as RosOrderModel;
|
|
|
|
|
|
use app\jinqiao\model\Order as JinqiaoOrderModel;
|
2020-11-20 16:02:54 +08:00
|
|
|
|
|
|
|
|
|
|
class UserFollow extends Controller
|
|
|
|
|
|
{
|
2024-03-20 09:42:07 +08:00
|
|
|
|
private $accessKey = 'AfRhvJoAKL24ftGcHMor1WwSpVdular7L7X97JNY';
|
|
|
|
|
|
private $secretKey = 'OyyU-6M45oDZAlVsf8fH0RFALGxTNHAT-yR6cmtU';
|
|
|
|
|
|
private $bucket = 'yewutu';
|
2020-11-20 16:02:54 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @description: 获取消费统计页面列表数据
|
|
|
|
|
|
* @param {*}
|
|
|
|
|
|
* @return {*}
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function getList()
|
|
|
|
|
|
{
|
|
|
|
|
|
$page = 0;
|
|
|
|
|
|
$search = [];
|
|
|
|
|
|
$where = [];
|
|
|
|
|
|
$sort_where = [];
|
|
|
|
|
|
$cost_where = '';
|
|
|
|
|
|
$time_where1 = '';
|
|
|
|
|
|
$time_where2 = '';
|
|
|
|
|
|
$time_where3 = '';
|
2020-11-24 15:56:59 +08:00
|
|
|
|
$time_where_pre = '';
|
|
|
|
|
|
$time_where_now = '';
|
2020-11-20 16:02:54 +08:00
|
|
|
|
$user_search_id = [];
|
|
|
|
|
|
$user_search_id_list = [];
|
2020-11-25 10:28:46 +08:00
|
|
|
|
$limit = '50';
|
2020-11-20 16:02:54 +08:00
|
|
|
|
|
|
|
|
|
|
//判断是否是筛选
|
|
|
|
|
|
$is_screen = false;
|
|
|
|
|
|
|
|
|
|
|
|
$user_model = new User;
|
|
|
|
|
|
$manager_model = new Manager;
|
|
|
|
|
|
$user_score_enum = new UserScoreEnum;
|
|
|
|
|
|
$user_score_model = new UserScore;
|
|
|
|
|
|
$product_order_model = new ProductOrder;
|
|
|
|
|
|
$product_account_model = new ProductAccount;
|
|
|
|
|
|
$product_account_enum = new ProductAccountEnum;
|
|
|
|
|
|
$user_enum = new UserEnum;
|
|
|
|
|
|
|
|
|
|
|
|
$manager_info = $manager_model->getOne(['id' => $this->userinfo['OperaterID']]);
|
|
|
|
|
|
if (!$manager_info['IsRoot']) {
|
|
|
|
|
|
$where['ManagerId'] = $this->userinfo['OperaterID'];
|
|
|
|
|
|
$sort_where['ManagerId'] = $this->userinfo['OperaterID'];
|
2023-08-10 17:34:39 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
if (!empty($_GET['search']['manager_id'])) {
|
|
|
|
|
|
$where['ManagerId'] = $_GET['search']['manager_id'];
|
|
|
|
|
|
$sort_where['ManagerId'] = $_GET['search']['manager_id'];
|
|
|
|
|
|
}
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['PageIndex'])) {
|
|
|
|
|
|
$page = ($_GET['PageIndex'] - 1) * 50;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (isset($_GET['search'])) {
|
|
|
|
|
|
$search = $_GET['search'];
|
|
|
|
|
|
if (!empty($search['profile'])) {
|
|
|
|
|
|
$where['follow_status'] = $search['profile'];
|
2020-11-25 16:42:25 +08:00
|
|
|
|
$sort_where['follow_status'] = $search['profile'];
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!empty($search['keyWord'])) {
|
|
|
|
|
|
$where['LoginCode'] = ['like', '%' . $search['keyWord'] . '%'];
|
2021-05-28 17:06:09 +08:00
|
|
|
|
unset($where['ManagerId']);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
$flag = date("d", time()) == date("t", time());
|
|
|
|
|
|
$date1 = date("Y-m-01", strtotime("-1 month"));
|
|
|
|
|
|
$date2 = $flag ? date("Y-m-t H:i:s", strtotime("-1 month")) : date("Y-m-d H:i:s", strtotime("-1 month"));
|
|
|
|
|
|
$date3 = date("Y-m-01", time());
|
|
|
|
|
|
$date4 = date("Y-m-d H:i:s", time());
|
|
|
|
|
|
if (!empty($search['last_month']['s_time'])) {
|
2020-11-24 15:22:25 +08:00
|
|
|
|
$date1 = date('Y-m-d', strtotime($search['last_month']['s_time']));
|
|
|
|
|
|
$date2 = date('Y-m-d H:i:s', strtotime($search['last_month']['e_time']));
|
2021-03-01 13:50:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!empty($search['new_month']['s_time'])) {
|
2020-11-24 15:22:25 +08:00
|
|
|
|
$date3 = date('Y-m-d', strtotime($search['new_month']['s_time']));
|
|
|
|
|
|
$date4 = date('Y-m-d H:i:s', strtotime($search['new_month']['e_time']));
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-10 17:34:39 +08:00
|
|
|
|
//两个时间是单独分开的 不一定是连续两个月
|
2020-11-20 16:02:54 +08:00
|
|
|
|
//上月
|
|
|
|
|
|
$time_where1 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' ";
|
|
|
|
|
|
//本月
|
|
|
|
|
|
$time_where2 .= " UpdateTime>='" . $date3 . "' and UpdateTime<='" . $date4 . "' ";
|
|
|
|
|
|
|
2023-08-10 17:34:39 +08:00
|
|
|
|
//消费金额
|
2020-11-25 16:42:25 +08:00
|
|
|
|
if (!empty($search['money2'])) {
|
2020-11-20 16:02:54 +08:00
|
|
|
|
$is_screen = true;
|
|
|
|
|
|
switch ($search['cost_type']) {
|
|
|
|
|
|
case 0:
|
2020-11-25 16:42:25 +08:00
|
|
|
|
$time_where3 .= '';
|
2020-11-20 16:02:54 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
$time_where3 .= " product_order.UpdateTime>='" . $date1 . "' and product_order.UpdateTime<='" . $date2 . "' ";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
$time_where3 .= " product_order.UpdateTime>='" . $date3 . "' and product_order.UpdateTime<='" . $date4 . "' ";
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
$cost_where .= "having money >=" . $search['money1'] . " and money <=" . $search['money2'] . ' ';
|
2020-11-25 16:42:25 +08:00
|
|
|
|
if (empty($search['sortLable'])) {
|
|
|
|
|
|
$user_search_id = $product_order_model->getScreenCost($time_where3, $cost_where, "$page,50", $sort_where);
|
|
|
|
|
|
}
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!empty($search['sortLable'])) {
|
|
|
|
|
|
$is_screen = true;
|
2020-11-24 15:56:59 +08:00
|
|
|
|
$time_where_pre .= " product_order.UpdateTime>='" . $date1 . "' and product_order.UpdateTime<='" . $date2 . "' ";
|
|
|
|
|
|
$time_where_now .= " product_order.UpdateTime>='" . $date3 . "' and product_order.UpdateTime<='" . $date4 . "' ";
|
2020-11-20 16:02:54 +08:00
|
|
|
|
switch ($search['sortLable']) {
|
|
|
|
|
|
case 'all_amount':
|
2020-11-25 16:42:25 +08:00
|
|
|
|
$user_search_id = $product_order_model->getSort($sort_where, $search['sortOrder'], "$page,50", $time_where3, $cost_where);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 'PrevMonthAmount':
|
2020-11-25 16:42:25 +08:00
|
|
|
|
$user_search_id = $product_order_model->getMonthSort($sort_where, $search['sortOrder'], "$page,50", $time_where_pre, $cost_where);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 'MonthAmount':
|
2020-11-25 16:42:25 +08:00
|
|
|
|
$user_search_id = $product_order_model->getMonthSort($sort_where, $search['sortOrder'], "$page,50", $time_where_now, $cost_where);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 'account_count':
|
|
|
|
|
|
$user_search_id = $product_account_model->getSort($sort_where, $search['sortOrder'], "$page,50", 1);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'account_used':
|
2020-11-28 16:34:06 +08:00
|
|
|
|
$user_search_id = $product_account_model->getSort($sort_where, $search['sortOrder'], "$page,50", 2);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 'account_expire':
|
2020-11-28 16:34:06 +08:00
|
|
|
|
$user_search_id = $product_account_model->getSort($sort_where, $search['sortOrder'], "$page,50", 3);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-03-23 19:03:49 +08:00
|
|
|
|
if ($is_screen && empty($user_search_id)) {
|
|
|
|
|
|
\result([
|
|
|
|
|
|
'list' => [],
|
|
|
|
|
|
'count' => 0,
|
|
|
|
|
|
'types' => [],
|
|
|
|
|
|
]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-20 16:02:54 +08:00
|
|
|
|
//将筛选出来额的userid进行处理
|
|
|
|
|
|
if (!empty($user_search_id)) {
|
|
|
|
|
|
foreach ($user_search_id as $v) {
|
|
|
|
|
|
$user_search_id_list[] = $v['UserId'];
|
|
|
|
|
|
}
|
|
|
|
|
|
$where['Id'] = ['in', $user_search_id_list];
|
|
|
|
|
|
}
|
2024-01-12 16:34:11 +08:00
|
|
|
|
if (empty($user_search_id_list)) {
|
2020-11-25 10:28:46 +08:00
|
|
|
|
$limit = "$page,50";
|
2024-01-12 16:34:11 +08:00
|
|
|
|
}
|
2020-11-25 16:42:25 +08:00
|
|
|
|
|
2023-08-10 17:34:39 +08:00
|
|
|
|
$user_list = $user_model->getListPage($where, 'Id,follow_status,LoginCode,CreateTime,Wx,QQ,pay_time,is_verify,ProductAccountCount,ManagerName', 'id desc', $limit);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
$list = [];
|
|
|
|
|
|
$user_id_list = [];
|
|
|
|
|
|
|
|
|
|
|
|
//获取用户列表
|
|
|
|
|
|
foreach ($user_list as $info) {
|
2023-08-10 17:34:39 +08:00
|
|
|
|
$isverify = ['未实名','已实名','被禁用'];
|
|
|
|
|
|
|
|
|
|
|
|
$verify_status = $isverify[$info['is_verify']];
|
|
|
|
|
|
if ($info['is_verify'] == 1) {
|
|
|
|
|
|
$istest = ['未测试','已测试'];
|
|
|
|
|
|
$verify_status = $istest[$info['ProductAccountCount']];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$info['ManagerName'] = $info['ManagerName'];
|
2020-11-25 13:33:53 +08:00
|
|
|
|
$info['last_pay_time'] = $info['pay_time'];
|
2023-08-10 17:34:39 +08:00
|
|
|
|
$info['is_verify'] = $verify_status;
|
|
|
|
|
|
$info['follow_status'] = $user_enum::$FollowStatus[$info['follow_status']]??$user_enum::$FollowStatus[1];
|
2021-03-19 16:32:26 +08:00
|
|
|
|
$info['UserName'] = mb_substr($info['LoginCode'], 0, 3) . '***' . mb_substr($info['LoginCode'], -3);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
$info['all_amount'] = 0;
|
|
|
|
|
|
$info['PrevMonthAmount'] = 0;
|
|
|
|
|
|
$info['MonthAmount'] = 0;
|
|
|
|
|
|
$info['AddAmount'] = 0;
|
|
|
|
|
|
$info['persent'] = '0%';
|
|
|
|
|
|
$info['account_count'] = 0;
|
|
|
|
|
|
$info['account_used'] = 0;
|
|
|
|
|
|
$info['account_expire'] = 0;
|
|
|
|
|
|
$list[$info['Id']] = $info;
|
|
|
|
|
|
$user_id_list[] = $info['Id'];
|
|
|
|
|
|
}
|
|
|
|
|
|
//获取总消费金额
|
|
|
|
|
|
$all_cost = $product_order_model->getAllCost($user_id_list);
|
|
|
|
|
|
foreach ($all_cost as $info) {
|
|
|
|
|
|
$list[$info['UserId']]['all_amount'] = $info['money'];
|
|
|
|
|
|
}
|
|
|
|
|
|
//获取上一个月、本月消费
|
|
|
|
|
|
$last_month_cost = $product_order_model->getPreMonthCost($user_id_list, $time_where1);
|
|
|
|
|
|
$new_month_cost = $product_order_model->getPreMonthCost($user_id_list, $time_where2);
|
|
|
|
|
|
foreach ($last_month_cost as $info) {
|
|
|
|
|
|
$list[$info['UserId']]['PrevMonthAmount'] = $info['money'];
|
|
|
|
|
|
$list[$info['UserId']]['AddAmount'] = -$info['money'];
|
|
|
|
|
|
}
|
|
|
|
|
|
//消费统计比对
|
|
|
|
|
|
foreach ($new_month_cost as $info) {
|
|
|
|
|
|
$list[$info['UserId']]['MonthAmount'] = $info['money'];
|
2020-11-25 16:49:53 +08:00
|
|
|
|
$list[$info['UserId']]['AddAmount'] = round($info['money'] - $list[$info['UserId']]['PrevMonthAmount'],2);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
if ($list[$info['UserId']]['PrevMonthAmount'] != 0) {
|
|
|
|
|
|
$list[$info['UserId']]['persent'] = round(($info['money'] - $list[$info['UserId']]['PrevMonthAmount']) / $list[$info['UserId']]['PrevMonthAmount'] * 100, 2) . '%';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$list[$info['UserId']]['persent'] = '100%';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//帐号计算
|
|
|
|
|
|
$account_use_where = ['DeleteTag' => 0, 'UserID' => ['in', $user_id_list], 'EndTime' => ['>', date('Y-m-d H:i:s')], 'AccountType' => ['<>', $product_account_enum::$Test]];
|
|
|
|
|
|
$account_expire_where = ['DeleteTag' => 0, 'UserID' => ['in', $user_id_list], 'EndTime' => ['<=', date('Y-m-d H:i:s')], 'AccountType' => ['<>', $product_account_enum::$Test]];
|
|
|
|
|
|
$account_used = $product_account_model->getUesdAccount($account_use_where);
|
|
|
|
|
|
$account_expire = $product_account_model->getUesdAccount($account_expire_where);
|
|
|
|
|
|
foreach ($account_used as $info) {
|
|
|
|
|
|
$list[$info['UserId']]['account_used'] = $info['used_count'];
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach ($account_expire as $info) {
|
|
|
|
|
|
$list[$info['UserId']]['account_expire'] = $info['used_count'];
|
2020-11-28 16:21:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
foreach ($user_id_list as $user_account_id){
|
|
|
|
|
|
$list[$user_account_id]['account_count'] = $list[$user_account_id]['account_used'] + $list[$user_account_id]['account_expire'];
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($search['sortLable'])) {
|
|
|
|
|
|
$sort = $search['sortOrder'] ? SORT_ASC : SORT_DESC;
|
|
|
|
|
|
$field = array_column($list, $search['sortLable']);
|
|
|
|
|
|
array_multisort($field, $sort, $list);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-24 14:57:04 +08:00
|
|
|
|
$data_count = 0;
|
|
|
|
|
|
if (empty($search['sortLable'])) {
|
|
|
|
|
|
$data_count = $user_model->getCount($where)['count'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-20 16:02:54 +08:00
|
|
|
|
$data = [
|
|
|
|
|
|
'list' => array_merge($list),
|
2020-11-24 14:57:04 +08:00
|
|
|
|
'count' => $data_count,
|
2020-11-20 16:02:54 +08:00
|
|
|
|
'types' => $user_enum->getFormatList($user_enum::$FollowStatus),
|
|
|
|
|
|
];
|
|
|
|
|
|
\result($data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description: 获取跟进记录
|
|
|
|
|
|
* @param {*}
|
|
|
|
|
|
* @return {*}
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function getFollowRecord()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!isset($_GET['id'])) {
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
|
|
$follow_rcord = new FollowRecord;
|
2020-11-26 17:24:22 +08:00
|
|
|
|
$manager_model = new Manager;
|
2021-11-16 16:39:13 +08:00
|
|
|
|
$data = $follow_rcord->getNewRecord(['user_id' => $id],'10');
|
2020-11-26 17:24:22 +08:00
|
|
|
|
$list = [];
|
|
|
|
|
|
foreach ($data as $info){
|
|
|
|
|
|
$manager_info = $manager_model->getOne(['id'=>$info['op_user']],'RealName');
|
|
|
|
|
|
$info['op_user'] = $manager_info['RealName'];
|
2024-03-22 11:17:35 +08:00
|
|
|
|
switch($info['product_type']) {
|
|
|
|
|
|
case 'other_order':
|
|
|
|
|
|
$info['product_type'] = '其他IP产品订单';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'mogu_order':
|
|
|
|
|
|
$info['product_type'] = '蘑菇IP订单';
|
|
|
|
|
|
break;
|
2024-07-15 18:03:00 +08:00
|
|
|
|
|
|
|
|
|
|
case 'jihu_order':
|
|
|
|
|
|
$info['product_type'] = '极狐IP订单';
|
|
|
|
|
|
break;
|
2024-03-22 11:17:35 +08:00
|
|
|
|
case 'recharge':
|
|
|
|
|
|
$info['product_type'] = 'IP充值';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'http':
|
|
|
|
|
|
$info['product_type'] = 'HTTP充值';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'ros':
|
|
|
|
|
|
$info['product_type'] = '软路由订单';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'jinqiao':
|
|
|
|
|
|
$info['product_type'] = '金桥投屏订单';
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
$info['sell_type'] = $info['sell_type']?'主动':'被动';
|
2020-11-26 17:24:22 +08:00
|
|
|
|
$list[] = $info;
|
|
|
|
|
|
}
|
2020-11-20 16:02:54 +08:00
|
|
|
|
\result($list);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-16 16:39:13 +08:00
|
|
|
|
public function getAllFollowRecord()
|
|
|
|
|
|
{
|
|
|
|
|
|
$get = $_GET['data'];
|
|
|
|
|
|
$page = 0;
|
|
|
|
|
|
$page = ($get['PageIndex'] - 1) * 50;
|
|
|
|
|
|
//超级管理员
|
2024-04-15 13:40:00 +08:00
|
|
|
|
$super_manager_list = [282,993,1013];
|
2021-11-16 16:39:13 +08:00
|
|
|
|
$user_enum = new UserEnum;
|
|
|
|
|
|
$manager_id = $this->userinfo['OperaterID'];
|
|
|
|
|
|
$follow_rcord = new FollowRecord;
|
2021-11-24 14:59:13 +08:00
|
|
|
|
//获取管理员
|
|
|
|
|
|
$manager_model = new Manager;
|
2022-01-14 16:23:28 +08:00
|
|
|
|
$manager_list = $manager_model->getList([],'id,RealName');
|
2021-11-24 14:59:13 +08:00
|
|
|
|
$manager_id_list = [];
|
|
|
|
|
|
foreach ($manager_list as $info) {
|
|
|
|
|
|
$manager_id_list[$info['id']] = $info;
|
|
|
|
|
|
}
|
2021-11-16 16:39:13 +08:00
|
|
|
|
$where = '';
|
|
|
|
|
|
//只查询当前管理员操作的记录
|
|
|
|
|
|
if (!in_array($manager_id,$super_manager_list)){
|
2021-11-23 16:46:29 +08:00
|
|
|
|
$where .= "op_user='". $manager_id ."'";
|
2021-11-16 16:39:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
//根据日期查询
|
|
|
|
|
|
if (!empty($get['s_time'])) {
|
|
|
|
|
|
$date1 = date('Y-m-d', strtotime($get['s_time']));
|
|
|
|
|
|
$date2 = date('Y-m-d H:i:s', strtotime($get['e_time']));
|
2022-01-15 09:55:38 +08:00
|
|
|
|
if (!empty($where)) {
|
|
|
|
|
|
$where .= " AND ";
|
|
|
|
|
|
}
|
2021-11-16 16:39:13 +08:00
|
|
|
|
$where .= " create_time>='" . $date1 . "' and create_time<='" . $date2 . "' ";
|
|
|
|
|
|
}
|
2022-01-15 09:55:38 +08:00
|
|
|
|
//根据会员信息查询
|
|
|
|
|
|
if (!empty($get['search_info'])) {
|
|
|
|
|
|
$user_model = new User;
|
|
|
|
|
|
$user_where = "LoginCode = '".$get['search_info']."' OR Wx = '".$get['search_info']."' OR QQ = '".$get['search_info']."'";
|
|
|
|
|
|
$user_id = $user_model->getOneByStr($user_where, 'Id');
|
|
|
|
|
|
if (!empty($where)) {
|
|
|
|
|
|
$where .= " AND ";
|
|
|
|
|
|
}
|
|
|
|
|
|
$where .= " user_id=".$user_id['Id'].' ';
|
|
|
|
|
|
}
|
2021-11-16 16:39:13 +08:00
|
|
|
|
$list = $follow_rcord->getNewRecord($where,"$page,50");
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($list as &$info) {
|
|
|
|
|
|
$info['follow_status']=$user_enum::$FollowStatus[$info['follow_status']];
|
2021-11-24 14:59:13 +08:00
|
|
|
|
$info['manager'] = $manager_id_list[$info['op_user']]['RealName'];
|
2024-03-22 11:17:35 +08:00
|
|
|
|
switch($info['product_type']) {
|
|
|
|
|
|
case 'other_order':
|
|
|
|
|
|
$info['product_type'] = '其他IP产品订单';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'mogu_order':
|
|
|
|
|
|
$info['product_type'] = '蘑菇IP订单';
|
|
|
|
|
|
break;
|
2024-07-15 18:03:00 +08:00
|
|
|
|
case 'jihu_order':
|
|
|
|
|
|
$info['product_type'] = '极狐IP订单';
|
2024-03-22 11:17:35 +08:00
|
|
|
|
case 'recharge':
|
|
|
|
|
|
$info['product_type'] = 'IP充值';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'http':
|
|
|
|
|
|
$info['product_type'] = 'HTTP充值';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'ros':
|
|
|
|
|
|
$info['product_type'] = '软路由订单';
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'jinqiao':
|
|
|
|
|
|
$info['product_type'] = '金桥投屏订单';
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
$info['sell_type'] = $info['sell_type']?'主动':'被动';
|
2021-11-16 16:39:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
|
'Code' => 10000,
|
|
|
|
|
|
'Data' => $list,
|
|
|
|
|
|
'TotalCount' => (int)$follow_rcord->getCount($where)['count'],
|
|
|
|
|
|
'types' => $user_enum->getFormatList($user_enum::$FollowStatus),
|
|
|
|
|
|
];
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-01-14 16:07:59 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @description: 导出跟进记录
|
|
|
|
|
|
* @param {*}
|
|
|
|
|
|
* @return {*}
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function exportAllFollowRecord()
|
|
|
|
|
|
{
|
|
|
|
|
|
$get = [];
|
|
|
|
|
|
if (isset($_GET['data'])) {
|
|
|
|
|
|
$get = $_GET['data'];
|
|
|
|
|
|
}
|
|
|
|
|
|
//超级管理员
|
|
|
|
|
|
$super_manager_list = [282,993];
|
|
|
|
|
|
$user_enum = new UserEnum;
|
|
|
|
|
|
$manager_id = $this->userinfo['OperaterID'];
|
|
|
|
|
|
$follow_rcord = new FollowRecord;
|
|
|
|
|
|
//获取管理员
|
|
|
|
|
|
$manager_model = new Manager;
|
2022-01-14 16:23:28 +08:00
|
|
|
|
$manager_list = $manager_model->getList([],'id,RealName');
|
2022-01-14 16:07:59 +08:00
|
|
|
|
$manager_id_list = [];
|
|
|
|
|
|
foreach ($manager_list as $info) {
|
|
|
|
|
|
$manager_id_list[$info['id']] = $info;
|
|
|
|
|
|
}
|
|
|
|
|
|
$where = '';
|
|
|
|
|
|
//只查询当前管理员操作的记录
|
|
|
|
|
|
if (!in_array($manager_id,$super_manager_list)){
|
|
|
|
|
|
$where .= "op_user='". $manager_id ."'";
|
|
|
|
|
|
}
|
|
|
|
|
|
//根据日期查询
|
|
|
|
|
|
if (!empty($get['s_time'])) {
|
|
|
|
|
|
$date1 = date('Y-m-d', strtotime($get['s_time']));
|
|
|
|
|
|
$date2 = date('Y-m-d H:i:s', strtotime($get['e_time']));
|
|
|
|
|
|
$where .= " create_time>='" . $date1 . "' and create_time<='" . $date2 . "' ";
|
|
|
|
|
|
}
|
|
|
|
|
|
$list = $follow_rcord->getNewRecord($where,10000);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($list as &$info) {
|
|
|
|
|
|
$info['follow_status']=$user_enum::$FollowStatus[$info['follow_status']];
|
|
|
|
|
|
$info['manager'] = $manager_id_list[$info['op_user']]['RealName'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-01-14 16:25:05 +08:00
|
|
|
|
\exportToCsv('test.csv',['id','用户id','所属管理员id','跟进状态','是否最新记录','状态转换','备注','创建时间','管理员名称'],$list);
|
2022-01-14 16:07:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-20 16:02:54 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @description: 更改跟进状态
|
|
|
|
|
|
* @param {*}
|
|
|
|
|
|
* @return {*}
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function changeFolowStatus()
|
|
|
|
|
|
{
|
2024-03-20 09:42:07 +08:00
|
|
|
|
$data = $_POST;
|
|
|
|
|
|
$info = [];
|
|
|
|
|
|
|
2024-03-22 11:17:35 +08:00
|
|
|
|
if (!isset($_FILES['file'])) {
|
|
|
|
|
|
echo json_encode(
|
|
|
|
|
|
[
|
|
|
|
|
|
'Code' => 30000,
|
|
|
|
|
|
'msg' => '请上传文件'
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$follow_rcord = new FollowRecord;
|
|
|
|
|
|
//验证领取销售信息
|
|
|
|
|
|
$sell_info = [
|
|
|
|
|
|
'order_id' => null,
|
|
|
|
|
|
'product_type' => null,
|
|
|
|
|
|
'sell_money' => 0,
|
|
|
|
|
|
'sell_type' => 0,
|
|
|
|
|
|
];
|
2024-07-15 18:03:00 +08:00
|
|
|
|
if ($data['product_type'] == 'other_order' || $data['product_type'] == 'mogu_order' || $data['product_type'] == 'jihu_order') {
|
2024-03-22 11:17:35 +08:00
|
|
|
|
$sell_where = [
|
|
|
|
|
|
'UserId' => $data['user_id'],
|
|
|
|
|
|
'PaymentAmount' => $data['sell_money'],
|
|
|
|
|
|
'CreateTime' => ['>',date('Y-m-d',time()-10800)],
|
2024-03-25 11:06:00 +08:00
|
|
|
|
'Channel' => ['IS', NULL],
|
2024-03-22 11:17:35 +08:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
$product_order_model = new ProductOrder;
|
|
|
|
|
|
|
|
|
|
|
|
$is_ver = $product_order_model->getOne($sell_where);
|
|
|
|
|
|
|
|
|
|
|
|
if ($is_ver) {
|
|
|
|
|
|
$sell_info['order_id'] = $is_ver['Id'];
|
|
|
|
|
|
$sell_info['product_type'] = $data['product_type'];
|
|
|
|
|
|
$sell_info['sell_money'] = $data['sell_money'];
|
|
|
|
|
|
$sell_info['sell_type'] = $data['sell_type'];
|
|
|
|
|
|
}
|
2024-03-25 11:06:00 +08:00
|
|
|
|
$product_order_model->updateOne($sell_where,['Channel' => $this->userinfo['OperaterID']]);
|
2024-03-22 11:17:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
if ($data['product_type'] == 'recharge') {
|
|
|
|
|
|
$sell_where = [
|
|
|
|
|
|
'UserId' => $data['user_id'],
|
|
|
|
|
|
'PaymentAmount' => $data['sell_money'],
|
|
|
|
|
|
'CreateTime' => ['>',date('Y-m-d',time()-10800)],
|
2024-03-25 11:06:00 +08:00
|
|
|
|
'Channel' => ['IS', NULL],
|
2024-03-22 11:17:35 +08:00
|
|
|
|
];
|
|
|
|
|
|
$charge_model = new UserChargeOrder;
|
|
|
|
|
|
|
|
|
|
|
|
$is_ver = $charge_model->getOne($sell_where);
|
|
|
|
|
|
if ($is_ver) {
|
|
|
|
|
|
$sell_info['order_id'] = $is_ver['Id'];
|
|
|
|
|
|
$sell_info['product_type'] = $data['product_type'];
|
|
|
|
|
|
$sell_info['sell_money'] = $data['sell_money'];
|
|
|
|
|
|
$sell_info['sell_type'] = $data['sell_type'];
|
|
|
|
|
|
}
|
2024-03-25 11:06:00 +08:00
|
|
|
|
$charge_model->updateOne($sell_where,['Channel' => $this->userinfo['OperaterID']]);
|
2024-03-22 11:17:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
if ($data['product_type'] == 'http') {
|
|
|
|
|
|
$sell_where = [
|
|
|
|
|
|
'user_id' => $data['user_id'],
|
|
|
|
|
|
'pay_money' => $data['sell_money'],
|
|
|
|
|
|
'create_time' => ['>',date('Y-m-d',time()-10800)],
|
2024-03-25 11:06:00 +08:00
|
|
|
|
'channel' => ['IS', NULL],
|
2024-03-22 11:17:35 +08:00
|
|
|
|
];
|
|
|
|
|
|
$charge_model = new httpRechargeModel;
|
|
|
|
|
|
|
|
|
|
|
|
$is_ver = $charge_model->getOne($sell_where);
|
|
|
|
|
|
if ($is_ver) {
|
|
|
|
|
|
$sell_info['order_id'] = $is_ver['id'];
|
|
|
|
|
|
$sell_info['product_type'] = $data['product_type'];
|
|
|
|
|
|
$sell_info['sell_money'] = $data['sell_money'];
|
|
|
|
|
|
$sell_info['sell_type'] = $data['sell_type'];
|
|
|
|
|
|
}
|
2024-03-25 11:06:00 +08:00
|
|
|
|
$charge_model->updateOne($sell_where,['channel' => $this->userinfo['OperaterID']]);
|
2024-03-22 11:17:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
if ($data['product_type'] == 'ros') {
|
|
|
|
|
|
$sell_where = [
|
|
|
|
|
|
'user_id' => $data['user_id'],
|
|
|
|
|
|
'real_price' => $data['sell_money'],
|
|
|
|
|
|
'create_time' => ['>',date('Y-m-d',time()-10800)],
|
2024-03-25 11:06:00 +08:00
|
|
|
|
'channel' => ['IS', NULL],
|
2024-03-22 11:17:35 +08:00
|
|
|
|
];
|
|
|
|
|
|
$charge_model = new RosOrderModel;
|
|
|
|
|
|
|
|
|
|
|
|
$is_ver = $charge_model->getOne($sell_where);
|
|
|
|
|
|
if ($is_ver) {
|
|
|
|
|
|
$sell_info['order_id'] = $is_ver['id'];
|
|
|
|
|
|
$sell_info['product_type'] = $data['product_type'];
|
|
|
|
|
|
$sell_info['sell_money'] = $data['sell_money'];
|
|
|
|
|
|
$sell_info['sell_type'] = $data['sell_type'];
|
|
|
|
|
|
}
|
2024-03-25 11:06:00 +08:00
|
|
|
|
$charge_model->updateOne($sell_where,['channel' => $this->userinfo['OperaterID']]);
|
2024-03-22 11:17:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
if ($data['product_type'] == 'jinqiao') {
|
|
|
|
|
|
$sell_where = [
|
|
|
|
|
|
'user_id' => $data['user_id'],
|
|
|
|
|
|
'money' => $data['sell_money'],
|
|
|
|
|
|
'create_time' => ['>',date('Y-m-d',time()-10800)],
|
2024-03-25 11:06:00 +08:00
|
|
|
|
'channel' => ['IS', NULL],
|
2024-03-22 11:17:35 +08:00
|
|
|
|
];
|
|
|
|
|
|
$charge_model = new JinqiaoOrderModel;
|
|
|
|
|
|
|
|
|
|
|
|
$is_ver = $charge_model->getOne($sell_where);
|
|
|
|
|
|
if ($is_ver) {
|
|
|
|
|
|
$sell_info['order_id'] = $is_ver['id'];
|
|
|
|
|
|
$sell_info['product_type'] = $data['product_type'];
|
|
|
|
|
|
$sell_info['sell_money'] = $data['sell_money'];
|
|
|
|
|
|
$sell_info['sell_type'] = $data['sell_type'];
|
|
|
|
|
|
}
|
2024-03-25 11:06:00 +08:00
|
|
|
|
$charge_model->updateOne($sell_where,['channel' => $this->userinfo['OperaterID']]);
|
2024-03-22 11:17:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
if ($follow_rcord->getOne(['order_id' => $sell_info['order_id'],'product_type' => $sell_info['product_type']])){
|
|
|
|
|
|
echo json_encode(
|
|
|
|
|
|
[
|
|
|
|
|
|
'Code' => 30000,
|
|
|
|
|
|
'msg' => '该订单已经被其他客户经理领取'
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ( $sell_info['order_id'] == null){
|
|
|
|
|
|
echo json_encode(
|
|
|
|
|
|
[
|
|
|
|
|
|
'Code' => 30000,
|
|
|
|
|
|
'msg' => '订单信息不正确'
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
2024-03-20 09:42:07 +08:00
|
|
|
|
$file = $_FILES['file'];
|
|
|
|
|
|
|
|
|
|
|
|
$size_limit = 30 * 1024 * 1024;
|
|
|
|
|
|
if ($file['size']>$size_limit) {
|
|
|
|
|
|
echo json_encode(['code' => -1,'msg'=>'文件过大,仅限5M']);
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$auth = new Auth($this->accessKey, $this->secretKey);
|
|
|
|
|
|
// 初始化 UploadManager 对象并进行文件的上传。
|
|
|
|
|
|
$uploadMgr = new UploadManager();
|
|
|
|
|
|
// 需要填写你的 Access Key 和 Secret Key
|
|
|
|
|
|
// 构建鉴权对象
|
|
|
|
|
|
// 生成上传 Token
|
|
|
|
|
|
$token = $auth->uploadToken($this->bucket);
|
|
|
|
|
|
// 要上传文件的本地路径
|
|
|
|
|
|
$file_filePath = $file['tmp_name'];
|
|
|
|
|
|
// 上传到存储后保存的文件名
|
|
|
|
|
|
$file_key = $data['user_id'].'-'.time().'.png';
|
|
|
|
|
|
|
|
|
|
|
|
// 调用 UploadManager 的 putFile 方法进行文件的上传。
|
|
|
|
|
|
list($ret, $err) = $uploadMgr->putFile($token, $file_key, $file_filePath, null, 'application/octet-stream', true, null, 'v2');
|
|
|
|
|
|
$info['file'] = 'http://ywsc.juip.com/'.$file_key;
|
|
|
|
|
|
|
2020-11-20 16:02:54 +08:00
|
|
|
|
$user_model = new User;
|
|
|
|
|
|
$user_enum = new UserEnum;
|
2020-11-26 11:08:42 +08:00
|
|
|
|
$user_model->updateOne(['Id' => $data['user_id']], ['follow_status' => $data['status']]);
|
|
|
|
|
|
$follow_rcord->updateOne(['user_id' => $data['user_id']], ['active' => 0]);
|
2024-03-22 11:17:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-20 09:42:07 +08:00
|
|
|
|
|
2023-09-13 18:14:48 +08:00
|
|
|
|
if (empty($data['id'])) {
|
|
|
|
|
|
$info['user_id'] = $data['user_id'];
|
|
|
|
|
|
$info['op_user'] = $this->userinfo['OperaterID'];
|
|
|
|
|
|
$info['follow_status'] = $data['status'];
|
|
|
|
|
|
$info['record'] = $data['old_status'] . '=>' . $user_enum::$FollowStatus[$data['status']];
|
|
|
|
|
|
$info['remark'] = $data['remark'];
|
2024-03-22 11:17:35 +08:00
|
|
|
|
$info['order_id'] = $sell_info['order_id'];
|
|
|
|
|
|
$info['product_type'] = $sell_info['product_type'];
|
|
|
|
|
|
$info['sell_money'] = $sell_info['sell_money'];
|
|
|
|
|
|
$info['sell_type'] = $sell_info['sell_type'];
|
2023-09-13 18:14:48 +08:00
|
|
|
|
$follow_rcord->add($info);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$info['follow_status'] = $data['status'];
|
|
|
|
|
|
$info['record'] = $data['old_status'] . '=>' . $user_enum::$FollowStatus[$data['status']];
|
|
|
|
|
|
$info['remark'] = $data['remark'];
|
|
|
|
|
|
$follow_rcord->updateOne(['id' => $data['id']],$info);
|
|
|
|
|
|
}
|
2020-11-20 16:02:54 +08:00
|
|
|
|
\result();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description: 获取用户信息
|
|
|
|
|
|
* @param {*}
|
|
|
|
|
|
* @return {*}
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function getUserInfo()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!isset($_GET['id'])) {
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
|
|
$user_model = new User;
|
2022-01-15 10:02:06 +08:00
|
|
|
|
\result($user_model->getOne(['Id' => $id], 'LoginCode as UserName,Phone,Wx,QQ'));
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description: 获取用户消费记录
|
|
|
|
|
|
* @param {*}
|
|
|
|
|
|
* @return {*}
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function getCostList()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!isset($_GET['id'])) {
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
|
|
$index = $_GET['index'];
|
2020-11-25 09:58:17 +08:00
|
|
|
|
$where = '';
|
|
|
|
|
|
$list = [];
|
|
|
|
|
|
|
|
|
|
|
|
$product_order_model = new ProductOrder;
|
|
|
|
|
|
$product_order_enum = new ProductOrderEnum;
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['search'])) {
|
|
|
|
|
|
$search = $_GET['search'];
|
|
|
|
|
|
$flag = date("d", time()) == date("t", time());
|
|
|
|
|
|
$date1 = date("Y-m-01", strtotime("-1 month"));
|
|
|
|
|
|
$date2 = $flag ? date("Y-m-t H:i:s", strtotime("-1 month")) : date("Y-m-d H:i:s", strtotime("-1 month"));
|
|
|
|
|
|
$date3 = date("Y-m-01", time());
|
|
|
|
|
|
$date4 = date("Y-m-d H:i:s", time());
|
|
|
|
|
|
if (!empty($search['last_month']['s_time'])) {
|
|
|
|
|
|
$date1 = date('Y-m-d', strtotime($search['last_month']['s_time']));
|
|
|
|
|
|
$date2 = date('Y-m-d H:i:s', strtotime($search['last_month']['e_time']));
|
2021-03-01 13:57:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!empty($search['new_month']['s_time'])) {
|
2020-11-25 09:58:17 +08:00
|
|
|
|
$date3 = date('Y-m-d', strtotime($search['new_month']['s_time']));
|
|
|
|
|
|
$date4 = date('Y-m-d H:i:s', strtotime($search['new_month']['e_time']));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch ($index) {
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
//上月
|
|
|
|
|
|
$where .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' ";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
//本月
|
|
|
|
|
|
$where .= " UpdateTime>='" . $date3 . "' and UpdateTime<='" . $date4 . "' ";
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$data = $product_order_model->getUserCost($id, $index, $where);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($data as $info) {
|
|
|
|
|
|
$info['OrderType'] = $product_order_enum::$OrderType[$info['OrderType']];
|
|
|
|
|
|
$info['PayType'] = $product_order_enum::$ScoreName[$info['PayType']];
|
2020-11-28 16:51:50 +08:00
|
|
|
|
$info['ConnectCount'] = $info['ConnectCount'] * $info['AccountCount'];
|
2020-11-25 09:58:17 +08:00
|
|
|
|
$list[] = $info;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
\result($list);
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description: 获取用户帐号
|
|
|
|
|
|
* @param {*}
|
|
|
|
|
|
* @return {*}
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function getAccountList()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!isset($_GET['id'])) {
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
|
|
$index = $_GET['index'];
|
|
|
|
|
|
$product_account_model = new ProductAccount;
|
|
|
|
|
|
\result($product_account_model->getUserAccount($id, $index));
|
|
|
|
|
|
}
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
|
|
|
|
|
public function hujiao() {
|
2024-10-10 15:17:23 +08:00
|
|
|
|
$data = json_decode(file_get_contents("php://input"), true);
|
|
|
|
|
|
$phone = $data['phone'];
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
$callers = ['1017'=>'15225139515','1029'=>'15713870747','1032'=>'15290427047'];
|
|
|
|
|
|
$operaterids = ['1017','1029','1032'];
|
2023-10-27 16:24:45 +08:00
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
if (!in_array($this->userinfo['OperaterID'],$operaterids)) {
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
$caller = $callers[$this->userinfo['OperaterID']];
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
$callee = $phone;
|
|
|
|
|
|
$serviceNumber = '';
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
$header = [
|
|
|
|
|
|
'Content-Type:application/json',
|
|
|
|
|
|
'app_id:f39b78fb812f192e221b55b752267b2c',
|
|
|
|
|
|
'timeStamp:'. time() * 1000
|
|
|
|
|
|
];
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
$param = [
|
|
|
|
|
|
'caller' =>$caller,
|
|
|
|
|
|
'callee'=>$callee,
|
|
|
|
|
|
'callBackUrl' =>"https://php-api.juip.com/api/hujiao/callback"
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
];
|
2023-09-13 18:14:48 +08:00
|
|
|
|
|
2024-10-10 15:17:23 +08:00
|
|
|
|
|
|
|
|
|
|
$back_data = json_decode(linkcurl('https://yunyuzhineng.cn:8888/voice/v1/call-rs','POST',json_encode($param),$header,0));
|
|
|
|
|
|
|
|
|
|
|
|
if ($back_data->code == 1000) {
|
|
|
|
|
|
\result([],'呼叫成功');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
\result([],'呼叫失败',30000);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2020-11-20 16:02:54 +08:00
|
|
|
|
}
|