You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/api/model/user/IdentityOrder.php

66 lines
1.6 KiB

<?php
namespace app\api\model\user;
use app\api\service\User as UserService;
use app\common\model\user\IdentityOrder as BaseIdentityOrder;
use app\common\service\Order as OrderService;
use cores\exception\BaseException;
use function getPlatform;
class IdentityOrder extends BaseIdentityOrder
{
/**
* 隐藏字段
* @var array
*/
protected $hidden = [
'order_type',
'create_time',
'update_time',
'store_id',
];
/**
* @notes:创建订单
* @param array $identityInfo
* @return bool
* @throws BaseException
* @author: wanghousheng
*/
public function createOrder(array $identityInfo): bool
{
$data = [
'user_id' => UserService::getCurrentLoginUserId(),
'order_no' => OrderService::createOrderNo(),
'identity_id' => $identityInfo['identity_id'],
'order_type' => $identityInfo['type'],
'pay_price' => $identityInfo['price'],
'month' => $identityInfo['month'],
'platform' => getPlatform(),
'store_id' => self::$storeId,
];
return $this->save($data);
}
/**
* 获取订单详情 (待付款状态)
* @param string $orderNo 订单号
* @return array|null|static
*/
public static function getPayDetail(string $orderNo)
{
return self::detail(['order_no' => $orderNo]);
}
/**
* @notes:编辑
* @param $data
* @return bool
* @author: wanghousheng
*/
public function edit($data): bool
{
return $this->save($data) !== false;
}
}