Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dex-admin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
dex-admin
Commits
6974e94b
Commit
6974e94b
authored
Jul 03, 2023
by
haojie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
f45c307c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
142 additions
and
36 deletions
+142
-36
app/Http/Controllers/Api/TradeController.php
+13
-3
app/Models/InscriptionTrading.php
+6
-0
app/Models/Inscriptions.php
+16
-0
app/Service/InscriptionService.php
+7
-0
app/Service/TradeService.php
+0
-0
app/Service/TransactionLogService.php
+1
-0
database/migrations/2023_06_29_065643_create_inscription_trading_table.php
+1
-1
database/migrations/2023_07_03_051955_create_inscriptions_table.php
+48
-0
resources/js/Pages/InscriptionShelves/components/MyInscription.vue
+17
-12
resources/js/Pages/InscriptionShelves/components/TradeLog.vue
+0
-0
resources/js/Pages/Trade/components/Market.vue
+21
-19
resources/js/layout/header.vue
+5
-1
resources/js/utils/api/index.ts
+5
-0
routes/api.php
+2
-0
No files found.
app/Http/Controllers/Api/TradeController.php
View file @
6974e94b
...
@@ -24,6 +24,15 @@ public function shelves(Request $request)
...
@@ -24,6 +24,15 @@ public function shelves(Request $request)
return
$this
->
success
(
'success'
,
$result
);
return
$this
->
success
(
'success'
,
$result
);
}
}
// 卖家下架铭文
public
function
cancal
(
Request
$request
)
{
$address
=
$request
->
input
(
'address'
,
''
);
$id
=
$request
->
input
(
'id'
,
''
);
$result
=
app
(
TradeService
::
class
)
->
sellerCancel
(
$id
,
$address
);
return
$this
->
success
(
'success'
,
$result
);
}
// 交易检测回调
// 交易检测回调
public
function
check
(
Request
$request
)
public
function
check
(
Request
$request
)
{
{
...
@@ -35,15 +44,16 @@ public function check(Request $request)
...
@@ -35,15 +44,16 @@ public function check(Request $request)
// 铭文查询
// 铭文查询
public
function
search
(
Request
$request
)
public
function
search
(
Request
$request
)
{
{
$address
=
$request
->
input
(
'address'
);
$pageType
=
$request
->
input
(
'page_type'
,
''
);
$type
=
$request
->
input
(
'type'
);
$address
=
$request
->
input
(
'address'
,
''
);
$type
=
$request
->
input
(
'type'
,
''
);
$page
=
$request
->
input
(
'page'
,
1
);
$page
=
$request
->
input
(
'page'
,
1
);
$limit
=
$request
->
input
(
'limit'
,
10
);
$limit
=
$request
->
input
(
'limit'
,
10
);
// 限制最大
// 限制最大
if
(
$limit
>
50
)
{
if
(
$limit
>
50
)
{
$limit
=
10
;
$limit
=
10
;
}
}
$result
=
app
(
TradeService
::
class
)
->
search
(
$address
,
$type
,
$page
,
$limit
);
$result
=
app
(
TradeService
::
class
)
->
search
(
$
pageType
,
$
address
,
$type
,
$page
,
$limit
);
return
$this
->
success
(
'success'
,
$result
);
return
$this
->
success
(
'success'
,
$result
);
}
}
...
...
app/Models/InscriptionTrading.php
View file @
6974e94b
...
@@ -34,4 +34,10 @@ class InscriptionTrading extends Model
...
@@ -34,4 +34,10 @@ class InscriptionTrading extends Model
protected
$casts
=
[
protected
$casts
=
[
'inscription'
=>
'array'
,
'inscription'
=>
'array'
,
];
];
// 一对一
public
function
inscription
()
{
return
$this
->
hasOne
(
Inscriptions
::
class
,
'order_id'
,
'id'
);
}
}
}
app/Models/Inscriptions.php
0 → 100644
View file @
6974e94b
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
class
Inscriptions
extends
Model
{
use
HasFactory
;
protected
$table
=
'inscriptions'
;
// 允许批量赋值
protected
$fillable
=
[
'transaction_hash'
,
'current_owner'
,
'content_uri'
,
'uri_p'
,
'uri_op'
,
'uri_tick'
,
'uri_id'
,
'uri_amt'
,
'creator'
,
'creation_timestamp'
];
}
app/Service/InscriptionService.php
View file @
6974e94b
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Service
;
namespace
App\Service
;
use
App\Models\Inscriptions
;
use
App\Service\RequestService
;
use
App\Service\RequestService
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Log
;
...
@@ -11,6 +12,12 @@ class InscriptionService
...
@@ -11,6 +12,12 @@ class InscriptionService
// 铭文请求地址
// 铭文请求地址
public
const
InscriptionDomain
=
'https://eth-script-indexer-eca25c4cf43b.herokuapp.com'
;
public
const
InscriptionDomain
=
'https://eth-script-indexer-eca25c4cf43b.herokuapp.com'
;
// 创建铭文信息
public
function
create
(
$data
)
{
Inscriptions
::
query
()
->
create
(
$data
);
}
public
function
getWalletInscription
(
$address
=
''
)
public
function
getWalletInscription
(
$address
=
''
)
{
{
if
(
!
$address
)
{
if
(
!
$address
)
{
...
...
app/Service/TradeService.php
View file @
6974e94b
This diff is collapsed.
Click to expand it.
app/Service/TransactionLogService.php
View file @
6974e94b
...
@@ -30,6 +30,7 @@ public function create($params)
...
@@ -30,6 +30,7 @@ public function create($params)
$data
[
'hash'
]
=
$params
[
'hash'
];
$data
[
'hash'
]
=
$params
[
'hash'
];
$res
=
$model
->
where
(
'hash'
,
$data
[
'hash'
])
->
first
();
$res
=
$model
->
where
(
'hash'
,
$data
[
'hash'
])
->
first
();
if
(
$res
)
{
if
(
$res
)
{
Log
::
info
(
$data
[
'hash'
]);
throw
new
UserException
(
1
,
'支付hash已存在'
);
throw
new
UserException
(
1
,
'支付hash已存在'
);
}
}
}
}
...
...
database/migrations/2023_06_29_065643_create_inscription_trading_table.php
View file @
6974e94b
...
@@ -19,7 +19,7 @@ public function up()
...
@@ -19,7 +19,7 @@ public function up()
$table
->
text
(
'inscription'
)
->
comment
(
'铭文数据'
);
$table
->
text
(
'inscription'
)
->
comment
(
'铭文数据'
);
// 原始金额--卖家输入的
// 原始金额--卖家输入的
$table
->
decimal
(
'original_amount'
,
20
,
8
)
->
comment
(
'原始金额'
);
$table
->
decimal
(
'original_amount'
,
20
,
8
)
->
comment
(
'原始金额'
);
// 卖家卖出时的收款地址
// 卖家卖出时
,平台
的收款地址
$table
->
string
(
'sell_admin_account'
)
->
comment
(
'卖家卖出时的收款地址'
);
$table
->
string
(
'sell_admin_account'
)
->
comment
(
'卖家卖出时的收款地址'
);
// 买家买入时的收款地址
// 买家买入时的收款地址
$table
->
string
(
'buy_admin_account'
)
->
nullable
()
->
comment
(
'买家买入时的收款地址'
);
$table
->
string
(
'buy_admin_account'
)
->
nullable
()
->
comment
(
'买家买入时的收款地址'
);
...
...
database/migrations/2023_07_03_051955_create_inscriptions_table.php
0 → 100644
View file @
6974e94b
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
return
new
class
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'inscriptions'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
// 订单id
$table
->
bigInteger
(
'order_id'
)
->
default
(
0
)
->
comment
(
'订单id'
);
// 铭文hash
$table
->
string
(
'transaction_hash'
)
->
comment
(
'铭文hash'
);
$table
->
string
(
'current_owner'
)
->
comment
(
'current_owner'
);
$table
->
string
(
'content_uri'
)
->
comment
(
'content_uri'
);
// "p":"erc-20"
$table
->
string
(
'uri_p'
)
->
nullable
()
->
comment
(
'uri_p'
);
// "op":"mint"
$table
->
string
(
'uri_op'
)
->
nullable
()
->
comment
(
'uri_op'
);
// "tick":"eths"
$table
->
string
(
'uri_tick'
)
->
nullable
()
->
comment
(
'uri_tick'
);
// "id":"11532"
$table
->
bigInteger
(
'uri_id'
)
->
default
(
0
)
->
comment
(
'uri_id'
);
// "amt":"1000"
$table
->
bigInteger
(
'uri_amt'
)
->
default
(
0
)
->
comment
(
'uri_amt'
);
$table
->
string
(
'creator'
)
->
comment
(
'creator'
);
$table
->
dateTime
(
'creation_timestamp'
)
->
comment
(
'creation_timestamp'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'inscriptions'
);
}
};
resources/js/Pages/InscriptionShelves/components/MyInscription.vue
View file @
6974e94b
...
@@ -125,7 +125,7 @@ import {
...
@@ -125,7 +125,7 @@ import {
inscriptionListAdminFilter
,
inscriptionListAdminFilter
,
}
from
"@/utils/api/public"
;
}
from
"@/utils/api/public"
;
import
{
inertia_data
}
from
"@/constants/token"
;
import
{
inertia_data
}
from
"@/constants/token"
;
import
{
sellerTradeLog
}
from
"@/utils/api"
;
import
{
sellerTradeLog
,
SellerCancel
}
from
"@/utils/api"
;
const
store
=
useStore
();
const
store
=
useStore
();
const
imgs
=
{
const
imgs
=
{
eth
:
new
URL
(
"../../../assets/svg/trade/eth2.svg"
,
import
.
meta
.
url
).
href
,
eth
:
new
URL
(
"../../../assets/svg/trade/eth2.svg"
,
import
.
meta
.
url
).
href
,
...
@@ -140,6 +140,9 @@ const confirm_dialog = ref(false);
...
@@ -140,6 +140,9 @@ const confirm_dialog = ref(false);
// 全局数据
// 全局数据
const
app_info
=
inject
(
inertia_data
);
const
app_info
=
inject
(
inertia_data
);
// 当前选择的取消id
const
cancel_id
=
ref
(
""
);
// 当前选择的按钮
// 当前选择的按钮
const
currentBtn
=
ref
(
"1"
);
const
currentBtn
=
ref
(
"1"
);
// 按钮组
// 按钮组
...
@@ -200,16 +203,6 @@ const cardText = (item: any) => {
...
@@ -200,16 +203,6 @@ const cardText = (item: any) => {
const
setCurrentList
=
(
list
:
any
[])
=>
{
const
setCurrentList
=
(
list
:
any
[])
=>
{
current_list
.
list
=
JSON
.
parse
(
JSON
.
stringify
(
list
));
current_list
.
list
=
JSON
.
parse
(
JSON
.
stringify
(
list
));
};
};
// 获取本地数据
const
getWalletLocalData
=
(
key
:
"type"
|
"address"
|
"MaskAddress"
=
"type"
)
=>
{
const
res
=
getLocal
(
userWalletKey
,
"session"
);
if
(
res
)
{
return
res
[
key
];
}
return
""
;
};
// 出售
// 出售
const
sellNow
=
(
item
:
any
)
=>
{
const
sellNow
=
(
item
:
any
)
=>
{
...
@@ -266,6 +259,8 @@ const getTradeList = async () => {
...
@@ -266,6 +259,8 @@ const getTradeList = async () => {
try
{
try
{
//
//
const
res
:
any
=
await
sellerTradeLog
({
const
res
:
any
=
await
sellerTradeLog
({
// 卖出类型
page_type
:
2
,
type
:
currentBtn
.
value
,
type
:
currentBtn
.
value
,
address
:
userAddress
.
value
.
address
,
address
:
userAddress
.
value
.
address
,
page
:
adminTableList
.
pageNum
,
page
:
adminTableList
.
pageNum
,
...
@@ -292,11 +287,21 @@ const getTradeList = async () => {
...
@@ -292,11 +287,21 @@ const getTradeList = async () => {
const
onCanel
=
(
item
:
any
)
=>
{
const
onCanel
=
(
item
:
any
)
=>
{
// 打开确认弹窗
// 打开确认弹窗
confirm_dialog
.
value
=
true
;
confirm_dialog
.
value
=
true
;
// 记录本次的id
cancel_id
.
value
=
item
.
id
;
};
};
// 确定取消订单
// 确定取消订单
const
ConfirmCancel
=
()
=>
{
const
ConfirmCancel
=
async
()
=>
{
//
//
try
{
const
res
:
any
=
await
SellerCancel
({
id
:
cancel_id
.
value
,
address
:
userAddress
.
value
.
address
,
});
}
catch
(
e
)
{
console
.
log
(
e
);
}
};
};
// 查看hash
// 查看hash
...
...
resources/js/Pages/InscriptionShelves/components/TradeLog.vue
View file @
6974e94b
This diff is collapsed.
Click to expand it.
resources/js/Pages/Trade/components/Market.vue
View file @
6974e94b
...
@@ -12,26 +12,28 @@
...
@@ -12,26 +12,28 @@
</div>
</div>
</div>
</div>
<t-row
class=
"trade-card-box"
>
<template
v-if=
"tableList.list.length"
>
<template
v-for=
"item in tableList.list"
:key=
"item.id"
>
<t-row
class=
"trade-card-box"
>
<t-col
:span=
"1.5"
>
<template
v-for=
"item in tableList.list"
:key=
"item.id"
>
<CustomCard
:cardData=
"item"
>
<t-col
:span=
"1.5"
>
<template
#
footer
>
<CustomCard
:cardData=
"item"
>
<div
class=
"buy-card-footer"
>
<template
#
footer
>
<div
class=
"price"
>
<div
class=
"buy-card-footer"
>
$
{{
item
.
original_amount
}}
<div
class=
"price"
>
$
{{
item
.
original_amount
}}
</div>
<t-button
@
click=
"buyNow(item)"
class=
"buy-now-button"
>
立即购买
</t-button
>
</div>
</div>
<t-button
</
template
>
@
click=
"buyNow(item)"
</CustomCard>
class=
"buy-now-button"
</t-col>
>
立即购买
</t-button
</template>
>
</t-row>
</div>
</template>
</
template
>
</CustomCard>
</t-col>
</template>
</t-row>
<BuyDialog
<BuyDialog
v-model=
"dialog_info.status"
v-model=
"dialog_info.status"
:info=
"dialog_info.info"
:info=
"dialog_info.info"
...
...
resources/js/layout/header.vue
View file @
6974e94b
...
@@ -29,10 +29,14 @@ const { pathname } = getRoute();
...
@@ -29,10 +29,14 @@ const { pathname } = getRoute();
const
currentBtn
=
ref
(
pathname
);
const
currentBtn
=
ref
(
pathname
);
const
btns
=
[
const
btns
=
[
{
{
label
:
"铭文
市场
"
,
label
:
"铭文"
,
path
:
"/inscription/market"
,
path
:
"/inscription/market"
,
},
},
{
{
label
:
"铭文市场"
,
path
:
"/trade"
,
},
{
label
:
"OTC交易"
,
label
:
"OTC交易"
,
path
:
"/otcTrade"
,
path
:
"/otcTrade"
,
},
},
...
...
resources/js/utils/api/index.ts
View file @
6974e94b
...
@@ -33,3 +33,8 @@ export const buyerPaymentSuccess = (data: any) => {
...
@@ -33,3 +33,8 @@ export const buyerPaymentSuccess = (data: any) => {
//
//
return
request
.
post
(
"/api/inscription/buy"
,
data
);
return
request
.
post
(
"/api/inscription/buy"
,
data
);
};
};
// 卖家取消订单
export
const
SellerCancel
=
(
data
:
any
)
=>
{
return
request
.
post
(
"/api/inscription/sell/cancel"
,
data
);
};
routes/api.php
View file @
6974e94b
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
Route
::
get
(
'/ethscriptions/owned_by'
,
'InscriptionController@wallet'
);
Route
::
get
(
'/ethscriptions/owned_by'
,
'InscriptionController@wallet'
);
// 铭文上架
// 铭文上架
Route
::
post
(
'/shelves'
,
'TradeController@shelves'
);
Route
::
post
(
'/shelves'
,
'TradeController@shelves'
);
// 下架
Route
::
post
(
'/sell/cancel'
,
'TradeController@shelves'
);
// 交易检测回调
// 交易检测回调
Route
::
post
(
'/admin/check'
,
'TradeController@check'
);
Route
::
post
(
'/admin/check'
,
'TradeController@check'
);
// 卖家交易记录
// 卖家交易记录
...
...
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