Commit 08fc43c8 by haojie

1

parent b5bd4992
...@@ -108,7 +108,7 @@ public function updateInscription($data, $order_id = 0) ...@@ -108,7 +108,7 @@ public function updateInscription($data, $order_id = 0)
// 过滤出铭文信息 // 过滤出铭文信息
preg_match('/{.*}/', $inscription['content_uri'], $matches); preg_match('/{.*}/', $inscription['content_uri'], $matches);
$content_uri = $matches[0]; $content_uri = $matches[0];
if ($content_uri && $order_id != 0) { if ($content_uri && $order_id != 0 && $order_id) {
$content_uri = json_decode($content_uri, true); $content_uri = json_decode($content_uri, true);
// 获取对应的 // 获取对应的
$inscriptionInfo = []; $inscriptionInfo = [];
...@@ -164,7 +164,6 @@ public function userShelves($payment_address, $hash, $inscription, $price) ...@@ -164,7 +164,6 @@ public function userShelves($payment_address, $hash, $inscription, $price)
if (blank($payment_address) || blank($hash) || blank($inscription)) { if (blank($payment_address) || blank($hash) || blank($inscription)) {
throw new UserException(1, '非法操作'); throw new UserException(1, '非法操作');
} }
$inscription = self::updateInscription($inscription);
// 重复的hash禁止上架 // 重复的hash禁止上架
$is_exist = $this->model()->where('seller_transfer_inscription_hash', $hash)->first(); $is_exist = $this->model()->where('seller_transfer_inscription_hash', $hash)->first();
if ($is_exist) { if ($is_exist) {
...@@ -193,6 +192,8 @@ public function userShelves($payment_address, $hash, $inscription, $price) ...@@ -193,6 +192,8 @@ public function userShelves($payment_address, $hash, $inscription, $price)
]; ];
$result = $this->create($data); $result = $this->create($data);
if ($result) { if ($result) {
// 创建铭文
$inscription = self::updateInscription($inscription, $result->id);
// 创建日志 // 创建日志
$data['order_id'] = $result->id; $data['order_id'] = $result->id;
$data['trade_type'] = self::TRADE_TYPE_INSCRIPTION; $data['trade_type'] = self::TRADE_TYPE_INSCRIPTION;
...@@ -288,7 +289,7 @@ public function sellerShelvesSuccess($data) ...@@ -288,7 +289,7 @@ public function sellerShelvesSuccess($data)
$inscription = $data['inscription'] ?? null; $inscription = $data['inscription'] ?? null;
// 更新铭文信息 // 更新铭文信息
if ($inscription) { if ($inscription) {
$inscription = self::updateInscription($data['inscription']); $inscription = self::updateInscription($data['inscription'], $data['id']);
$update['inscription'] = $inscription; $update['inscription'] = $inscription;
} }
$result = $this->model()->where('id', $data['id'])->update($update); $result = $this->model()->where('id', $data['id'])->update($update);
...@@ -503,7 +504,7 @@ public function platformTransferInscription($status, $hash, $order, $inscription ...@@ -503,7 +504,7 @@ public function platformTransferInscription($status, $hash, $order, $inscription
$order->buyer_status = $buyer_status; $order->buyer_status = $buyer_status;
// 更新铭文数据 // 更新铭文数据
if ($inscription) { if ($inscription) {
$inscription = self::updateInscription($inscription); $inscription = self::updateInscription($inscription, $order->id);
$order->inscription = $inscription; $order->inscription = $inscription;
} }
$order->save(); $order->save();
...@@ -527,7 +528,7 @@ public function platformTransferInscriptionSeller($status, $hash, $order, $inscr ...@@ -527,7 +528,7 @@ public function platformTransferInscriptionSeller($status, $hash, $order, $inscr
$order_status = self::ORDER_STATUS_FAIL; $order_status = self::ORDER_STATUS_FAIL;
} }
if ($inscription) { if ($inscription) {
$inscription = self::updateInscription($inscription); $inscription = self::updateInscription($inscription, $order->id);
$order->inscription = $inscription; $order->inscription = $inscription;
} }
$order->seller_cancel_hash = $hash; $order->seller_cancel_hash = $hash;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment