| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace addons\AvoidTax\common\models;
- use common\models\base\BaseActiveRecord;
- use Yii;
- /**
- * This is the model class for table "{{%addons_tax_refund}}".
- *
- * @property int $id
- * @property int $mall_id
- * @property int $book_id 记账本ID
- * @property float $amount 退回金额
- * @property string $account_name 账户名称
- * @property string $account_number 账户账号
- * @property string|null $response 响应参数
- * @property int|null $created_at
- * @property int|null $updated_at
- */
- class TaxRefund extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_tax_refund}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'book_id', 'amount', 'account_name', 'account_number'], 'required'],
- [['mall_id', 'book_id', 'created_at', 'updated_at'], 'integer'],
- [['amount'], 'number'],
- [['response'], 'string'],
- [['account_name'], 'string', 'max' => 32],
- [['account_number'], 'string', 'max' => 64],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'book_id' => 'Book ID',
- 'amount' => 'Amount',
- 'account_name' => 'Account Name',
- 'account_number' => 'Account Number',
- 'response' => 'Response',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- /**
- * 添加提现数据
- *
- * @param array $data
- * @return static|false
- */
- public static function addLog(array $data)
- {
- $model = new static();
- $model->load($data, '');
-
- return $model->save() ? $model : false;
- }
- /**
- * @param array|string $response
- * @return void
- */
- public function setResponse($response)
- {
- $this->response = is_array($response) ? json_encode($response) : $response;
- $this->save();
- }
- }
|