| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace addons\Store\common\models;
- use common\models\base\BaseActiveRecord;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_store_common_sync_logs".
- *
- * @property int $id
- * @property string $type 类型
- * @property int $self_store_id 自身门店ID
- * @property int $source_store_id 源门店ID
- * @property int $type_id 自身门店的类型id
- * @property int $source_type_id 源门店的的类型id
- * @property int $created_at
- * @property int $updated_at
- */
- class StoreCommonSyncLogs extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_store_common_sync_logs}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'self_store_id', 'source_store_id', 'type_id', 'source_type_id', 'created_at', 'updated_at'], 'integer'],
- [['type'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'type' => '类型',
- 'mall_id' => '商城ID',
- 'self_store_id' => '自身门店ID',
- 'source_store_id' => '源门店ID',
- 'type_id' => '自身门店的类型id',
- 'source_type_id' => '源门店的的类型id',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- ];
- }
- public static function getTypeIds($self_store_id, $source_store_id, $type, $source_type_id)
- {
- $goods_common_rule_sync_logs_list = self::lists([
- 'where' => [
- ['self_store_id' => $self_store_id],
- ['type' => $type],
- ['source_store_id' => $source_store_id],
- ['source_type_id' => $source_type_id]
- ],
- ]);
- return array_column($goods_common_rule_sync_logs_list, 'source_type_id');
- }
- public static function add($self_store_id, $source_store_id, $source_type_id, $type, $type_id, $mall_id)
- {
- $obj = new self();
- $obj->mall_id = $mall_id;
- $obj->self_store_id = $self_store_id;
- $obj->source_store_id = $source_store_id;
- $obj->source_type_id = $source_type_id;
- $obj->type = $type;
- $obj->type_id = $type_id;
- $obj->save();
- }
- }
|