dingd
This commit is contained in:
@@ -2,17 +2,26 @@
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use think\response\Json;
|
||||
|
||||
class Order
|
||||
{
|
||||
|
||||
public function create()
|
||||
/**
|
||||
* Notes : 捐助订单
|
||||
*
|
||||
* @Date : 2022/9/9 16:30
|
||||
* @Author : <Jason.C>
|
||||
* @return Json
|
||||
*/
|
||||
public function create(): Json
|
||||
{
|
||||
$userid = $GLOBALS['data']['userid'];
|
||||
$order = \app\model\Order::create([
|
||||
'student_id' => 1,
|
||||
$amount = $GLOBALS['data']['amount'] ?? 15;
|
||||
|
||||
$order = \app\model\Order::create([
|
||||
'student_id' => 14,
|
||||
'user_id' => $userid,
|
||||
'amount' => 15,
|
||||
'type' => 1,
|
||||
'amount' => $amount,
|
||||
'status' => 0,
|
||||
]);
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ use think\Model;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
}
|
||||
15
app/model/Student.php
Normal file
15
app/model/Student.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
use think\model\relation\HasMany;
|
||||
|
||||
class Student extends Model
|
||||
{
|
||||
|
||||
public function orders(): HasMany
|
||||
{
|
||||
return $this->hasMany(Order::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user