| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- namespace addons\Scratch\common\models;
- use addons\Coupon\common\models\AddonsCoupon;
- use addons\Scratch\common\enums\ScratchEnum;
- use common\models\base\BaseActiveRecord;
- use common\models\goods\Goods;
- use common\models\mall\MallAddons;
- use common\models\user\User;
- /**
- * Class ScratchSettingModel
- * @package addons\Scratch\common\models
- */
- class ScratchSettingModel extends BaseActiveRecord
- {
- /** @var int 抽奖规则1每人每天一次 2每人一次*/
- const TYPE_DAY = 1;
- const TYPE_USER = 2;
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_scratch_setting}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'type', 'start_at', 'end_at', 'rule', 'payment_type', 'send_type'], 'required'],
- [['mall_id', 'type', 'probability', 'oppty', 'deplete_integral_num', 'is_sms', 'is_mail', 'is_print','is_wechat'], 'integer'],
- [['start_at', 'end_at', 'created_at', 'updated_at'], 'safe'],
- [['rule', 'payment_type', 'send_type','background_imgs'], 'string'],
- [['title'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'title' => '小程序标题',
- 'type' => '1.天 2 用户',
- 'probability' => '概率',
- 'oppty' => '抽奖次数',
- 'start_at' => '开始时间',
- 'end_at' => '结束时间',
- 'deplete_integral_num' => '消耗积分',
- 'rule' => '规则',
- 'background_imgs' => '背景图',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'payment_type' => '支付方式',
- 'send_type' => '发货方式',
- 'is_sms' => '开启短信提醒',
- 'is_wechat' => '开启微信推送提醒',
- 'is_mail' => '开启邮件提醒',
- 'is_print' => '开启打印',
- ];
- }
- /**
- * 背景图默认配置
- * @throws \Exception
- */
- public static function getBackgroundImgs()
- {
- try {
- $background_imgs = [
- 'color' => '',
- 'image'=> \Yii::$app->request->hostInfo . '/resources/addons/scratch/img/index-bg.png'
- ];
- return $background_imgs;
- } catch (\Exception $exception) {
- throw new \Exception($exception->getMessage());
- }
- }
- }
|