Compare commits

...

3 Commits

Author SHA1 Message Date
chuan de9d1dc797 up 2 weeks ago
chuan e55e9758f9 up 2 weeks ago
chuan 9da2a94818 up 2 weeks ago
  1. 8
      app/admin/controller/Flow.php
  2. 3
      app/admin/controller/Index.php
  3. 4
      app/admin/controller/User.php
  4. 1
      app/admin/route/app.php
  5. 70
      app/admin/service/FlowService.php
  6. 4
      app/admin/service/RechargeService.php
  7. 16
      app/admin/service/UserService.php
  8. 26
      app/admin/service/setting/BlockStockService.php
  9. 7
      app/home/controller/Login.php
  10. 1
      app/home/route/app.php
  11. 26
      app/home/service/LoginService.php
  12. 4
      app/home/service/UserService.php
  13. 3
      app/model/StockBlockListModel.php

8
app/admin/controller/Flow.php

@ -29,6 +29,14 @@ class Flow extends AdminBaseController
return json($result);
}
// 黄金期货资产流水
public function goldFutures()
{
$service = new FlowService();
$result = $service->goldFutures($this->request->param(),$this->getAdminId());
return json($result);
}
// 印度股指资产流水
public function inrStockIndex()
{

3
app/admin/controller/Index.php

@ -198,6 +198,8 @@ class Index extends AdminBaseController
$todayRechargeAmount = Db::table($rechargeApplyTableName)
->whereTime('create_time', 'between', [$today, $tomorrow])->where($whereInUser)
->where('status', 1)->sum('recharge_num');
$todayRechargeAmountGroup = Db::table($rechargeApplyTableName)->whereTime('create_time', 'between', [$today, $tomorrow])->where($whereInUser)
->where('status', 1)->field('account_type, SUM(recharge_num) AS recharge_num')->group('recharge_num')->select();
// 今日提款金额 完成状态
$todayWithdrawAmount = Db::table($userWithdrawTableName)
@ -227,6 +229,7 @@ class Index extends AdminBaseController
'totalWithdrawalNum' => $totalWithdrawalNum,// 总提现用户
'todayRechargeAmount' => $todayRechargeAmount, // 今日充值金额
'todayRechargeAmountGroup' => $todayRechargeAmountGroup, // 今日充值金额 - 按充值类型分组统计
'totalRechargeAmount' => $totalRechargeAmount,// 总充值金额
'todayWithdrawAmount' => $todayWithdrawAmount, // 今日提款金额

4
app/admin/controller/User.php

@ -197,7 +197,7 @@ class User extends AdminBaseController
{
$service = new UserService();
$result = $service->addBusiness($this->request->param(), $this->getAdminId());
return json([$result]);
return json($result);
}
// 回复一条话务请求
@ -205,7 +205,7 @@ class User extends AdminBaseController
{
$service = new UserService();
$result = $service->replyBusiness($this->request->param(), $this->getAdminId());
return json([$result]);
return json($result);
}
// 获取话务队列

1
app/admin/route/app.php

@ -580,6 +580,7 @@ Route::group('/', function () {
Route::post('/flow/forex_list', 'Flow/forexList'); //外汇流水
Route::post('/flow/block_stock', 'Flow/blockStock'); //股票大宗流水
Route::post('flow/inr_stock_index', 'Flow/inrStockIndex'); //印度股指资产流水
Route::post('/flow/gold_futures', 'Flow/goldFutures'); // 黄金期货资产流水
Route::post('/flow/fund_stock', 'Flow/fundStock');
Route::post('/flow/in_option_stock', 'Flow/inOptionStock');

70
app/admin/service/FlowService.php

@ -10,6 +10,7 @@ use app\model\UserBrokerageModel;
use app\model\UserContractLogModel;
use app\model\UserDigitalLogModel;
use app\model\UserForexLogModel;
use app\model\UserGoldFuturesLogModel;
use app\model\UserModel;
use app\model\UserStockBlockLogModel;
use app\model\UserStockFundLogModel;
@ -235,6 +236,75 @@ class FlowService extends AdminBaseService
}
}
// 黄金期货资产流水
public function goldFutures($param, $adminId)
{
try {
// 参数校验
validate(FlowValidate::class)->scene('stock')->check($param);
$where = [];
$userId = 0;
// 用户号精确搜索
if (!empty($param['user_no'])) {
$user = UserModel::where('user_no', $param['user_no'])->find();
if (empty($user)) {
return $this->toData('0', 'SUCCESS', ['total' => 0, 'list' => [], ]);
}
$userId = $user['user_id'];
}
// 判断是否是代理 如果是代理 只能看他自己管理的用户
$whereU = $this->getWhereByIsAgentAndUserId($adminId, $where, $userId);
if (!is_array($whereU)) {
return $this->toData('0', 'SUCCESS', ['total' => 0, 'list' => []]);
}
$changeTypeArr = UserGoldFuturesLogModel::group('change_type')->column('change_type');
if (!empty($param['change_type']) && in_array($param['change_type'], $changeTypeArr)) $where['change_type'] = $param['change_type'];
// 交易对
if (!empty($param['stock_id'])) {
$where['stock_id'] = $param['stock_id'];
}
if (!empty($param['start_time']) && !empty($param['end_time'])) {
$where['create_time'] = ['between time', [$param['start_time'], $param['end_time']]];
}
// 列表
$list = UserGoldFuturesLogModel::where($where)->where($whereU)->order('id', 'desc')->page($param['page'], $param['limit'])->select();
// 总数
$total = UserGoldFuturesLogModel::where($where)->where($whereU)
->count();
$rows = [];
if (!$list->isEmpty()) {
$rows = $list->toArray();
// 获取用户号
$userIdArr = [];
foreach ($list as $idItem) {
$userIdArr[] = $idItem['user_id'];
}
$userNoArr = UserModel::where('user_id', 'in', $userIdArr)->column('user_no', 'user_id');
foreach ($rows as $key => $item) {
$rows[$key]['user_no'] = $userNoArr[$item['user_id']] ?? '-'; // 用户号
}
}
return $this->toData('0', 'SUCCESS', ['total' => $total, 'list' => $rows, 'extend' => (new BaseHomeService())->getCapitalTypeList($changeTypeArr)]);
} catch (ValidateException $validateException) {
// 参数校验失败
$message = $validateException->getError();
return $this->toData('1', $message);
} catch (\Exception $exception) {
return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]);
}
}
// 印度股指资产流水
public function inrStockIndex($param, $adminId)
{

4
app/admin/service/RechargeService.php

@ -60,6 +60,8 @@ class RechargeService extends AdminBaseService
// 统计 充值成功
$sum = RechargeApplyModel::where($where)->where($whereU)->where('status', 1)->sum('recharge_num');
$groupSum = RechargeApplyModel::where($where)->where($whereU)->where('status', 1)->field('account_type, SUM(recharge_num) AS recharge_num')->group('recharge_num')->select();
$rows = [];
if (!$list->isEmpty()) {
// 获取用户号
@ -90,7 +92,7 @@ class RechargeService extends AdminBaseService
}
}
return $this->toData('0', 'SUCCESS', ['total' => $total, 'list' => $rows, 'sum' => $sum . 'USD', 'extend' => $statusList]);
return $this->toData('0', 'SUCCESS', ['total' => $total, 'list' => $rows, 'sum' => $sum . 'USD', 'extend' => $statusList, 'groupSum'=>$groupSum]);
} catch (\Exception $exception) {
return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]);
}

