SokabeController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace addons\QiJuhe\backend\controllers;
  3. use addons\QiJuhe\common\service\OrderService;
  4. use common\events\goods\SupplyChainGoodsChangeEvent;
  5. use common\models\goods\Goods;
  6. use Yii;
  7. use yii\web\Controller;
  8. class SokabeController extends Controller
  9. {
  10. public function actionIndex()
  11. {
  12. $service = new OrderService([]);
  13. $res = $service->updateLogistic('s202207231651381132854821');
  14. }
  15. public function actionIndex2()
  16. {
  17. // $list = Goods::find()
  18. // ->where(['mall_id' => 1])
  19. // ->andWhere(['not like', 'cover_pic', '%gxtongyu.oss-cn-guangzhou.aliyuncs.com%'])
  20. // ->select(['id', 'mall_id'])
  21. // ->limit(10)
  22. // ->all();
  23. $sql = "SELECT id, mall_id FROM `qimall_goods` WHERE `cover_pic` NOT LIKE '%gxtongyu.oss-cn-guangzhou.aliyuncs.com%' and is_on_sale = 1 and `status` = 1 LIMIT 0,1000";
  24. $list = Yii::$app->getDb()->createCommand($sql)->queryAll();
  25. foreach ($list as $item) {
  26. $data = [
  27. 'goods_id' => $item['id'],
  28. 'mall_id' => $item['mall_id'],
  29. ];
  30. $event = new SupplyChainGoodsChangeEvent();
  31. Yii::$app->services->events->dispatch($event, $data, $event->listeners);
  32. }
  33. }
  34. }