后台优化

main
home.fengxinyhyl 9 months ago
parent f13695c57c
commit 139b7261a3
  1. 2
      app/common/dao/system/notice/SystemNoticeDao.php
  2. 5
      app/common/dao/user/DepositRecordDao.php
  3. 7
      app/common/repositories/system/notice/SystemNoticeRepository.php
  4. 4
      app/common/repositories/user/DepositRecordRepository.php
  5. 7
      app/common/repositories/user/UserAssetsLogRepository.php
  6. 5
      app/common/repositories/user/UserAssetsRepository.php
  7. 3
      app/controller/admin/user/User.php
  8. 2
      app/validate/admin/SystemNoticeValidate.php
  9. 2
      public/system.html
  10. 26
      view/admin/src/views/station/notice/index.vue
  11. 10
      view/admin/src/views/user/assets/index.vue

@ -31,6 +31,8 @@ class SystemNoticeDao extends BaseDao
$query->whereLike('notice_title|notice_content', '%' . $where['keyword'] . '%');
})->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
getModelTime($query, $where['date'], 'create_time');
})->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) {
$query->where('type', $where['type']);
})->where('is_del', 0);
}
}

@ -12,6 +12,7 @@ namespace app\common\dao\user;
use app\common\dao\BaseDao;
use app\common\model\user\DepositRecord;
use app\common\model\user\UserAssets;
use app\common\model\user\UserRecharge;
use app\common\repositories\store\order\StoreOrderRepository;
@ -27,4 +28,8 @@ class DepositRecordDao extends BaseDao
$count = (int)DepositRecord::getDB()->where('uid', $uid)->where('create_time', '>=', date("Y-m-d"))->where('create_time', '<', date("Y-m-d", strtotime('+1 day')))->count();
return StoreOrderRepository::TYPE_SN_USER_DEPOSIT . date('YmdHis', time()) . ($uid . $count);
}
public function getSum($uid, $field){
return DepositRecord::where('uid', $uid)->where('status', 1)->sum($field);
}
}

@ -33,6 +33,7 @@ class SystemNoticeRepository extends BaseRepository
$data['admin_id'] = $admin_id;
$merchantRepository = app()->make(MerchantRepository::class);
$ids= array();
if ($data['type'] == 1) {
$ids = (array)$data['mer_id'];
$type_str = implode('/', $merchantRepository->names($ids));
@ -44,12 +45,12 @@ class SystemNoticeRepository extends BaseRepository
$type_str = implode('/', app()->make(MerchantCategoryRepository::class)->names((array)$data['category_id']));
} else if ($data['type'] == 4) {
$ids = $merchantRepository->search([])->column('mer_id');
$type_str = '全部';
$type_str = '商户';
} else {
throw new ValidateException('商户类型有误');
$type_str = '用户';
}
if (!count($ids)) throw new ValidateException('没有有效的商户信息');
// if (!count($ids)) throw new ValidateException('没有有效的商户信息');
$data['type_str'] = $type_str;
unset($data['is_trader'], $data['category_id'], $data['mer_id']);

@ -120,4 +120,8 @@ class DepositRecordRepository extends BaseRepository
event('user.recharge',compact('recharge'));
}
public function getSum($uid, $field){
return $this->dao->getSum($uid, $field);
}
}

@ -317,8 +317,10 @@ class UserAssetsLogRepository extends BaseRepository
$orderData = $orderRepository->orderStatisticsByUidArr($uidArr);
foreach ($groupList as $group) {
if ($orderData['count'] >= $group['order_count'] or $orderData['sum'] >= $group['order_sum']) {
$user['group_id'] = $group['group_id'];
$user->save();
if($group['group_id'] > $user['group_id']){
$user['group_id'] = $group['group_id'];
$user->save();
}
break;
}
}
@ -561,7 +563,6 @@ class UserAssetsLogRepository extends BaseRepository
{
$query = $this->dao->search($uid, $where);
$count = $query->count();
$sql = $query->getLastSql();
$data = $query->page($page, $limit)->order('id desc')->select();
$list = array();
$changeType = $this->getChangeType();

@ -63,7 +63,7 @@ class UserAssetsRepository extends BaseRepository
{
$item = $this->dao->get($uid);
if ($item) {
return $item->toArray();
$ret = $item->toArray();
} else {
$ret = array(
'uid' => $uid,
@ -74,8 +74,9 @@ class UserAssetsRepository extends BaseRepository
'create_time' => date('Y-m-d H:i:s'),
);
$this->dao->create($ret);
return $ret;
}
$ret['deposit_total'] = app(DepositRecordRepository::class)->getSum($uid,'price');
return $ret;
}

@ -113,6 +113,7 @@ class User extends BaseController
$type = $this->request->param('type');
$phone = $this->request->param('phone');
$date = $this->request->param('date');
$uid = $this->request->param('uid', 0);
$userWhere = array();
if($phone) $userWhere[] = array('phone','=',$phone);
@ -126,7 +127,7 @@ class User extends BaseController
$where[] = array('create_time','between',[date('Y-m-d', strtotime($date[0])),date('Y-m-d', strtotime($date[1]) +86400)]);
}
if($user) $where[] = array('uid','=',$user['uid']);
return app('json')->success(app(UserAssetsLogRepository::class)->list(0, $where, $page, $limit));
return app('json')->success(app(UserAssetsLogRepository::class)->list($uid, $where, $page, $limit));
}
public function stockList(){

@ -21,7 +21,7 @@ class SystemNoticeValidate extends Validate
protected $failException = true;
protected $rule = [
'type|商户类型' => 'require|in:1,2,3,4',
'type|商户类型' => 'require|in:4,5',
'mer_id|商户' => 'requireIf:type,1|array',
'is_trader|自营类型' => 'requireIf:type,2|in:0,1',
'category_id|商户分类' => 'requireIf:type,3|array',

File diff suppressed because one or more lines are too long

@ -18,10 +18,10 @@
</el-form-item>
<el-form-item label="消息名称:" prop="keyword">
<el-input v-model="tableFrom.keyword" @keyup.enter.native="getList(1)" placeholder="请输入消息名称搜索" class="selWidth" />
</el-form-item>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="getList(1)">搜索</el-button>
<el-button size="small" @click="searchReset()">重置</el-button>
<el-button size="small" @click="searchReset()">重置</el-button>
</el-form-item>
</el-form>
</div>
@ -42,6 +42,11 @@
label="消息名称"
min-width="150"
/>
<el-table-column
prop="type_str"
label="通知类别"
min-width="150"
/>
<el-table-column
prop="create_time"
label="发送日期"
@ -53,17 +58,6 @@
<el-form-item>
<span>{{ props.row.notice_content }}</span>
</el-form-item>
<el-form-item v-if="props.row.type === 3 || props.row.type === 4" label="商户分类:">
<span class="mr10">{{ props.row.type_str ? props.row.type_str : '-' }}</span>
</el-form-item>
<el-form-item v-if="props.row.type === 1 || props.row.type === 4" label="商户名称:">
<span v-if="props.row.type_str" class="mr10">{{ props.row.type_str ? props.row.type_str : '-' }}</span>
<span v-else>-</span>
</el-form-item>
<el-form-item v-if="props.row.type === 2 || props.row.type === 4" label="商户类别:">
<span v-if="props.row.type_str" class="mr10">{{ props.row.type_str ? props.row.type_str : '-' }}</span>
<span v-else>-</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
@ -94,10 +88,8 @@
</el-form-item>
<el-form-item label="选择商户">
<el-radio-group v-model="formValidate.type">
<el-radio :label="4">全部</el-radio>
<el-radio :label="1">商户名称</el-radio>
<el-radio :label="2">商户类别</el-radio>
<el-radio :label="3">商户分类</el-radio>
<el-radio :label="4">商户</el-radio>
<el-radio :label="5">用户</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="formValidate.type === 1" label="商户名称:">

@ -37,7 +37,7 @@
placeholder="请选择"
v-model="type"
>
<el-option value="6" label="积分" aria-checked="true">积分</el-option>
<el-option value="5" label="积分" aria-checked="true">积分</el-option>
<el-option value="20" label="钻石">钻石</el-option>
</el-select>
</el-form-item>
@ -65,7 +65,11 @@
<el-table-column label="转让类型" prop="asset_type" min-width="120"/>
<el-table-column label="转让账户" prop="user_phone" min-width="120"/>
<el-table-column label="收款账户" prop="ext.to_phone" min-width="120"/>
<el-table-column label="转让数量" prop="count" min-width="120"/>
<el-table-column label="转让数量" min-width="120">
<template slot-scope="{row}">
<span>{{ row.count >0 ?row.count: -row.count }}</span>
</template>
</el-table-column>
<el-table-column label="手续费" prop="fee" min-width="120"/>
<el-table-column label="变动时间" prop="create_time" min-width="120" />
@ -126,7 +130,7 @@ export default {
getStockHandle(){
let postType = this.type
if(this.type === '积分'){
postType = 6
postType = 5
}
let params = {
page:this.pageIndex,

Loading…
Cancel
Save