| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use app\jobs\storeSync\DiyCommon;
- use Yii;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%qrcode}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property string $qrcode_bg
- * @property string $avatar_size
- * @property string $avatar_position
- * @property string $qrcode_size
- * @property string $qrcode_position
- * @property string $font_position
- * @property string $font
- * @property string $preview
- * @property integer $is_delete
- * @property integer $created_at
- * @property integer $updated_at
- * @property integer $type
- */
- class Qrcode extends \yii\db\ActiveRecord
- {
- // 分销海报
- const TYPE_SHARE = 0;
- // 门店海报
- const TYPE_MD = 1;
- // 门店海报
- const TYPE_MCH = 12;
- // 门店海报
- const STORE_IMG = 20;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%qrcode}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'qrcode_bg', 'avatar_size', 'avatar_position', 'qrcode_size', 'qrcode_position',
- 'font_position', 'font', 'preview'], 'required'],
- [['store_id', 'is_delete', 'created_at', 'updated_at','type'], 'integer'],
- [['qrcode_bg', 'font', 'preview'], 'string'],
- [['avatar_size', 'avatar_position', 'qrcode_size', 'qrcode_position', 'font_position'], 'string', 'max' => 255],
- ['type', 'default', 'value'=>0]
- ];
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
- ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
- ]
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'qrcode_bg' => '背景图片',
- 'avatar_size' => '头像大小{\"w\":\"\",\"h\":\"\"}',
- 'avatar_position' => '头像坐标{\"x\":\"\",\"y\":\"\"}',
- 'qrcode_size' => '二维码大小{\"w\":\"\",\"h\":\"\"}',
- 'qrcode_position' => '二维码坐标{\"x\":\"\",\"y\":\"\"}',
- 'font_position' => '字体坐标{\"x\":\"\",\"y\":\"\"}',
- 'font' => '字体设置
- {
- \"size\":大小,
- \"color\":\"r,g,b\"
- }',
- 'preview'=>'预览图',
- 'is_delete' => 'Is Delete',
- 'created_at' => 'add time',
- 'updated_at' => 'modify time',
- 'type' => '海报类型'
- ];
- }
- public function afterSave($insert, $changedAttributes)
- {
- parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
- if (!$insert) {
- if ($this->type === Qrcode::TYPE_SHARE) {
- (new DiyCommon)->JobBehaviors($this->store_id, StoreSyncExtLog::TYPE_SHARE_CONFIG, ['share_qrcode']);
- }
- }
- }
- }
|