46 lines
881 B
PHP
46 lines
881 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: zn
|
|
* Date: 2017/8/9
|
|
* Time: 13:54
|
|
*/
|
|
|
|
namespace common\modules\qixunpay;
|
|
|
|
|
|
use yii\db\ActiveRecord;
|
|
|
|
/**
|
|
CREATE TABLE `order_creater` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`created_at` int(11) DEFAULT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT='订单生成'
|
|
*/
|
|
|
|
/**
|
|
* Class Order
|
|
* @property int $id
|
|
* @property int $created_at
|
|
*/
|
|
class OrderCreater extends ActiveRecord
|
|
{
|
|
public function rules()
|
|
{
|
|
return [
|
|
['id', 'default', 'value' => 0],
|
|
|
|
['created_at', 'default', 'value' => 0],
|
|
];
|
|
}
|
|
|
|
public static function createOrderID()
|
|
{
|
|
$order = new OrderCreater();
|
|
$order->created_at = time();
|
|
if (!$order->save()) throw new \Exception('create pay order id error');
|
|
|
|
return $order->id;
|
|
}
|
|
} |