TaxOrderList.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace addons\AvoidTax\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%addons_tax_order_list}}".
  6. *
  7. * @property int $id
  8. * @property int $mall_id
  9. * @property int $order_id
  10. * @property string $name
  11. * @property string $account
  12. * @property float $amount
  13. * @property int $created_at
  14. */
  15. class TaxOrderList extends \yii\db\ActiveRecord
  16. {
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public static function tableName()
  21. {
  22. return '{{%addons_tax_order_list}}';
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function rules()
  28. {
  29. return [
  30. [['mall_id', 'order_id', 'created_at'], 'integer'],
  31. [['amount'], 'number'],
  32. [['name'], 'string', 'max' => 32],
  33. [['account'], 'string', 'max' => 64],
  34. ];
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function attributeLabels()
  40. {
  41. return [
  42. 'id' => 'ID',
  43. 'mall_id' => 'Mall ID',
  44. 'order_id' => 'Order ID',
  45. 'name' => 'Name',
  46. 'account' => 'Account',
  47. 'amount' => 'Amount',
  48. 'created_at' => 'Created At',
  49. ];
  50. }
  51. /**
  52. * 批量插入汇款
  53. *
  54. * @param array $list
  55. * @return boolean
  56. */
  57. public function addList($list)
  58. {
  59. if (empty($list)) return false;
  60. $field = array_keys($list[array_key_first($list)]);
  61. return Yii::$app->db->createCommand()->batchInsert(self::tableName(), $field, $list)->execute();
  62. }
  63. }