添加用户资产相关文件

main
fengxinyhyl 9 months ago
parent 5aadf7b0c9
commit 77080f71b0
  1. 39
      app/common/dao/user/UserAssetsDao.php
  2. 39
      app/common/dao/user/UserAssetsLogDao.php
  3. 35
      app/common/model/user/UserAssets.php
  4. 35
      app/common/model/user/UserAssetsLog.php
  5. 3
      app/common/repositories/store/order/StoreOrderCreateRepository.php
  6. 39
      app/common/repositories/user/UserAssetsLogRepository.php
  7. 39
      app/common/repositories/user/UserAssetsRepository.php

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\dao\user;
use app\common\dao\BaseDao;
use app\common\model\BaseModel;
use app\common\model\user\UserSpreadLog;
class UserAssetsDao extends BaseDao
{
protected function getModel(): string
{
return UserSpreadLog::class;
}
public function add($uid, $spread_uid, $old_spread_uid, $admin_id = 0)
{
$this->create(compact('uid', 'spread_uid', 'admin_id', 'old_spread_uid'));
}
public function search($where)
{
return UserSpreadLog::getDB()->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
$query->where('uid', $where['uid']);
})->order('create_time DESC');
}
}

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\dao\user;
use app\common\dao\BaseDao;
use app\common\model\BaseModel;
use app\common\model\user\UserSpreadLog;
class UserAssetsLogDao extends BaseDao
{
protected function getModel(): string
{
return UserSpreadLog::class;
}
public function add($uid, $spread_uid, $old_spread_uid, $admin_id = 0)
{
$this->create(compact('uid', 'spread_uid', 'admin_id', 'old_spread_uid'));
}
public function search($where)
{
return UserSpreadLog::getDB()->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
$query->where('uid', $where['uid']);
})->order('create_time DESC');
}
}

@ -0,0 +1,35 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\model\BaseModel;
class UserAssets extends BaseModel
{
public static function tablePk(): ?string
{
return 'uid';
}
public static function tableName(): string
{
return 'user_assets';
}
public function user()
{
return $this->hasOne(User::class, 'uid', 'uid');
}
}

@ -0,0 +1,35 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\model\BaseModel;
class UserAssetsLog extends BaseModel
{
public static function tablePk(): ?string
{
return 'id';
}
public static function tableName(): string
{
return 'user_assets_log';
}
public function user()
{
return $this->hasOne(User::class, 'uid', 'uid');
}
}

@ -1121,7 +1121,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'give_integral' => $orderInfo['order_total_give_integral'], 'give_integral' => $orderInfo['order_total_give_integral'],
]; ];
event('order.create.before', compact('groupOrder', 'orderList')); event('order.create.before', compact('groupOrder', 'orderList'));
$group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo) { $group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo, $address) {
$storeGroupOrderRepository = app()->make(StoreGroupOrderRepository::class); $storeGroupOrderRepository = app()->make(StoreGroupOrderRepository::class);
$storeCartRepository = app()->make(StoreCartRepository::class); $storeCartRepository = app()->make(StoreCartRepository::class);
$attrValueRepository = app()->make(ProductAttrValueRepository::class); $attrValueRepository = app()->make(ProductAttrValueRepository::class);
@ -1214,6 +1214,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$cartInfo = $order['cartInfo']; $cartInfo = $order['cartInfo'];
unset($order['cartInfo']); unset($order['cartInfo']);
//创建子订单 //创建子订单
$order['district_id'] = $address['district_id'] ?? 0;
$_order = $this->dao->create($order); $_order = $this->dao->create($order);
if ($order['integral'] > 0) { if ($order['integral'] > 0) {

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\repositories\user;
use app\common\dao\user\UserSpreadLogDao;
use app\common\repositories\BaseRepository;
/**
* @mixin UserSpreadLogDao
*/
class UserAssetsLogRepository extends BaseRepository
{
public function __construct(UserSpreadLogDao $dao)
{
$this->dao = $dao;
}
public function getList(array $where, $page, $limit)
{
$query = $this->dao->search($where);
$count = $query->count();
$list = $query->page($page, $limit)->with(['spread' => function ($query) {
$query->field('uid,nickname,avatar');
}])->select();
return compact('count', 'list');
}
}

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\repositories\user;
use app\common\dao\user\UserSpreadLogDao;
use app\common\repositories\BaseRepository;
/**
* @mixin UserSpreadLogDao
*/
class UserAssetsRepository extends BaseRepository
{
public function __construct(UserSpreadLogDao $dao)
{
$this->dao = $dao;
}
public function getList(array $where, $page, $limit)
{
$query = $this->dao->search($where);
$count = $query->count();
$list = $query->page($page, $limit)->with(['spread' => function ($query) {
$query->field('uid,nickname,avatar');
}])->select();
return compact('count', 'list');
}
}
Loading…
Cancel
Save