FixController.php 640 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace addons\WechatVideoShop\console\controllers;
  3. use addons\WechatVideoShop\common\models\WechatVideoShopExpressTemplate;
  4. use yii\console\Controller;
  5. class FixController extends Controller
  6. {
  7. public function actionExpressTemplate()
  8. {
  9. /**
  10. * @var $each WechatVideoShopExpressTemplate
  11. */
  12. foreach (WechatVideoShopExpressTemplate::find()->where('==', 't_hash', '')->each() as $each) {
  13. $t_hash = json_encode($each->content);
  14. $each->t_hash = $t_hash;
  15. if (!$each->save()) {
  16. var_dump($each->getErrorMessage());
  17. }
  18. }
  19. }
  20. }