| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use yii\base\ErrorException;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- use Yii;
- /**
- * This is the model class for table "{{%partner_pool_award-record}}".
- *
- * @property integer $id
- * @property float $money
- * @property integer $store_id
- * @property integer $store_settle_id
- * @property integer $yc_settle_id
- * @property integer $created_at
- * @property string $order_no
- */
- class StoreYcOperationRecord extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%store_yc_operation_record}}';
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
- ]
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [[ 'store_id', 'store_settle_id','yc_settle_id'], 'integer'],
- [['order_no'], 'string'],
- [['money'], 'number'],
- [['created_at'], 'safe']
- ];
- }
- public static function createRecord($money,$store_id,$store_settle_id,$yc_settle_id){
- try {
- $record = new self();
- $record->money=$money;
- $record->store_id=$store_id;
- $record->store_settle_id=$store_settle_id;
- $record->yc_settle_id=$yc_settle_id;
- $record->order_no=\app\utils\OrderNo::getOrderNo(\app\utils\OrderNo::SOTRE_YC_OPERATION);
- if (!$record->save())throw new ErrorException('保存失败'.json_encode($record->getErrors()));
- return true;
- }catch (ErrorException $e){
- //debug_log([__METHOD__, __LINE__, "发放是失败 {$e->getMessage() }"], "app_debug_partner.log");
- return false;
- }
- }
- }
|