add unsibscribe newsletter
This commit is contained in:
@@ -108,6 +108,10 @@ class TicketController extends Controller {
|
||||
public function actionDaily(){
|
||||
set_time_limit(0);
|
||||
$this->actionWarnExpire();
|
||||
}
|
||||
|
||||
public function actionWeekly(){
|
||||
set_time_limit(0);
|
||||
$this->actionNewsletter();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160523_053901_alter_customer_set_default_newsletter_false extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->execute("update customer set newsletter = 0");
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160523_053901_alter_customer_set_default_newsletter_false cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
use common\models\Customer;
|
||||
|
||||
class m160523_055217_add_customer_newsletter_token extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn("customer", "newsletter_token", "string" );
|
||||
|
||||
$customers = Customer::find()->all();
|
||||
|
||||
foreach ($customers as $customer ){
|
||||
$customer->newsletter_token = Yii::$app->security->generateRandomString() . '_' . time();
|
||||
$customer->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160523_055217_add_customer_newsletter_token cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user