| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace addons\Community\common\models;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_community_notice".
- *
- * @property int $id
- * @property int $mall_id Mall ID
- * @property int $status 状态 [1启用 0禁用 -1删除]
- * @property int $created_at 创建时间
- * @property int $updated_at 更新时间
- * @property int $user_id 用户ID
- * @property int $send_at 发送时间
- * @property array|null $content 发送内容
- * @property array|null $res 响应内容
- * @property string $mobile 接收号码
- * @property string $area_code 接收号码
- * @property string $gateway 接收号码
- */
- class CommunityNotice extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_community_notice';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'status', 'created_at', 'updated_at', 'user_id', 'send_at'], 'integer'],
- [['content', 'res'], 'safe'],
- [['mobile', 'gateway'], 'string', 'max' => 20],
- [['area_code'], 'string', 'max' => 10],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => 'Mall ID',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'user_id' => 'User ID',
- 'send_at' => 'Send At',
- 'content' => 'Content',
- 'res' => 'Res',
- 'mobile' => 'Mobile',
- ];
- }
- /**
- * @param int $mall_id
- * @param int $user_id
- * @param string $gateway
- * @param string $area_code
- * @param string $mobile
- * @param int $send_at
- * @param array $content
- * @return true
- * @throws \Exception
- */
- public static function setData(int $mall_id, int $user_id, string $gateway, string $area_code, string $mobile, int $send_at, array $content)
- {
- $model = new self();
- $model->mall_id = $mall_id;
- $model->user_id = $user_id;
- $model->mobile = $mobile;
- $model->send_at = $send_at;
- $model->content = $content;
- $model->gateway = $gateway;
- $model->area_code = $area_code;
- if (!$model->save()) throw new \Exception($model->getErrorMessage());
- return true;
- }
- }
|