16
app/admin/service/UserService.php

@ -1673,25 +1673,20 @@ class UserService extends AdminBaseService
if (empty($param['limit']) || !is_numeric($param['limit'])) {
return $this->toData('400', '参错错误');
}
// 获取用户信息
$userInfo = UserModel::where(['user_id'=>$param['user_id']])->find();
if (empty($userInfo)) {
return $this->toData('500', '用户信息错误');
}
$where = ['uid'=>$param['user_id']];
if (!empty($param['is_reply']) && $param['is_reply'] < 2) {
$where = [];
if (isset($param['is_reply']) && $param['is_reply'] < 2) {
$where['is_reply'] = $param['is_reply']; // 根据回复状态过滤:0-未回复的; 1-已经回复的; 2-全部
}
$list = BusinessLogModel::where($where)->order('id', 'desc')->paginate([
'list_rows' => $param['limit'],
'page' => $param['page'],
]);
$data = [];
if (!empty($list->items())) {
$data = [];
foreach ($list->items() as $v) {
$tmp = $v;
$userInfo = UserModel::where(['user_id'=>$param['user_id']])->find();
$userInfo = UserModel::where(['user_id'=>$v['user_id']])->find();
if (!empty($userInfo)) {
$tmp['user_info'] = $userInfo->toArray();
} else{
@ -1702,7 +1697,6 @@ class UserService extends AdminBaseService
}
return $this->toData('0', 'Successful', [
'user_inf' => $userInfo->toArray(),
'list' => $data,
'page' => $list->currentPage(),
'total' => $list->total(),

26
app/admin/service/setting/BlockStockService.php

@ -7,7 +7,9 @@ use app\model\StockBlockListModel;
use app\model\StockHkdListModel;
use app\model\StockIdnListModel;
use app\model\StockInListModel;
use app\model\StockJpListModel;
use app\model\StockListModel;
use app\model\StockMarketModel;
use app\model\StockMysListModel;
use app\model\StockSgdListModel;
use app\model\StockThaListModel;
@ -52,7 +54,8 @@ class BlockStockService extends AdminBaseService
return $this->toData('0', 'SUCCESS', ['list' => $list, 'total' => $total, 'extend' => [
// 'tape_list' => StockBlockListModel::$tapeList,
'stock_type_list' => StockBlockListModel::$typeList,
// 'stock_type_list' => StockBlockListModel::$typeList,
'stock_type_list' => StockMarketModel::STOCK_MARKET_TYPE,
]]);
} catch (\Exception $exception) {
return $this->toData('1', '系统繁忙', [$exception->getMessage()]);
@ -70,7 +73,7 @@ class BlockStockService extends AdminBaseService
// 股票类型
if (empty($param['type']) || !in_array($param['type'], array_keys(StockBlockListModel::$typeList))) {
if (empty($param['type']) || !in_array($param['type'], array_keys(StockMarketModel::STOCK_MARKET_TYPE))) {
return $this->toData('1', '股票市场 无效');
}
@ -108,6 +111,10 @@ class BlockStockService extends AdminBaseService
$stock = StockHkdListModel::where('stock_code', $param['stock_code'])->find();
if (empty($stock)) return $this->toData('1', 'stock_code 无效');
break;
case '18':
$stock = StockJpListModel::where('stock_code', $param['stock_code'])->find();
if (empty($stock)) return $this->toData('1', 'stock_code 无效');
break;
default:
return $this->toData('1', '股票市场或股票代码 无效');
}
@ -139,7 +146,8 @@ class BlockStockService extends AdminBaseService
}
// 可出售时间时间
if (empty($param['today_add']) || !is_numeric($param['today_add'])) {
// if (empty($param['today_add']) || !is_numeric($param['today_add'])) {
if (!is_numeric($param['today_add'])) {
return $this->toData('1', 'T+n 无效');
}
@ -182,7 +190,8 @@ class BlockStockService extends AdminBaseService
'min' => $blockStock->min,
'start_time' => $blockStock->start_time,
'end_time' => $blockStock->end_time,
'today_add' => $blockStock->today_add
'today_add' => $blockStock->today_add,
'buy_pwd' => $blockStock->buy_pwd,
]);
return $this->toData('0', 'SUCCESS');
@ -220,7 +229,7 @@ class BlockStockService extends AdminBaseService
}
// 股票类型
if (empty($param['type']) || !in_array($param['type'], array_keys(StockBlockListModel::$typeList))) {
if (empty($param['type']) || !in_array($param['type'], array_keys(StockMarketModel::STOCK_MARKET_TYPE))) {
return $this->toData('1', '股票市场 无效');
}
@ -253,6 +262,10 @@ class BlockStockService extends AdminBaseService
$stock = StockHkdListModel::where('stock_code', $param['stock_code'])->find();
if (empty($stock)) return $this->toData('1', 'stock_code 无效');
break;
case '18':
$stock = StockJpListModel::where('stock_code', $param['stock_code'])->find();
if (empty($stock)) return $this->toData('1', 'stock_code 无效');
break;
default:
return $this->toData('1', '股票市场或股票代码 无效');
}
@ -329,7 +342,8 @@ class BlockStockService extends AdminBaseService
'min' => $blockStock->min,
'start_time' => $blockStock->start_time,
'end_time' => $blockStock->end_time,
'today_add' => $blockStock->today_add
'today_add' => $blockStock->today_add,
'buy_pwd' => $blockStock->buy_pwd,
]);
return $this->toData('0', 'SUCCESS');

