1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-22 19:44:02 +08:00
2020-09-17 21:29:29 +08:00

41 lines
830 B
PHP

<?php
namespace App\Services\Logic\Trade;
use App\Models\Trade as TradeModel;
use App\Services\Logic\OrderTrait;
use App\Services\Logic\Service;
use App\Validators\Trade as TradeValidator;
class TradeCreate extends Service
{
use OrderTrait;
public function handle()
{
$post = $this->request->getPost();
$order = $this->checkOrderBySn($post['order_sn']);
$user = $this->getLoginUser();
$validator = new TradeValidator();
$channel = $validator->checkChannel($post['channel']);
$trade = new TradeModel();
$trade->subject = $order->subject;
$trade->amount = $order->amount;
$trade->channel = $channel;
$trade->order_id = $order->id;
$trade->owner_id = $user->id;
$trade->create();
return $trade;
}
}