Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
clubAdmin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhoujun
clubAdmin
Commits
275ee02a
Commit
275ee02a
authored
Jul 31, 2021
by
zhoujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
货币查询
parent
96ce4dc9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
290 additions
and
0 deletions
+290
-0
app/Http/Controllers/Api/AccountController.php
app/Http/Controllers/Api/AccountController.php
+94
-0
app/Models/SyceeLogModel.php
app/Models/SyceeLogModel.php
+22
-0
app/Providers/AppServiceProvider.php
app/Providers/AppServiceProvider.php
+1
-0
app/Services/Account/AccountService.php
app/Services/Account/AccountService.php
+128
-0
app/Services/Account/IAccountService.php
app/Services/Account/IAccountService.php
+13
-0
config/local.php
config/local.php
+12
-0
config/pro.php
config/pro.php
+12
-0
routes/api.php
routes/api.php
+8
-0
No files found.
app/Http/Controllers/Api/AccountController.php
0 → 100644
View file @
275ee02a
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\BaseController
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Validator
;
use
Throwable
;
use
Exception
;
use
Carbon\Carbon
;
use
Illuminate\Validation\Rule
;
use
App\Services\Account\IAccountService
;
class
AccountController
extends
BaseController
{
private
$time
;
private
$accountService
;
public
function
__construct
(
IAccountService
$accountService
)
{
$this
->
time
=
Carbon
::
now
()
->
format
(
'Y-m-d H:i:s'
);
$this
->
accountService
=
$accountService
;
}
/**
* 平台列表
* @return array
* @date 2021/07/30
* @author live
*/
public
function
getPlatformList
(
Request
$request
)
{
$postData
=
$request
->
all
();
try
{
$data
=
$this
->
accountService
->
getPlatformList
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
/**
* 渠道列表
* @return array
* @date 2021/07/30
* @author live
*/
public
function
getChannelList
(
Request
$request
)
{
$postData
=
$request
->
all
();
try
{
$data
=
$this
->
accountService
->
getChannelList
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
/**
* 货币类型列表
* @return array
* @date 2021/07/30
* @author live
*/
public
function
getCurrencyList
(
Request
$request
)
{
$postData
=
$request
->
all
();
try
{
$data
=
$this
->
accountService
->
getCurrencyList
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
/**
* 货币列表
* @return array
* @date 2021/07/30
* @author live
*/
public
function
getAccountLog
(
Request
$request
)
{
$postData
=
$request
->
all
();
try
{
$data
=
$this
->
accountService
->
getAccountLog
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
}
\ No newline at end of file
app/Models/SyceeLogModel.php
0 → 100644
View file @
275ee02a
<?php
namespace
App\Models
;
use
App\Models\BaseModel
;
class
SyceeLogModel
extends
BaseModel
{
public
$timestamps
=
false
;
protected
$connection
=
'mysql'
;
protected
$table
=
'sycee_log'
;
const
CREATE_ROLE
=
1
;
// 创建角色
const
WATCH_ADVERT
=
2
;
// 观看广告
const
WITHDRAWAL
=
3
;
// 提现
public
static
$source
=
[
self
::
CREATE_ROLE
=>
'创建角色'
,
self
::
WATCH_ADVERT
=>
'观看广告'
,
self
::
WITHDRAWAL
=>
'提现元宝'
,
];
}
app/Providers/AppServiceProvider.php
View file @
275ee02a
...
...
@@ -15,6 +15,7 @@ class AppServiceProvider extends ServiceProvider
{
$this
->
app
->
bind
(
'App\Services\User\IUserService'
,
'App\Services\User\UserService'
);
$this
->
app
->
bind
(
'App\Services\White\IWhiteService'
,
'App\Services\White\WhiteService'
);
$this
->
app
->
bind
(
'App\Services\Account\IAccountService'
,
'App\Services\Account\AccountService'
);
}
/**
...
...
app/Services/Account/AccountService.php
0 → 100644
View file @
275ee02a
<?php
namespace
App\Services\Account
;
use
App\Services\Account\IAccountService
;
use
Carbon\Carbon
;
use
Exception
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Str
;
use
App\Models\SyceeLogModel
;
use
App\Models\AccountModel
;
use
Illuminate\Support\Facades\Cache
;
class
AccountService
implements
IAccountService
{
private
$time
;
public
function
__construct
()
{
$this
->
time
=
Carbon
::
now
()
->
format
(
'Y-m-d H:i:s'
);
}
/**
* 平台列表
* @return araay
* @date 2021/07/30
* @author live
*/
public
function
getPlatformList
(
$postData
)
{
$array
=
[
'0'
=>
'请选择'
];
foreach
(
config
(
env
(
'ENVIRONMENT'
)
.
'.PLATFORM'
)
as
$key
=>
$val
)
$array
[
$key
]
=
$val
;
return
$array
;
}
/**
* 渠道列表
* @return araay
* @date 2021/07/30
* @author live
*/
public
function
getChannelList
(
$postData
)
{
$array
=
[
'0'
=>
'请选择'
];
foreach
(
config
(
env
(
'ENVIRONMENT'
)
.
'.CHANNEL'
)
as
$key
=>
$val
)
$array
[
$key
]
=
$val
;
return
$array
;
}
/**
* 货币类型列表
* @return araay
* @date 2021/07/30
* @author live
*/
public
function
getCurrencyList
(
$postData
)
{
$array
=
[
'0'
=>
'请选择'
];
foreach
(
config
(
env
(
'ENVIRONMENT'
)
.
'.CURRENCY'
)
as
$key
=>
$val
)
$array
[
$key
]
=
$val
;
return
$array
;
}
/**
* 货币查询
* @return araay
* @date 2021/07/30
* @author live
*/
public
function
getAccountLog
(
$postData
)
{
$pagePerNum
=
$postData
[
'pageSize'
]
??
20
;
$currentPage
=
$postData
[
'page'
]
??
1
;
$start
=
$postData
[
'startTime'
]
??
''
;
$end
=
$postData
[
'endTime'
]
??
''
;
$platform
=
$postData
[
'platform'
]
??
0
;
$channel
=
$postData
[
'channel'
]
??
0
;
$logType
=
$postData
[
'logType'
]
??
0
;
$type
=
$postData
[
'type'
]
??
0
;
$uid
=
$postData
[
'uid'
]
??
''
;
if
(
$uid
==
''
)
return
[];
$account
=
AccountModel
::
where
(
function
(
$query
)
use
(
$uid
)
{
return
$query
->
where
(
'user_id'
,
$uid
)
->
orWhere
(
'platform_id'
,
$uid
);
})
->
when
(
$platform
>
0
,
function
(
$query
)
use
(
$platform
)
{
return
$query
->
where
(
'platform'
,
$platform
);
})
->
when
(
$channel
>
0
,
function
(
$query
)
use
(
$channel
)
{
return
$query
->
where
(
'channel'
,
$channel
);
})
->
select
(
'user_id'
,
'sycee'
,
'platform'
,
'platform_id'
,
'channel'
)
->
first
();
if
(
!
$account
)
return
[];
$array
=
[];
$logs
=
SyceeLogModel
::
where
(
'user_id'
,
$account
->
user_id
)
->
when
(
$start
!=
''
,
function
(
$query
)
use
(
$start
)
{
$startTime
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$start
)
-
1
);
return
$query
->
where
(
'log_time'
,
'>'
,
$startTime
);
})
->
when
(
$end
!=
''
,
function
(
$query
)
use
(
$end
)
{
$endTime
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$end
)
+
1
);
return
$query
->
where
(
'log_time'
,
'<'
,
$endTime
);
})
->
when
(
$logType
>
0
,
function
(
$query
)
use
(
$logType
)
{
if
(
$logType
==
1
)
return
$query
->
whereIn
(
'op_code'
,[
1
,
2
]);
if
(
$logType
==
2
)
return
$query
->
where
(
'op_code'
,
3
);
})
->
select
(
'id'
,
'op_code'
,
'sycee'
,
'sycee_pool'
,
'sycee_balance'
,
'sycee_pool_balance'
,
'log_time'
,
'extra'
)
->
orderBy
(
'id'
,
'DESC'
)
->
paginate
(
$pagePerNum
,
[
'*'
],
'currentPage'
,
$currentPage
);
$array
[
'totalNum'
]
=
$logs
->
total
();
$array
[
'totalPage'
]
=
$logs
->
lastPage
();
$platformArr
=
config
(
env
(
'ENVIRONMENT'
)
.
'.PLATFORM'
);
$channelArr
=
config
(
env
(
'ENVIRONMENT'
)
.
'.CHANNEL'
);
$sourceArr
=
SyceeLogModel
::
$source
;
foreach
(
$logs
as
$log
){
$tem
[
'uid'
]
=
$account
->
platform_id
;
$tem
[
'openId'
]
=
$account
->
user_id
;
$tem
[
'platformName'
]
=
$platformArr
[
$account
->
platform
]
??
''
;
$tem
[
'channelName'
]
=
$channelArr
[
$account
->
channel
]
??
''
;
if
(
$log
->
op_code
==
3
){
$tem
[
'typeName'
]
=
'消耗'
;
}
else
{
$tem
[
'typeName'
]
=
'产出'
;
}
$tem
[
'beforeNum'
]
=
$log
->
sycee_balance
-
$log
->
sycee
;
$tem
[
'optionNum'
]
=
$log
->
sycee
;
$tem
[
'afterNum'
]
=
$log
->
sycee_balance
;
$tem
[
'source'
]
=
$sourceArr
[
$log
->
op_code
];
$tem
[
'logTime'
]
=
$log
->
log_time
;
$tem
[
'remark'
]
=
$log
->
extra
;
$array
[
'data'
][]
=
$tem
;
}
unset
(
$users
,
$user
,
$user
);
return
$array
;
}
}
\ No newline at end of file
app/Services/Account/IAccountService.php
0 → 100644
View file @
275ee02a
<?php
namespace
App\Services\Account
;
interface
IAccountService
{
public
function
getPlatformList
(
$postData
);
//平台列表
public
function
getChannelList
(
$postData
);
//渠道列表
public
function
getCurrencyList
(
$postData
);
//货币类型列表
public
function
getAccountLog
(
$postData
);
//货币查询
}
\ No newline at end of file
config/local.php
View file @
275ee02a
<?php
return
[
'PAGE_NUM'
=>
20
,
'PLATFORM'
=>
[
'1009'
=>
'安卓-橙橙'
],
'CHANNEL'
=>
[
'1024'
=>
'微信小程序渠道'
],
'CURRENCY'
=>
[
'1'
=>
'元宝'
],
];
\ No newline at end of file
config/pro.php
View file @
275ee02a
<?php
return
[
'PAGE_NUM'
=>
20
,
'PLATFORM'
=>
[
'1009'
=>
'安卓-橙橙'
],
'CHANNEL'
=>
[
'1024'
=>
'微信小程序渠道'
],
'CURRENCY'
=>
[
'1'
=>
'元宝'
],
];
\ No newline at end of file
routes/api.php
View file @
275ee02a
...
...
@@ -38,5 +38,13 @@ Route::group(['namespace' => 'Api','middleware' => ['user.login']], function ()
Route
::
post
(
'/set/status'
,
'WhiteController@getSetStatus'
);
//设置白名单状态
});
Route
::
group
([
'prefix'
=>
'account'
],
function
()
{
Route
::
post
(
'/platform/list'
,
'AccountController@getPlatformList'
);
//平台列表
Route
::
post
(
'/channel/list'
,
'AccountController@getChannelList'
);
//渠道列表
Route
::
post
(
'/currency/list'
,
'AccountController@getCurrencyList'
);
//货币种类列表
Route
::
post
(
'/log'
,
'AccountController@getAccountLog'
);
//货币查询
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment