| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace addons\AvoidTax\common\models;
- use Yii;
- /**
- * This is the model class for table "{{%addons_tax_order_book}}".
- *
- * @property int $id
- * @property int|null $mall_id
- * @property int|null $order_id
- * @property string|null $out_biz_no 订单号
- * @property string|null $identity 记账本
- * @property string|null $agreement_no 支付宝系统中用以唯一标识用户签约记录的编号
- * @property float|null $amount
- * @property int|null $created_at
- */
- class TaxOrderBook extends \yii\db\ActiveRecord
- {
- const PREFIX = 'book_';
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_tax_order_book}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'order_id', 'created_at'], 'integer'],
- [['amount'], 'number'],
- [['out_biz_no', 'identity', 'agreement_no'], 'string', 'max' => 64],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'order_id' => 'Order ID',
- 'out_biz_no' => 'Out Biz No',
- 'identity' => 'Identity',
- 'agreement_no' => 'Agreement No',
- 'amount' => 'Amount',
- 'created_at' => 'Created At',
- ];
- }
- public static function getBookNo($no)
- {
- return self::PREFIX . $no;
- }
- public static function addOrder($data)
- {
- array_merge($data, [
- 'created_at' => time(),
- ]);
- $model = new self;
- $model->load($data, '');
- return $model->save();
- }
- }
|