添加商户信息接口

main
fengxinyhyl 10 months ago
parent b263badf46
commit 8dd28e5088
  1. 42
      app/common/repositories/system/merchant/FinancialRecordRepository.php
  2. 4
      app/common/repositories/user/UserRepository.php
  3. 4
      app/controller/admin/system/merchant/Merchant.php
  4. 29
      app/controller/admin/user/User.php
  5. 15
      app/controller/merchant/system/Merchant.php
  6. 2
      public/mer.html
  7. 2
      public/system.html
  8. 4
      route/admin/user.php

@ -17,8 +17,10 @@ namespace app\common\repositories\system\merchant;
use app\common\dao\system\merchant\FinancialRecordDao; use app\common\dao\system\merchant\FinancialRecordDao;
use app\common\repositories\BaseRepository; use app\common\repositories\BaseRepository;
use app\common\repositories\store\order\StoreOrderRepository; use app\common\repositories\store\order\StoreOrderRepository;
use app\common\repositories\user\UserAssetsRepository;
use app\common\repositories\user\UserBillRepository; use app\common\repositories\user\UserBillRepository;
use app\common\repositories\user\UserRechargeRepository; use app\common\repositories\user\UserRechargeRepository;
use app\common\repositories\user\UserRepository;
use think\facade\Cache; use think\facade\Cache;
use think\facade\Db; use think\facade\Db;
@ -197,6 +199,44 @@ class FinancialRecordRepository extends BaseRepository
return compact('stat'); return compact('stat');
} }
public function getMerchantStatistics($where){
//商户收入
$count = $this->dao->search($where)->where('financial_type','in',['order','mer_presell'])->sum('number');
//商户余额
$mer_money = app()->make(MerchantRepository::class)->search(['mer_id' => $where['is_mer']])->value('mer_money');
//最低提现额度
$extract_minimum_line = systemConfig('extract_minimum_line');
//商户可提现金额
$_line = bcsub($mer_money,$extract_minimum_line,2);
//退款支出金额
$refund_order = $this->dao->search($where)->where('financial_type','refund_order')->sum('number');
//商户冻结金额
$merLockMoney = app()->make(UserBillRepository::class)->merchantLickMoney($where['is_mer']);
$user = \app(UserRepository::class)->getUserByMerId($where['is_mer']);
if($user){
$assets = app(UserAssetsRepository::class)->assets($user['uid']);
$welfare = $assets['welfare'];
$welfare_frozen = $assets['welfare_frozen'];
}else{
$welfare = 0;
$welfare_frozen = 0;
}
return array(
'total' => $count,
'mer_money' => $mer_money,
'frozen_money' => $merLockMoney,
'refund_money' => $refund_order,
'available_money' => $_line,
'welfare' => $welfare,
'welfare_frozen' => $welfare_frozen,
);
}
/** /**
* TODO 商户头部统计 * TODO 商户头部统计
* @param $where * @param $where
@ -229,6 +269,8 @@ class FinancialRecordRepository extends BaseRepository
//商户可提现金额 //商户可提现金额
// $bill_order = app()->make(StoreOrderRepository::class)->search(['paid' => 1,'date' => $where['date'],'pay_type' => 0])->sum('pay_price'); // $bill_order = app()->make(StoreOrderRepository::class)->search(['paid' => 1,'date' => $where['date'],'pay_type' => 0])->sum('pay_price');
$merLockMoney = app()->make(UserBillRepository::class)->merchantLickMoney($where['is_mer']); $merLockMoney = app()->make(UserBillRepository::class)->merchantLickMoney($where['is_mer']);
$stat = [ $stat = [
[ [
'className' => 'el-icon-s-goods', 'className' => 'el-icon-s-goods',

@ -213,6 +213,10 @@ class UserRepository extends BaseRepository
return $this->dao->getUserByPhone($phone); return $this->dao->getUserByPhone($phone);
} }
public function getUserByMerId($id){
return $this->dao->getWhere(array('mer_id' => $id));
}
public function getPulbicLst(array $where, $page, $limit) public function getPulbicLst(array $where, $page, $limit)
{ {
$query = $this->dao->search($where); $query = $this->dao->search($where);

@ -15,7 +15,9 @@ namespace app\controller\admin\system\merchant;
use app\common\repositories\store\product\ProductCopyRepository; use app\common\repositories\store\product\ProductCopyRepository;
use app\common\repositories\system\merchant\FinancialRecordRepository;
use app\common\repositories\system\merchant\MerchantTypeRepository; use app\common\repositories\system\merchant\MerchantTypeRepository;
use app\common\repositories\user\UserAssetsRepository;
use app\common\repositories\user\UserBillRepository; use app\common\repositories\user\UserBillRepository;
use app\common\repositories\user\UserRepository; use app\common\repositories\user\UserRepository;
use crmeb\basic\BaseController; use crmeb\basic\BaseController;
@ -107,6 +109,8 @@ class Merchant extends BaseController
public function info(){ public function info(){
$id = $this->request->param('id'); $id = $this->request->param('id');
$info = $this->repository->get($id); $info = $this->repository->get($id);
$info['assets'] = \app(FinancialRecordRepository::class)->getMerchantStatistics(array('is_mer' => $id));
return app('json')->success($info); return app('json')->success($info);
} }

@ -15,6 +15,7 @@ namespace app\controller\admin\user;
use app\common\repositories\store\ExcelRepository; use app\common\repositories\store\ExcelRepository;
use app\common\repositories\system\HuitongRepository;
use app\common\repositories\user\UserAssetsLogRepository; use app\common\repositories\user\UserAssetsLogRepository;
use app\common\repositories\user\UserAssetsRepository; use app\common\repositories\user\UserAssetsRepository;
use app\common\repositories\user\UserSpreadLogRepository; use app\common\repositories\user\UserSpreadLogRepository;
@ -273,6 +274,34 @@ class User extends BaseController
return app('json')->success(app(UserAssetsLogRepository::class)->list(0, $where, $page, $limit)); return app('json')->success(app(UserAssetsLogRepository::class)->list(0, $where, $page, $limit));
} }
public function huitongList(){
$page = $this->request->param('page', 1);
$limit = $this->request->param('limit', 10);
$phone = $this->request->param('phone');
$where = array();
$where[] = array('asset_type','=',UserAssetsLogRepository::ASSET_TYPE_HUITONG);
$where[] = array('type','=',UserAssetsLogRepository::CHANGE_TYPE_HUITONG_SEND);
if($phone){
$userWhere = array();
$userWhere[] = array('phone','=',$phone);
$user = $this->repository->getWhere($userWhere);
$where[] = array('uid','=',$user ? $user['uid'] : 0);
}
$data = app(UserAssetsLogRepository::class)->list(0, $where, $page, $limit);
foreach ($data['list'] as $k => $v){
$user = $this->repository->get($v['uid']);
$data['list'][$k]['to_phone'] = $v['ext']['to_phone'] ?? '';
$data['list'][$k]['count'] = abs($v['count']);
}
$data['huitong'] = app(HuitongRepository::class)->getCurrent();
return app('json')->success($data);
}
/** /**
* @param UserLabelRepository $labelRepository * @param UserLabelRepository $labelRepository
* @return mixed * @return mixed

@ -17,8 +17,12 @@ namespace app\controller\merchant\system;
use app\common\repositories\store\MerchantTakeRepository; use app\common\repositories\store\MerchantTakeRepository;
use app\common\repositories\store\product\ProductRepository; use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\system\config\ConfigValueRepository; use app\common\repositories\system\config\ConfigValueRepository;
use app\common\repositories\system\merchant\FinancialRecordRepository;
use app\common\repositories\system\serve\ServeOrderRepository; use app\common\repositories\system\serve\ServeOrderRepository;
use app\common\repositories\user\UserAssetsLogRepository;
use app\common\repositories\user\UserAssetsRepository;
use app\common\repositories\user\UserBillRepository; use app\common\repositories\user\UserBillRepository;
use app\common\repositories\user\UserRepository;
use app\validate\merchant\MerchantTakeValidate; use app\validate\merchant\MerchantTakeValidate;
use crmeb\basic\BaseController; use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantRepository; use app\common\repositories\system\merchant\MerchantRepository;
@ -148,6 +152,17 @@ class Merchant extends BaseController
$data = array_merge($data,$delivery); $data = array_merge($data,$delivery);
$data['sys_bases_status'] = systemConfig('sys_bases_status') === '0' ? 0 : 1; $data['sys_bases_status'] = systemConfig('sys_bases_status') === '0' ? 0 : 1;
$data['assets'] = \app(FinancialRecordRepository::class)->getMerchantStatistics(array('is_mer' => $this->request->merId()));
// $user = \app(UserRepository::class)->getUserByMerId($this->request->merId());
// if($user){
// $assets = \app(UserAssetsRepository::class)->assets($user['uid']);
// $data['assets']['welfare'] = $assets['welfare'];
// $data['assets']['welfare_frozen'] = $assets['welfare_frozen'];
// }else{
// $data['assets']['welfare'] = 0;
// $data['assets']['welfare_frozen'] = 0;
// }
return app('json')->success($data); return app('json')->success($data);
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -56,6 +56,10 @@ Route::group(function () {
Route::get('assets_list', '/assetsList')->name('systemUserAssetsList')->option([ Route::get('assets_list', '/assetsList')->name('systemUserAssetsList')->option([
'_alias' => '用户资产列表', '_alias' => '用户资产列表',
]); ]);
//用户资产明细
Route::get('huitong_list', '/huitongList')->name('systemUserHuitongList')->option([
'_alias' => '用户惠通列表',
]);
Route::get('update/form/:id', '/updateForm')->name('systemUserUpdateForm')->option([ Route::get('update/form/:id', '/updateForm')->name('systemUserUpdateForm')->option([
'_alias' => '用户编辑表单', '_alias' => '用户编辑表单',
'_auth' => false, '_auth' => false,

Loading…
Cancel
Save