7
app/home/controller/Login.php

@ -107,6 +107,13 @@ class Login extends HomeBaseController
return json($returnData);
}
// 绑定用户的adjust广告渠道ID
public function bindAdjustChannel(): Json
{
$returnData = (new LoginService())->bindAdjustChannel($this->request->post());
return json($returnData);
}
/**
* 免密码登录
* @return Json

1
app/home/route/app.php

@ -41,6 +41,7 @@ Route::group('/',function (){
Route::post('/forget_sms', 'Login/resetPasswordBySms');
// 手机号密码登陆
Route::post('/phone_login', 'Login/phoneLogin');
Route::post('/bind_adjust_channel', 'Login/bindAdjustChannel'); // 绑定用户的adjust广告渠道ID
// 获取配置
Route::post('/get_config', 'Upload/getConfig');
Route::post('/get_config_by_key', 'Config/getConfigByKey'); // 获取指定keyd的配置

26
app/home/service/LoginService.php

@ -555,7 +555,7 @@ class LoginService extends BaseHomeService
}
// 生成钱包地址
(new UserService())->doRegInitUserInfo($userId, $parentUserId);
// (new UserService())->doRegInitUserInfo($userId, $parentUserId);
// 注册聊天账号
$chatData = [
'Username' => $userNo,
@ -867,6 +867,30 @@ class LoginService extends BaseHomeService
}
}
// 绑定用户的adjust广告渠道ID
public function bindAdjustChannel($param): array
{
try {
// 获取用户
if (empty($param['user_id']) || empty($param['adjust_channel'])) {
return $this->toData('500', lang('Missing parameters'));
}
// 检测用户是否存在
$info = UserModel::where(['user_id'=>$param['user_id']])->find();
if (empty($info)) {
return $this->toData('500', lang('user_does_not_exist'));
}
// 绑定adjust广告渠道ID
$info->adjust_channel = $param['adjust_channel'];
$res = $info->save();
// 返回结果以及用户信息
return $this->toData('0', 'successful.', [$res]);
} catch (\Exception $exception) {
return $this->toData('500', lang('system_busy'));
}
}
public function autoLogin($param): array
{
try {

4
app/home/service/UserService.php

@ -143,7 +143,8 @@ class UserService extends BaseHomeService
return $this->toData('500', lang('user_does_not_exist'));
}
$info = UserModel::getFieldsByUserId('trade_password,lever_status,gender,last_name,first_name,real_status,country_id,user_no,nick_name,email,phone_number,country_code,agent_id,customer_id,is_real,head_img_id,invite_code,is_test_user,customer_remark,label', $userId);
$info = UserModel::getFieldsByUserId('trade_password,lever_status,gender,last_name,first_name,real_status,country_id,user_no,nick_name,email,phone_number,
country_code,agent_id,customer_id,is_real,head_img_id,invite_code,is_test_user,customer_remark,label,adjust_channel', $userId);
if (empty($info)) {
return $this->toData('500', lang('user_does_not_exist'));
}
@ -260,6 +261,7 @@ class UserService extends BaseHomeService
'vip_expire' => $vipExpire,
'customer_remark' => $info['customer_remark'],
'label' => $info['label'],
'adjust_channel' => $info['adjust_channel'],
]);
} catch (\Exception $exception) {
return $this->toData('500', lang('system_busy'), [$exception->getMessage(), $exception->getTrace()]);

3
app/model/StockBlockListModel.php

@ -50,7 +50,7 @@ class StockBlockListModel extends BaseModel
14 => '英股',
15 => '法股',
16 => '德股',
18 => '日股',
];
public static $typeListEn = [
3 => 'US',
@ -63,6 +63,7 @@ class StockBlockListModel extends BaseModel
14 => 'UK',
15 => 'FUR',
16 => 'EUR',
18 => 'JP',
];
}
Loading…
Cancel
Save